summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--src/Fl.cxx33
-rw-r--r--src/Fl_Button.cxx24
-rw-r--r--src/Fl_Widget.cxx19
4 files changed, 49 insertions, 30 deletions
diff --git a/CHANGES b/CHANGES
index 5ba24da1c..bb631b05b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
CHANGES IN FLTK 1.1.0rc3
- Documentation updates.
+ - Fixed some redraw() bugs, and now redraw portions of
+ the parent widget when the label appears outside the
+ widget.
- The boolean (char) value methods in Fl_Preferences
have been removed since some C++ compilers can't
handle char and int value methods with the same name.
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 75a410194..d24ec7505 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.cxx,v 1.24.2.41.2.33 2002/05/23 16:47:41 easysw Exp $"
+// "$Id: Fl.cxx,v 1.24.2.41.2.34 2002/06/02 17:52:36 easysw Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -824,7 +824,34 @@ void Fl::paste(Fl_Widget &receiver) {
#include <FL/fl_draw.H>
-void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
+void Fl_Widget::redraw() {
+ if (box() == FL_NO_BOX) {
+ // Widgets with the FL_NO_BOX boxtype need a parent to
+ // redraw, since it is responsible for redrawing the
+ // background...
+ int X = x() > 0 ? x() - 1 : 0;
+ int Y = y() > 0 ? y() - 1 : 0;
+ window()->damage(FL_DAMAGE_ALL, X, Y, w() + 2, h() + 2);
+ }
+ else damage(FL_DAMAGE_ALL);
+
+ if (window() && align() && !(align() & FL_ALIGN_INSIDE)) {
+ // If the label is not inside the widget, compute the location of
+ // the label and redraw the window within that bounding box...
+ int W = 0, H = 0;
+ label_.measure(W, H);
+
+ if (align() & FL_ALIGN_BOTTOM) {
+ window()->damage(FL_DAMAGE_ALL, x(), y() + h(), w(), H);
+ } else if (align() & FL_ALIGN_TOP) {
+ window()->damage(FL_DAMAGE_ALL, x(), y() - H, w(), H);
+ } else if (align() & FL_ALIGN_LEFT) {
+ window()->damage(FL_DAMAGE_ALL, x() - W, y(), W, h());
+ } else if (align() & FL_ALIGN_RIGHT) {
+ window()->damage(FL_DAMAGE_ALL, x() + w(), y(), W, h());
+ }
+ }
+}
void Fl_Widget::damage(uchar flags) {
if (type() < FL_WINDOW) {
@@ -901,5 +928,5 @@ void Fl_Window::flush() {
}
//
-// End of "$Id: Fl.cxx,v 1.24.2.41.2.33 2002/05/23 16:47:41 easysw Exp $".
+// End of "$Id: Fl.cxx,v 1.24.2.41.2.34 2002/06/02 17:52:36 easysw Exp $".
//
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx
index 9300765c3..9f2a80f59 100644
--- a/src/Fl_Button.cxx
+++ b/src/Fl_Button.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Button.cxx,v 1.4.2.6.2.14 2002/05/17 11:31:09 easysw Exp $"
+// "$Id: Fl_Button.cxx,v 1.4.2.6.2.15 2002/06/02 17:52:36 easysw Exp $"
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
@@ -36,8 +36,13 @@ int Fl_Button::value(int v) {
v = v ? 1 : 0;
oldval = v;
clear_changed();
- if (value_ != v) {value_ = v; redraw(); return 1;}
- else return 0;
+ if (value_ != v) {
+ value_ = v;
+ redraw();
+ return 1;
+ } else {
+ return 0;
+ }
}
void Fl_Button::setonly() { // set this radio button on, turn others off
@@ -58,6 +63,7 @@ void Fl_Button::draw() {
draw_label();
if (Fl::focus() == this) draw_focus();
}
+
int Fl_Button::handle(int event) {
int newval;
switch (event) {
@@ -109,15 +115,7 @@ int Fl_Button::handle(int event) {
case FL_FOCUS :
case FL_UNFOCUS :
if (Fl::visible_focus()) {
- if (event == FL_UNFOCUS && box() == FL_NO_BOX) {
- // Buttons with the FL_NO_BOX boxtype need a parent to
- // redraw, since it is responsible for redrawing the
- // background...
- int X = x() > 0 ? x() - 1 : 0;
- int Y = y() > 0 ? y() - 1 : 0;
- window()->damage(FL_DAMAGE_EXPOSE, X, Y, w() + 2, h() + 2);
- }
- else redraw();
+ redraw();
return 1;
} else return 0;
case FL_KEYBOARD :
@@ -147,5 +145,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l)
}
//
-// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.14 2002/05/17 11:31:09 easysw Exp $".
+// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.15 2002/06/02 17:52:36 easysw Exp $".
//
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 8766a05c4..d904e87d2 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.17 2002/05/24 14:19:19 easysw Exp $"
+// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.18 2002/06/02 17:52:36 easysw Exp $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
@@ -176,20 +176,11 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
}
-// redraw this, plus redraw opaque object if there is an outside label
-static void redraw_label(Fl_Widget* w) {
- w->redraw();
- if (w->label() && (w->align()&15) && !(w->align() & FL_ALIGN_INSIDE)) {
- for (Fl_Widget *p = w->parent(); p; p = p->parent())
- if (p->box() || !p->parent()) {p->redraw(); break;}
- }
-}
-
void Fl_Widget::activate() {
if (!active()) {
clear_flag(INACTIVE);
if (active_r()) {
- redraw_label(this);
+ redraw();
handle(FL_ACTIVATE);
if (inside(Fl::focus())) Fl::focus()->take_focus();
}
@@ -199,7 +190,7 @@ void Fl_Widget::activate() {
void Fl_Widget::deactivate() {
if (active_r()) {
set_flag(INACTIVE);
- redraw_label(this);
+ redraw();
handle(FL_DEACTIVATE);
fl_throw_focus(this);
} else {
@@ -217,7 +208,7 @@ void Fl_Widget::show() {
if (!visible()) {
clear_flag(INVISIBLE);
if (visible_r()) {
- redraw_label(this);
+ redraw();
handle(FL_SHOW);
if (inside(Fl::focus())) Fl::focus()->take_focus();
}
@@ -250,5 +241,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
}
//
-// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.17 2002/05/24 14:19:19 easysw Exp $".
+// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.18 2002/06/02 17:52:36 easysw Exp $".
//