Some widgets reordered for consistent keyboard navigation in tree test program.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2010-10-31 16:54:00 +00:00
parent 8ad7e5ccc0
commit 5a461b0ff4
1 changed files with 53 additions and 53 deletions

View File

@ -30,7 +30,7 @@ decl {\#include <FL/Fl_Preferences.H>} {public global
}
decl {int G_cb_counter = 0;} {
comment {// Global callback event counter} private local
comment {// Global callback event counter}
}
Function {reason_as_name(Fl_Tree_Reason reason)} {open return_type {const char*}
@ -587,6 +587,20 @@ tree->redraw();}
tree->redraw();}
tooltip {Deselects all items in the tree} xywh {260 559 75 16} labelsize 9
}
Fl_Light_Button bbbselect_toggle {
label { Select Bbb}
callback {// Toggle select of just the Bbb item (not children)
Fl_Tree_Item *bbb = tree->find_item("/Bbb");
if ( !bbb) {
fl_alert("FAIL: Couldn't find item '/Bbb'???");
return;
}
int onoff = bbbselect_toggle->value();
if ( onoff ) tree->select(bbb); // select /Bbb
else tree->deselect(bbb); // deselect /Bbb}
tooltip {Toggle selection of just the /Bbb item
(Not children)} xywh {350 540 95 15} selection_color 1 labelsize 9
}
Fl_Light_Button bbbselect2_toggle {
label { Select Bbb+}
callback {// Toggle select of just the Bbb item and its immediate children
@ -608,16 +622,31 @@ if ( onoff ) tree->select("/Bbb/child-02");
else tree->deselect("/Bbb/child-02");}
tooltip {Toggle the single item /Bbb/child-02} xywh {350 579 95 16} selection_color 1 labelsize 9
}
Fl_Button loaddb_button {
label {Load Database...}
callback {const char *filename = fl_file_chooser("Select a Preferences style Database", "Preferences(*.prefs)", 0L);
if (filename) {
tree->clear();
Fl_Preferences prefs(filename, 0L, 0L);
tree->load(prefs);
tree->redraw();
}}
tooltip {Load the contents of an Fl_Preferences database into the tree view} xywh {380 614 90 16} labelsize 9
Fl_Light_Button rootselect_toggle {
label {Select ROOT}
callback {// Toggle select of ROOT item and its children
Fl_Tree_Item *item = tree->find_item("/ROOT");
if ( !item) {
fl_alert("FAIL: Couldn't find item '/ROOT'???");
return;
}
int onoff = rootselect_toggle->value();
if ( onoff ) tree->select(item); // select /ROOT and its children
else tree->deselect(item); // deselect /ROOT and its children}
tooltip {Toggle selection of the ROOT item} xywh {460 540 90 15} selection_color 1 labelsize 9
}
Fl_Light_Button rootselect2_toggle {
label {Select ROOT+}
callback {// Toggle select of ROOT item and its children
Fl_Tree_Item *item = tree->find_item("/ROOT");
if ( !item) {
fl_alert("FAIL: Couldn't find item '/ROOT'???");
return;
}
int onoff = rootselect2_toggle->value();
if ( onoff ) tree->select_all(item); // select /ROOT and its children
else tree->deselect_all(item); // deselect /ROOT and its children}
tooltip {Toggle selection of the ROOT item and all children} xywh {460 560 90 15} selection_color 1 labelsize 9
}
Fl_Light_Button deactivate_toggle {
label { Deactivate}
@ -665,6 +694,17 @@ tree->redraw();}
tooltip {Toggles bold font for selected items
If nothing selected, all are changed} xywh {280 654 90 16} selection_color 1 labelsize 9
}
Fl_Button loaddb_button {
label {Load Database...}
callback {const char *filename = fl_file_chooser("Select a Preferences style Database", "Preferences(*.prefs)", 0L);
if (filename) {
tree->clear();
Fl_Preferences prefs(filename, 0L, 0L);
tree->load(prefs);
tree->redraw();
}}
tooltip {Load the contents of an Fl_Preferences database into the tree view} xywh {380 614 90 16} labelsize 9
}
Fl_Button insertabove_button {
label {Insert Above}
callback {Fl_Tree_Item *item=tree->first();
@ -695,7 +735,7 @@ switch ( tree->item_pathname(pathname, sizeof(pathname), item) ) {
case 0: fl_message("Pathname for '%s' is: \\"%s\\"", (item->label() ? item->label() : "???"), pathname); break;
case -1: fl_message("item_pathname() returned -1 (NOT FOUND)"); break;
case -2: fl_message("item_pathname() returned -2 (STRING TOO LONG)"); break;
}} selected
}}
tooltip {Show the pathname for the selected item. Tests the Fl_Tree::item_pathname() method.} xywh {380 674 90 16} labelsize 8
}
Fl_Button showselected_button {
@ -791,49 +831,9 @@ G_cb_counter = 0; tree->deselect("ROOT"); if ( !G_cb_counter ) fl_alert("FAIL
G_cb_counter = 0; tree->select("ROOT"); if ( !G_cb_counter ) fl_alert("FAILED 'DEFAULT' TEST\\n select(path) cb wasn't triggered!");
tree->deselect("ROOT"); // leave deselected
fl_alert("TEST COMPLETED\\n If you didn't see any error dialogs, test PASSED.");}
fl_alert("TEST COMPLETED\\n If you didn't see any error dialogs, test PASSED.");} selected
tooltip {Test the 'docallback' argument can disable callbacks.} xywh {475 674 90 16} labelsize 8
}
Fl_Light_Button rootselect_toggle {
label {Select ROOT}
callback {// Toggle select of ROOT item and its children
Fl_Tree_Item *item = tree->find_item("/ROOT");
if ( !item) {
fl_alert("FAIL: Couldn't find item '/ROOT'???");
return;
}
int onoff = rootselect_toggle->value();
if ( onoff ) tree->select(item); // select /ROOT and its children
else tree->deselect(item); // deselect /ROOT and its children}
tooltip {Toggle selection of the ROOT item} xywh {460 540 90 15} selection_color 1 labelsize 9
}
Fl_Light_Button bbbselect_toggle {
label { Select Bbb}
callback {// Toggle select of just the Bbb item (not children)
Fl_Tree_Item *bbb = tree->find_item("/Bbb");
if ( !bbb) {
fl_alert("FAIL: Couldn't find item '/Bbb'???");
return;
}
int onoff = bbbselect_toggle->value();
if ( onoff ) tree->select(bbb); // select /Bbb
else tree->deselect(bbb); // deselect /Bbb}
tooltip {Toggle selection of just the /Bbb item
(Not children)} xywh {350 540 95 15} selection_color 1 labelsize 9
}
Fl_Light_Button rootselect2_toggle {
label {Select ROOT+}
callback {// Toggle select of ROOT item and its children
Fl_Tree_Item *item = tree->find_item("/ROOT");
if ( !item) {
fl_alert("FAIL: Couldn't find item '/ROOT'???");
return;
}
int onoff = rootselect2_toggle->value();
if ( onoff ) tree->select_all(item); // select /ROOT and its children
else tree->deselect_all(item); // deselect /ROOT and its children}
tooltip {Toggle selection of the ROOT item and all children} xywh {460 560 90 15} selection_color 1 labelsize 9
}
}
code {// Initialize Tree
tree->root_label("ROOT");