mirror of https://github.com/fltk/fltk
STR #1652: allowing shortcuts in tabs
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5791 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
08d55b7bf2
commit
488f27d1eb
1
CHANGES
1
CHANGES
|
@ -3,6 +3,7 @@ CHANGES IN FLTK 1.1.8
|
|||
- Documentation fixes (STR #1454, STR #1455, STR #1456,
|
||||
STR #1457, STR #1458, STR #1460, STR #1481, STR #1578,
|
||||
STR #1639, STR #1645, STR #1644)
|
||||
- Allowing shortcuts in Tabs (STR #1652)
|
||||
- Fixed Makefile "make clean" (STR #1642, STR #1643)
|
||||
- The sample RPM spec file now enables large file support
|
||||
and threading support (STR #1603)
|
||||
|
|
|
@ -50,6 +50,9 @@ int Fl_Tabs::tab_positions(int* p, int* wp) {
|
|||
int selected = 0;
|
||||
Fl_Widget*const* a = array();
|
||||
int i;
|
||||
char prev_draw_shortcut = fl_draw_shortcut;
|
||||
fl_draw_shortcut = 1;
|
||||
|
||||
p[0] = Fl::box_dx(box());
|
||||
for (i=0; i<children(); i++) {
|
||||
Fl_Widget* o = *a++;
|
||||
|
@ -61,6 +64,8 @@ int Fl_Tabs::tab_positions(int* p, int* wp) {
|
|||
wp[i] = wt+EXTRASPACE;
|
||||
p[i+1] = p[i]+wp[i]+BORDER;
|
||||
}
|
||||
fl_draw_shortcut = prev_draw_shortcut;
|
||||
|
||||
int r = w();
|
||||
if (p[i] <= r) return selected;
|
||||
// uh oh, they are too big:
|
||||
|
@ -214,6 +219,19 @@ int Fl_Tabs::handle(int event) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return Fl_Group::handle(event);
|
||||
case FL_SHORTCUT:
|
||||
for (i = 0; i < children(); ++i) {
|
||||
Fl_Widget *c = child(i);
|
||||
if (c->test_shortcut(c->label())) {
|
||||
char sc = !c->visible();
|
||||
value(c);
|
||||
if (sc) set_changed();
|
||||
do_callback();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return Fl_Group::handle(event);
|
||||
case FL_SHOW:
|
||||
value(); // update visibilities and fall through
|
||||
default:
|
||||
|
@ -309,6 +327,9 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
|
|||
int sel = (what == SELECTED);
|
||||
int dh = Fl::box_dh(box());
|
||||
int dy = Fl::box_dy(box());
|
||||
char prev_draw_shortcut = fl_draw_shortcut;
|
||||
fl_draw_shortcut = 1;
|
||||
|
||||
Fl_Boxtype bt = (o==push_ &&!sel) ? fl_down(box()) : box();
|
||||
|
||||
// compute offsets to make selected tab look bigger
|
||||
|
@ -367,6 +388,7 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
|
|||
|
||||
fl_pop_clip();
|
||||
}
|
||||
fl_draw_shortcut = prev_draw_shortcut;
|
||||
}
|
||||
|
||||
Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
|
||||
|
|
22
test/tabs.fl
22
test/tabs.fl
|
@ -10,13 +10,13 @@ Function {} {open
|
|||
} {
|
||||
Fl_Box {} {
|
||||
label {class Fl_Tabs}
|
||||
xywh {95 5 130 30} labeltype ENGRAVED_LABEL labelfont 1
|
||||
xywh {95 0 130 35} labeltype ENGRAVED_LABEL labelfont 1
|
||||
}
|
||||
Fl_Tabs {} {
|
||||
tooltip {the various index cards test different aspects of the Fl_Tabs widget} xywh {10 40 300 200} selection_color 4 labelcolor 7 resizable
|
||||
tooltip {the various index cards test different aspects of the Fl_Tabs widget} xywh {10 35 300 205} selection_color 4 labelcolor 7 resizable
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label Label1 open
|
||||
label {Label&1} open selected
|
||||
tooltip {this Tab tests correct keyboard navigation between text input fields} xywh {10 60 300 180} selection_color 1 resizable
|
||||
} {
|
||||
Fl_Input {} {
|
||||
|
@ -34,7 +34,7 @@ Function {} {open
|
|||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label tab2 open
|
||||
label {tab&2} open
|
||||
tooltip {tab2 tests among other things the cooperation of modal windows and tabs} xywh {10 60 300 180} selection_color 2 hide
|
||||
} {
|
||||
Fl_Button {} {
|
||||
|
@ -60,7 +60,7 @@ Function {} {open
|
|||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label tab3 open
|
||||
label {tab&3} open
|
||||
tooltip {tab3 checks for correct keyboard navigation} xywh {10 60 300 180} selection_color 3 hide
|
||||
} {
|
||||
Fl_Button {} {
|
||||
|
@ -77,8 +77,8 @@ Function {} {open
|
|||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label tab4 open
|
||||
tooltip {this tab show the issue of indicating a selcted tab if the tab layouts are very similar} xywh {10 60 300 180} selection_color 5 labelfont 2 hide
|
||||
label {&tab4} open
|
||||
tooltip {this tab show the issue of indicating a selcted tab if the tab layouts are very similar} xywh {10 60 300 180} selection_color 5 labeltype ENGRAVED_LABEL labelfont 2 hide
|
||||
} {
|
||||
Fl_Button {} {
|
||||
label button2
|
||||
|
@ -94,8 +94,8 @@ Function {} {open
|
|||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label { tab5 } open
|
||||
tooltip {tab5 verifies if visibility requests are handled correctly} xywh {10 60 300 180} labeltype ENGRAVED_LABEL hide
|
||||
label {@fileprint &print} open
|
||||
tooltip {tab5 verifies if visibility requests are handled correctly} xywh {10 60 300 180} hide
|
||||
} {
|
||||
Fl_Button {} {
|
||||
label button2
|
||||
|
@ -126,7 +126,7 @@ Function {} {open
|
|||
}
|
||||
Fl_Box {} {
|
||||
label {class Fl_Wizard}
|
||||
xywh {410 5 130 30} labeltype ENGRAVED_LABEL labelfont 1
|
||||
xywh {410 0 130 35} labeltype ENGRAVED_LABEL labelfont 1
|
||||
}
|
||||
Fl_Wizard wWizard {
|
||||
xywh {325 60 300 180}
|
||||
|
@ -250,7 +250,7 @@ Function {} {open
|
|||
}
|
||||
Fl_Button {} {
|
||||
label {@<}
|
||||
callback {wWizard->prev();} selected
|
||||
callback {wWizard->prev();}
|
||||
tooltip {go to previous page [left arrow]} xywh {440 245 30 25} shortcut 0xff51
|
||||
}
|
||||
Fl_Button {} {
|
||||
|
|
Loading…
Reference in New Issue