summaryrefslogtreecommitdiff
path: root/src/Fl_Tabs.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2006-05-30 09:38:19 +0000
committerMatthias Melcher <fltk@matthiasm.com>2006-05-30 09:38:19 +0000
commit987d9e05f2c502138ecf648d76c02886f0534740 (patch)
tree59797bc5c3224a1802492e8ceaaa60971c8f8659 /src/Fl_Tabs.cxx
parent6986a1d0083c106c11095e250d46dbd2dacfa857 (diff)
Fixed shortcut and default focus for message dialogs (STR #1298).
Default focus is now on the button that also reacts to the 'Enter' key. This should avoid confusion about Enter triggering the button1 or button 0. Also, I changed the shortcut call to the new convention which works on MSWindows. I don't have a Linux system right now for testing... . Fixed focus issues (STR #1286, STR #1289, STR #1296) fl_xfocus was not always updated, making widgets or even whole windows loose focus when any focus changes were not accompanied by a click into the same window. Also, Fl_Tabs would not redraw correctly if focus returned to the active tab. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5165 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Tabs.cxx')
-rw-r--r--src/Fl_Tabs.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index 37fcdf7ab..02bac39a1 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -119,6 +119,18 @@ Fl_Widget *Fl_Tabs::which(int event_x, int event_y) {
return 0;
}
+void Fl_Tabs::redraw_tabs()
+{
+ int H = tab_height();
+ if (H >= 0) {
+ H += Fl::box_dy(box());
+ damage(FL_DAMAGE_SCROLL, x(), y(), w(), H);
+ } else {
+ H = Fl::box_dy(box()) - H;
+ damage(FL_DAMAGE_SCROLL, x(), y() + h() - H, w(), H);
+ }
+}
+
int Fl_Tabs::handle(int event) {
Fl_Widget *o;
@@ -138,12 +150,15 @@ int Fl_Tabs::handle(int event) {
o = which(Fl::event_x(), Fl::event_y());
if (event == FL_RELEASE) {
push(0);
+ if (o && Fl::visible_focus() && Fl::focus()!=this) {
+ Fl::focus(this);
+ redraw_tabs();
+ }
if (o && value(o)) {
set_changed();
do_callback();
}
} else push(o);
- if (Fl::visible_focus() && event == FL_RELEASE) Fl::focus(this);
return 1;
case FL_MOVE: {
int ret = Fl_Group::handle(event);
@@ -168,14 +183,7 @@ int Fl_Tabs::handle(int event) {
Fl::event() == FL_KEYBOARD ||
Fl::event() == FL_FOCUS ||
Fl::event() == FL_UNFOCUS) {
- int H = tab_height();
- if (H >= 0) {
- H += Fl::box_dy(box());
- damage(FL_DAMAGE_SCROLL, x(), y(), w(), H);
- } else {
- H = Fl::box_dy(box()) - H;
- damage(FL_DAMAGE_SCROLL, x(), y() + h() - H, w(), H);
- }
+ redraw_tabs();
if (Fl::event() == FL_FOCUS || Fl::event() == FL_UNFOCUS) return 0;
else return 1;
} else return Fl_Group::handle(event);