Tab, space, backtab, and backspace can be used to navigate through menus.
They act like up/down arrows except they circulate around at the end. Fixed a typo in fluid that made it not write when() correctly. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@559 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e46a0be2b5
commit
5bf457ac24
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.3 1999/04/18 19:17:00 mike Exp $"
|
||||
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.4 1999/04/26 06:45:25 bill Exp $"
|
||||
//
|
||||
// Widget type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -1421,7 +1421,7 @@ void Fl_Widget_Type::write_widget_code() {
|
||||
write_c(");\n");
|
||||
}
|
||||
if (o->when() != tplate->when())
|
||||
write_c("%so->when(%d);\n", indent(),item_name(whensymbolmenu, o->when()));
|
||||
write_c("%so->when(%s);\n", indent(),item_name(whensymbolmenu, o->when()));
|
||||
if (!o->visible() && o->parent())
|
||||
write_c("%so->hide();\n", indent());
|
||||
if (!o->active())
|
||||
@ -1750,5 +1750,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.3 1999/04/18 19:17:00 mike Exp $".
|
||||
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.4 1999/04/26 06:45:25 bill Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu.cxx,v 1.18 1999/03/07 08:51:43 bill Exp $"
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.1 1999/04/26 06:45:27 bill Exp $"
|
||||
//
|
||||
// Menu code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -412,7 +412,7 @@ const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
|
||||
struct menustate {
|
||||
const Fl_Menu_Item* current_item; // what mouse is pointing at
|
||||
int menu_number; // which menu it is in
|
||||
int item_number; // which item in that menu
|
||||
int item_number; // which item in that menu, -1 if none
|
||||
menuwindow* p[20]; // pointers to menus
|
||||
int nummenus;
|
||||
int menubar; // if true p[0] is a menubar
|
||||
@ -428,8 +428,7 @@ static inline void setitem(const Fl_Menu_Item* i, int m, int n) {
|
||||
|
||||
static void setitem(int m, int n) {
|
||||
menustate &p = *(::p);
|
||||
p.current_item = (m >= 0 && n >= 0) ?
|
||||
p.current_item = p.p[m]->menu->next(n) : 0;
|
||||
p.current_item = (n >= 0) ? p.p[m]->menu->next(n) : 0;
|
||||
p.menu_number = m;
|
||||
p.item_number = n;
|
||||
}
|
||||
@ -449,6 +448,7 @@ static int backward(int menu) { // previous item in menu menu if possible
|
||||
menustate &p = *(::p);
|
||||
menuwindow &m = *(p.p[menu]);
|
||||
int item = (menu == p.menu_number) ? p.item_number : m.selected;
|
||||
if (item < 0) item = m.numitems;
|
||||
while (--item >= 0) {
|
||||
const Fl_Menu_Item* m1 = m.menu->next(item);
|
||||
if (m1->activevisible()) {setitem(m1, menu, item); return 1;}
|
||||
@ -461,15 +461,23 @@ int menuwindow::handle(int e) {
|
||||
switch (e) {
|
||||
case FL_KEYBOARD:
|
||||
switch (Fl::event_key()) {
|
||||
case FL_Tab:
|
||||
if (Fl::event_shift()&FL_SHIFT) goto BACKTAB;
|
||||
case ' ':
|
||||
if (!forward(p.menu_number)) {p.item_number = -1; forward(p.menu_number);}
|
||||
return 1;
|
||||
case FL_BackSpace:
|
||||
case 0xFE20: // backtab
|
||||
BACKTAB:
|
||||
if (!backward(p.menu_number)) {p.item_number = -1;backward(p.menu_number);}
|
||||
return 1;
|
||||
case FL_Up:
|
||||
if (p.menu_number < 0) setitem(0, 0);
|
||||
if (p.menubar && p.menu_number == 0) ;
|
||||
else if (backward(p.menu_number));
|
||||
else if (p.menubar && p.menu_number==1) setitem(0, p.p[0]->selected);
|
||||
return 1;
|
||||
case FL_Down:
|
||||
if (p.menu_number < 0) setitem(0, 0);
|
||||
else if (p.menu_number || !p.menubar) forward(p.menu_number);
|
||||
if (p.menu_number || !p.menubar) forward(p.menu_number);
|
||||
else if (p.menu_number < p.nummenus-1) forward(p.menu_number+1);
|
||||
return 1;
|
||||
case FL_Right:
|
||||
@ -507,9 +515,10 @@ int menuwindow::handle(int e) {
|
||||
int mx = Fl::event_x_root();
|
||||
int my = Fl::event_y_root();
|
||||
int item=0; int menu;
|
||||
for (menu = p.nummenus-1; menu >= 0; menu--) {
|
||||
for (menu = p.nummenus-1; ; menu--) {
|
||||
item = p.p[menu]->find_selected(mx, my);
|
||||
if (item >= 0) break;
|
||||
if (menu <= 0) break;
|
||||
}
|
||||
setitem(menu, item);
|
||||
if (e == FL_PUSH) {
|
||||
@ -568,7 +577,7 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
|
||||
goto STARTUP;
|
||||
}
|
||||
|
||||
p.current_item = 0; p.menu_number = -1; p.item_number = -1;
|
||||
p.current_item = 0; p.menu_number = 0; p.item_number = -1;
|
||||
if (menubar) mw.handle(FL_DRAG); // find the initial menu
|
||||
initial_item = p.current_item;
|
||||
if (initial_item) goto STARTUP;
|
||||
@ -710,5 +719,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18 1999/03/07 08:51:43 bill Exp $".
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.1 1999/04/26 06:45:27 bill Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: browser.cxx,v 1.5 1999/01/07 19:17:49 mike Exp $"
|
||||
// "$Id: browser.cxx,v 1.5.2.1 1999/04/26 06:45:28 bill Exp $"
|
||||
//
|
||||
// Browser test program for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -80,6 +80,7 @@ int main(int argc, char **argv) {
|
||||
window.box(FL_NO_BOX); // because it is filled with browser
|
||||
Fl_Select_Browser browser(0,0,400,400,0);
|
||||
browser.type(FL_MULTI_BROWSER);
|
||||
//browser.color(42);
|
||||
browser.callback(b_cb);
|
||||
// browser.scrollbar_right();
|
||||
//browser.has_scrollbar(Fl_Browser::BOTH_ALWAYS);
|
||||
@ -94,6 +95,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: browser.cxx,v 1.5 1999/01/07 19:17:49 mike Exp $".
|
||||
// End of "$Id: browser.cxx,v 1.5.2.1 1999/04/26 06:45:28 bill Exp $".
|
||||
//
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: menubar.cxx,v 1.6 1999/02/25 19:09:11 bill Exp $"
|
||||
// "$Id: menubar.cxx,v 1.6.2.1 1999/04/26 06:45:29 bill Exp $"
|
||||
//
|
||||
// Menubar test program for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -98,7 +98,7 @@ Fl_Menu_Item menutable[] = {
|
||||
{"Size", 0, 0},
|
||||
{0},
|
||||
{"&Checkbox",0,0,0,FL_SUBMENU},
|
||||
{"&Alpha", 0, 0, (void *)1, FL_MENU_TOGGLE},
|
||||
{"&Alpha", FL_F+2, 0, (void *)1, FL_MENU_TOGGLE},
|
||||
{"&Beta", 0, 0, (void *)2, FL_MENU_TOGGLE},
|
||||
{"&Gamma", 0, 0, (void *)3, FL_MENU_TOGGLE},
|
||||
{"&Delta", 0, 0, (void *)4, FL_MENU_TOGGLE|FL_MENU_VALUE},
|
||||
@ -214,5 +214,5 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: menubar.cxx,v 1.6 1999/02/25 19:09:11 bill Exp $".
|
||||
// End of "$Id: menubar.cxx,v 1.6.2.1 1999/04/26 06:45:29 bill Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user