summaryrefslogtreecommitdiff
path: root/src/Fl_Widget.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-12-15 15:35:19 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-12-15 15:35:19 +0000
commit136a36405440372a1e09c5ce239e8583c34d93f3 (patch)
tree3c115d763590a1d8b046400a25a30879054164a5 /src/Fl_Widget.cxx
parent4f9aa69ea4c1c63c28e468b53457bb60a198805a (diff)
Focus fixes from Bill.
git-svn-id: file:///fltk/svn/fltk/trunk@159 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Widget.cxx')
-rw-r--r--src/Fl_Widget.cxx58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 434a469e6..04dc90b2e 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Widget.cxx,v 1.3 1998/10/21 14:20:26 mike Exp $"
+// "$Id: Fl_Widget.cxx,v 1.4 1998/12/15 15:35:19 mike Exp $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
@@ -132,19 +132,25 @@ static void redraw_label(Fl_Widget* w) {
}
void Fl_Widget::activate() {
- if (active()) return;
- clear_flag(INACTIVE);
- handle(FL_ACTIVATE);
- if (inside(Fl::focus())) Fl::focus()->take_focus();
- redraw_label(this);
+ if (!active()) {
+ clear_flag(INACTIVE);
+ if (active_r()) {
+ redraw_label(this);
+ handle(FL_ACTIVATE);
+ if (inside(Fl::focus())) Fl::focus()->take_focus();
+ }
+ }
}
void Fl_Widget::deactivate() {
- if (!active()) return;
- set_flag(INACTIVE);
- handle(FL_DEACTIVATE);
- fl_throw_focus(this);
- redraw_label(this);
+ if (active_r()) {
+ set_flag(INACTIVE);
+ redraw_label(this);
+ handle(FL_DEACTIVATE);
+ fl_throw_focus(this);
+ } else {
+ set_flag(INACTIVE);
+ }
}
int Fl_Widget::active_r() const {
@@ -154,20 +160,26 @@ int Fl_Widget::active_r() const {
}
void Fl_Widget::show() {
- if (visible()) return;
- clear_flag(INVISIBLE);
- handle(FL_SHOW);
- if (inside(Fl::focus())) Fl::focus()->take_focus();
- redraw_label(this);
+ if (!visible()) {
+ clear_flag(INVISIBLE);
+ if (visible_r()) {
+ redraw_label(this);
+ handle(FL_SHOW);
+ if (inside(Fl::focus())) Fl::focus()->take_focus();
+ }
+ }
}
void Fl_Widget::hide() {
- if (!visible()) return;
- set_flag(INVISIBLE);
- handle(FL_HIDE);
- fl_throw_focus(this);
- for (Fl_Widget *p = parent(); p; p = p->parent())
- if (p->box() || !p->parent()) {p->redraw(); break;}
+ if (visible_r()) {
+ set_flag(INVISIBLE);
+ for (Fl_Widget *p = parent(); p; p = p->parent())
+ if (p->box() || !p->parent()) {p->redraw(); break;}
+ handle(FL_HIDE);
+ fl_throw_focus(this);
+ } else {
+ set_flag(INVISIBLE);
+ }
}
int Fl_Widget::visible_r() const {
@@ -184,5 +196,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
}
//
-// End of "$Id: Fl_Widget.cxx,v 1.3 1998/10/21 14:20:26 mike Exp $".
+// End of "$Id: Fl_Widget.cxx,v 1.4 1998/12/15 15:35:19 mike Exp $".
//