Forgot tree.fl (should have been in r9377)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9379 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2012-04-22 13:55:17 +00:00
parent f58cd169c0
commit 67ea785bfd

View File

@ -214,11 +214,33 @@ fl_color_chooser("Choose Color",r,g,b);
return(fl_rgb_color(r,g,b));} {}
}
Function {GetTreeMarginBottom()} {
comment {Get the current 'margin bottom' size
Handles this as an ABI feature..} open return_type int
} {
code {\#if FLTK_ABI_VERSION >= 10302
return tree->marginbottom();
\#else
return 0;
\#endif} {}
}
Function {GetTreeWidgetMarginLeft()} {
comment {Get the current 'margin bottom' size
Handles this as an ABI feature..} open return_type int
} {
code {\#if FLTK_ABI_VERSION >= 10302
return tree->widgetmarginleft();
\#else
return 0;
\#endif} {}
}
Function {} {open
} {
Fl_Window window {
label tree open
xywh {709 21 1015 465} type Double visible
xywh {710 21 1015 590} type Double visible
} {
Fl_Group tree {
label Tree
@ -245,16 +267,16 @@ if ( item ) {
tree->changed() ? 1 : 0);
}
tree->clear_changed();} open
tooltip {Test tree} xywh {15 22 280 424} box DOWN_BOX color 55 selection_color 15
tooltip {Test tree} xywh {15 22 285 553} box DOWN_BOX color 55 selection_color 15
class Fl_Tree
} {}
Fl_Group {} {open
xywh {300 5 705 440}
xywh {300 5 705 590}
code0 {o->resizable(0);}
} {
Fl_Box {} {
label {Tree Globals}
tooltip {These controls only affect the selected items. If no items are selected, all existing items in tree are modified.} xywh {311 23 334 280} box GTK_DOWN_BOX color 47 labelsize 12 align 1
tooltip {These controls only affect the selected items. If no items are selected, all existing items in tree are modified.} xywh {315 23 330 410} box GTK_DOWN_BOX color 47 labelsize 12 align 1
}
Fl_Value_Slider margintop_slider {
label {margintop()}
@ -262,11 +284,10 @@ tree->clear_changed();} open
callback {int val = (int)margintop_slider->value();
tree->margintop(val);
tree->redraw();}
tooltip {Changes the top margin for the tree widget} xywh {486 31 140 16} type Horizontal labelsize 12 align 4 textsize 12
tooltip {Changes the top margin for the tree widget} xywh {470 31 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->margintop());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
code3 {o->color(46); o->selection_color(FL_RED);}
}
Fl_Value_Slider marginleft_slider {
label {marginleft()}
@ -274,11 +295,84 @@ tree->redraw();}
callback {int val = (int)marginleft_slider->value();
tree->marginleft(val);
tree->redraw();}
tooltip {Changes the left margin for the tree widget} xywh {486 51 140 16} type Horizontal labelsize 12 align 4 textsize 12
tooltip {Changes the left margin for the tree widget} xywh {470 51 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->marginleft());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
code3 {o->color(46); o->selection_color(FL_RED);}
}
Fl_Value_Slider marginbottom_slider {
label {marginbottom()}
user_data tree
callback {\#if FLTK_ABI_VERSION >= 10302
// NEW
int val = (int)marginbottom_slider->value();
tree->marginbottom(val);
tree->redraw();
\#else
// OLD
marginbottom_slider->deactivate(); // deactivate if this ABI feature is disabled
marginbottom_slider->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10302 (or higher)\\n"
"to get this feature");
\#endif}
tooltip {Changes the bottom margin for the tree
Sets how far beyond bottom of tree you can scroll} xywh {470 71 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(GetTreeMarginBottom()); // handle ABI feature}
code1 {o->range(0.0, 275.0);}
code2 {o->step(1.0);}
code3 {o->do_callback();}
}
Fl_Value_Slider linespacing_slider {
label {linespacing()}
user_data tree
callback {int val = (int)linespacing_slider->value();
tree->linespacing(val);
tree->redraw();}
tooltip {Changes the spacing between items in the tree} xywh {470 91 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->linespacing());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
}
Fl_Value_Slider usericonmarginleft_slider {
label {usericonmarginleft()}
user_data tree
callback {int val = (int)usericonmarginleft_slider->value();
tree->usericonmarginleft(val);
tree->redraw();}
tooltip {Changes the left margin for the user icons (if any)} xywh {470 111 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->usericonmarginleft());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
}
Fl_Value_Slider labelmarginleft_slider {
label {labelmarginleft()}
user_data tree
callback {int val = (int)labelmarginleft_slider->value();
tree->labelmarginleft(val);
tree->redraw();}
tooltip {Changes the left margin for the item label} xywh {470 131 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->labelmarginleft());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
}
Fl_Value_Slider widgetmarginleft_slider {
label {widgetmarginleft()}
user_data tree
callback {\#if FLTK_ABI_VERSION >= 10302
int val = (int)widgetmarginleft_slider->value();
tree->widgetmarginleft(val);
tree->redraw();
\#else
widgetmarginleft_slider->deactivate();
widgetmarginleft_slider->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10302 (or higher)\\n"
"to get this feature");
\#endif}
tooltip {Changes the margin to the left of child FLTK widget()} xywh {470 151 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(GetTreeWidgetMarginLeft()); // handle ABI feature}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
code3 {o->do_callback();}
}
Fl_Value_Slider openchild_marginbottom_slider {
label {openchild_marginbottom()}
@ -286,11 +380,10 @@ tree->redraw();}
callback {int val = (int)openchild_marginbottom_slider->value();
tree->openchild_marginbottom(val);
tree->redraw();}
tooltip {Changes the vertical space below an open child tree} xywh {486 71 140 16} type Horizontal labelsize 12 align 4 textsize 12
tooltip {Changes the vertical space below an open child tree} xywh {470 171 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(tree->openchild_marginbottom());}
code1 {o->range(0.0, 100.0);}
code2 {o->step(1.0);}
code3 {o->color(46); o->selection_color(FL_RED);}
}
Fl_Choice collapseicons_chooser {
label {Collapse icons}
@ -380,8 +473,8 @@ switch ( collapseicons_chooser->value() ) {
case 2:
tree->showcollapse(0);
break;
}}
tooltip {Tests Fl_Tree::openicon() and Fl_Tree::closeicon()} xywh {486 96 140 21} down_box BORDER_BOX labelsize 12 textsize 11
}} selected
tooltip {Tests Fl_Tree::openicon() and Fl_Tree::closeicon()} xywh {485 201 140 21} down_box BORDER_BOX labelsize 12 textsize 11
} {
MenuItem {} {
label Normal
@ -403,8 +496,8 @@ switch ( connectorstyle_chooser->value() ) {
case 0: tree->connectorstyle(FL_TREE_CONNECTOR_NONE); break;
case 1: tree->connectorstyle(FL_TREE_CONNECTOR_DOTTED); break;
case 2: tree->connectorstyle(FL_TREE_CONNECTOR_SOLID); break;
}}
tooltip {Tests connectorstyle() bit flags} xywh {486 120 140 21} down_box BORDER_BOX labelsize 12 textsize 11
}} selected
tooltip {Tests connectorstyle() bit flags} xywh {485 225 140 21} down_box BORDER_BOX labelsize 12 textsize 11
code0 {switch (tree->connectorstyle()) { case FL_TREE_CONNECTOR_NONE: connectorstyle_chooser->value(0); break; case FL_TREE_CONNECTOR_DOTTED: connectorstyle_chooser->value(1); break; case FL_TREE_CONNECTOR_SOLID: connectorstyle_chooser->value(2); break; }}
} {
MenuItem {} {
@ -428,8 +521,8 @@ switch ( selectmode_chooser->value() ) {
case 1: tree->selectmode(FL_TREE_SELECT_SINGLE); break; // Single
case 2: tree->selectmode(FL_TREE_SELECT_MULTI); break; // Multi
default: tree->selectmode(FL_TREE_SELECT_SINGLE); break; // Single
}}
tooltip {Sets how Fl_Tree handles mouse selection of tree items} xywh {486 144 140 21} down_box BORDER_BOX labelsize 12 textsize 11
}} selected
tooltip {Sets how Fl_Tree handles mouse selection of tree items} xywh {485 249 140 21} down_box BORDER_BOX labelsize 12 textsize 11
code0 {selectmode_chooser->value(1);}
code1 {cb_selectmode_chooser(selectmode_chooser, (void*)0);}
} {
@ -461,8 +554,10 @@ reselectmode_chooser->deactivate(); // deactivate if this ABI feature is disabl
reselectmode_chooser->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10302 (or higher)\\n"
"to get this feature");
window->redraw(); // deactivated
\#endif} selected
tooltip {Enable 'reselect' events} xywh {486 168 140 21} down_box BORDER_BOX labelsize 12 textsize 11
tooltip {Enable 'reselect' events
These happen when mouse drags or multi-clicks an item} xywh {485 273 140 21} down_box BORDER_BOX labelsize 12 textsize 11
code0 {reselectmode_chooser->value(1);}
code1 {reselectmode_chooser->do_callback();}
} {
@ -475,6 +570,36 @@ reselectmode_chooser->tooltip("DISABLED.\\n"
xywh {60 60 36 21} labelsize 12
}
}
Fl_Choice itemdrawmode_chooser {
label {Item Draw Mode}
callback {\#if FLTK_ABI_VERSION >= 10302
// NEW
switch ( itemdrawmode_chooser->value() ) {
case 0: tree->item_draw_mode(FL_TREE_ITEM_DRAW_WIDGET_ONLY); break; // None
case 1: tree->item_draw_mode(FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET); break; // Single
}
tree->redraw();
\#else
// OLD
itemdrawmode_chooser->deactivate(); // deactivate if this ABI feature is disabled
itemdrawmode_chooser->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10302 (or higher)\\n"
"to get this feature");
window->redraw(); // deactivated
\#endif} selected
tooltip {Sets how Fl_Tree draws item label and widget()} xywh {485 297 140 21} down_box BORDER_BOX labelsize 12 textsize 11
code0 {itemdrawmode_chooser->value(0);}
code1 {itemdrawmode_chooser->do_callback();}
} {
MenuItem {} {
label {Widget Only}
xywh {50 50 36 21} labelsize 12
}
MenuItem {} {
label {Label And Widget}
xywh {60 60 36 21} labelsize 12
}
}
Fl_Choice whenmode_chooser {
label When
callback {// Set when mode
@ -483,8 +608,8 @@ switch ( whenmode_chooser->value() ) {
case 1: tree->when(FL_WHEN_CHANGED); break;
case 2: tree->when(FL_WHEN_NEVER); break;
default: tree->when(FL_WHEN_RELEASE); break;
}}
tooltip {Sets when() the tree's callback is invoked} xywh {486 192 140 21} down_box BORDER_BOX labelsize 12 textsize 11
}} selected
tooltip {Sets when() the tree's callback is invoked} xywh {485 321 140 21} down_box BORDER_BOX labelsize 12 textsize 11
code0 {whenmode_chooser->value(1);}
code1 {cb_whenmode_chooser(whenmode_chooser, (void*)0);}
} {
@ -505,7 +630,7 @@ switch ( whenmode_chooser->value() ) {
label {Enable user icons?}
user_data tree
callback {AssignUserIcons();}
tooltip {Tests Fl_Tree_Item::usericon()} xywh {486 221 20 16} down_box DOWN_BOX labelsize 12 align 7
tooltip {Tests Fl_Tree_Item::usericon()} xywh {485 353 20 16} down_box DOWN_BOX labelsize 12 align 7
code0 {usericon_radio->value(1);}
}
Fl_Check_Button showroot_radio {
@ -513,7 +638,7 @@ switch ( whenmode_chooser->value() ) {
user_data tree
callback {int onoff = showroot_radio->value();
tree->showroot(onoff);}
tooltip {Tests tree->showroot();} xywh {486 237 20 16} down_box DOWN_BOX labelsize 12 align 7
tooltip {Tests tree->showroot();} xywh {485 369 20 16} down_box DOWN_BOX labelsize 12 align 7
code0 {int onoff = tree->showroot(); showroot_radio->value(onoff);}
}
Fl_Check_Button visiblefocus_checkbox {
@ -521,7 +646,7 @@ tree->showroot(onoff);}
user_data tree
callback {int onoff = visiblefocus_checkbox->value();
tree->visible_focus(onoff);}
tooltip {Toggles the tree's visible_focus() box} xywh {486 254 20 16} down_box DOWN_BOX labelsize 12 align 7
tooltip {Toggles the tree's visible_focus() box} xywh {485 386 20 16} down_box DOWN_BOX labelsize 12 align 7
code0 {int onoff = tree->visible_focus(); visiblefocus_checkbox->value(onoff);}
}
Fl_Button selection_color_button {
@ -530,17 +655,17 @@ tree->visible_focus(onoff);}
selection_color_button->color(val); // update modified color to button
tree->selection_color(val);
tree->redraw();}
tooltip {Changes the tree widget's selection color. Tests Fl_Tree::selection_color()} xywh {486 277 16 16} box DOWN_BOX labelsize 12 align 7
tooltip {Changes the tree widget's selection color. Tests Fl_Tree::selection_color()} xywh {485 409 16 16} box DOWN_BOX labelsize 12 align 7
code0 {o->color(tree->selection_color());}
}
Fl_Box {} {
label {Test Operations}
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {311 325 335 120} box GTK_DOWN_BOX color 47 labelsize 12 align 1
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {315 450 330 125} box GTK_DOWN_BOX color 47 labelsize 12 align 1
}
Fl_Box showitem_box {
label {show_item()
}
xywh {331 348 70 82} box GTK_DOWN_BOX labelsize 11 align 1
xywh {335 475 70 82} box GTK_DOWN_BOX labelsize 11 align 1
}
Fl_Button {} {
label Show
@ -548,7 +673,7 @@ tree->redraw();}
tree->show_item(item);}
tooltip {Tests show_item() with no position specified.
Makes the selected item visible IF it is off-screen.
No change made if it is not off-screen.} xywh {346 357 40 17} labelsize 11
No change made if it is not off-screen.} xywh {350 484 40 17} labelsize 11
}
Fl_Button {} {
label Top
@ -560,7 +685,7 @@ Scrolls selected item to the top of the display
To use:
1) open '500 items'
2) select item 0010
3) Hit Top/Mid/Bot} xywh {346 374 40 16} labelsize 11
3) Hit Top/Mid/Bot} xywh {350 501 40 16} labelsize 11
}
Fl_Button {} {
label Mid
@ -571,7 +696,7 @@ Scrolls the selected item to the middle of the display
To use:
1) open '500 items'
2) select 'item 0010'
3) Hit Top/Mid/Bot} xywh {346 390 40 16} labelsize 11
3) Hit Top/Mid/Bot} xywh {350 517 40 16} labelsize 11
}
Fl_Button {} {
label Bot
@ -582,7 +707,18 @@ Scrolls the selected item to the bottom of the display
To use:
1) open '500 items'
2) select 'item 0010'
3) Hit Top/Mid/Bot} xywh {346 406 40 16} labelsize 11
3) Hit Top/Mid/Bot} xywh {350 533 40 16} labelsize 11
}
Fl_Button openall_button {
label {Open All}
callback {for ( Fl_Tree_Item *item = tree->first();
item;
item = tree->next(item) ) {
if ( !item->is_root() && item->has_children() )
item->open();
}
tree->redraw();}
tooltip {Opens all nodes that have children} xywh {435 466 95 16} labelsize 9
}
Fl_Button loaddb_button {
label {Load Database...}
@ -593,7 +729,7 @@ if (filename) {
tree->load(prefs);
tree->redraw();
}}
tooltip {Load the contents of an Fl_Preferences database into the tree view} xywh {431 351 95 16} labelsize 9
tooltip {Load the contents of an Fl_Preferences database into the tree view} xywh {435 486 95 16} labelsize 9
}
Fl_Button insertabove_button {
label {Insert Above}
@ -608,12 +744,12 @@ while (item) {
}
tree->redraw();}
tooltip {Inserts three items above the selected items} xywh {431 371 95 16} labelsize 9
tooltip {Inserts three items above the selected items} xywh {435 506 95 16} labelsize 9
}
Fl_Button rebuildtree_button {
label {Rebuild Tree}
callback {RebuildTree();}
tooltip {Rebuilds the tree with defaults} xywh {431 391 95 16} labelsize 9
tooltip {Rebuilds the tree with defaults} xywh {435 526 95 16} labelsize 9
}
Fl_Button showpathname_button {
label {Show Pathname}
@ -626,14 +762,26 @@ switch ( tree->item_pathname(pathname, sizeof(pathname), item) ) {
case -1: fl_message("item_pathname() returned -1 (NOT FOUND)"); break;
case -2: fl_message("item_pathname() returned -2 (STRING TOO LONG)"); break;
}}
tooltip {Show the pathname for the selected item. Tests the Fl_Tree::item_pathname() method.} xywh {431 411 95 16} labelsize 9
tooltip {Show the pathname for the selected item. Tests the Fl_Tree::item_pathname() method.} xywh {435 546 95 16} labelsize 9
}
Fl_Button closeall_button {
label {Close All}
callback {for ( Fl_Tree_Item *item = tree->first();
item;
item = tree->next(item) ) {
if ( !item->is_root() && item->has_children() )
item->close();
}
tree->redraw();}
tooltip {Closes all nodes that have children
(doesn't affect 'root')} xywh {535 466 95 16} labelsize 9
}
Fl_Button clearall_button {
label {Clear All}
callback {tree->clear();
tree->redraw();}
tooltip {Clears all items
Tests Fl_Tree::clear()} xywh {531 351 95 16} labelsize 9
Tests Fl_Tree::clear()} xywh {535 486 95 16} labelsize 9
}
Fl_Button testcallbackflag_button {
label {Test Callback Flag}
@ -698,18 +846,39 @@ G_cb_counter = 0; tree->select("ROOT"); if ( !G_cb_counter ) fl_alert("FAIL
tree->deselect("ROOT"); // leave deselected
fl_alert("TEST COMPLETED\\n If you didn't see any error dialogs, test PASSED.");}
tooltip {Test the 'docallback' argument can disable callbacks.} xywh {531 371 95 16} labelsize 9
tooltip {Test the 'docallback' argument can disable callbacks.} xywh {535 506 95 16} labelsize 9
}
Fl_Button testrootshowself_button {
label {Root Show Self}
callback {Fl_Tree_Item *root = tree->root();
fprintf(stderr, "--- Show Tree\\n");
if (root) root->show_self();}
tooltip {Test the root->'show_self() method to show the entire tree} xywh {530 391 95 16} labelsize 9
tooltip {Test the root->'show_self() method to show the entire tree on stdout} xywh {534 526 95 16} labelsize 9
}
Fl_Button add20k_button {
label {Add 20,000}
callback {static int item_id = 501;
Fl_Tree_Item *item=tree->first();
while (item) {
if ( item->is_selected() ) {
Fl_Tree_Item *parent = item->parent();
if ( parent == 0 ) parent = tree->root();
char s[80];
for ( int i=0; i<20000; i++ ) {
sprintf(s, "Item \#%d", item_id+i);
tree->add(parent, s);
}
item_id += 20000;
break;
}
item = item->next();
}
tree->redraw();}
tooltip {Adds 20,000 items to the selected item's parent} xywh {534 546 95 16} labelsize 9
}
Fl_Box {} {
label {Selected Items}
tooltip {These controls only affect the selected items. If no items are selected, all existing items in tree are modified.} xywh {661 23 335 280} box GTK_DOWN_BOX color 47 labelsize 12 align 1
tooltip {These controls only affect the selected items. If no items are selected, all existing items in tree are modified.} xywh {661 23 335 410} box GTK_DOWN_BOX color 47 labelsize 12 align 1
}
Fl_Choice all_font_choice {
label {Label Font}
@ -977,6 +1146,36 @@ while (item) {
tree->redraw();}
tooltip {Removes the selected items} xywh {829 174 95 16} labelsize 9
}
Fl_Button swapselected_button {
label {Swap Selected}
callback {Fl_Tree_Item *item=tree->first();
Fl_Tree_Item *a = 0, *b = 0;
while (item) {
if ( item->is_selected() ) {
if ( !a ) a = item;
else if ( !b ) b = item;
else {
fl_alert("Too many items selected. (must select only two)");
return;
}
}
item = item->next();
}
if ( !a || !b ) {
fl_alert("Too few items selected. (you must select two)");
return;
}
Fl_Tree_Item *pa = a->parent();
Fl_Tree_Item *pb = b->parent();
if ( pa != pb ) {
fl_alert("The two selected items must be siblings");
return;
}
pa->swap_children(a,b);
tree->redraw();}
tooltip {Tests the Fl_Tree_Item::swap_children() method
Swaps two selected items (items must be siblings)} xywh {829 194 95 16} labelsize 9
}
Fl_Button selectall_button {
label {Select All}
callback {tree->select_all(0);
@ -1059,14 +1258,14 @@ else tree->deselect_all(item); // deselect /ROOT and its children}
}
Fl_Box {} {
label {New Item Defaults}
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {661 325 335 120} box GTK_DOWN_BOX color 47 labelsize 12 align 1
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {660 450 335 125} box GTK_DOWN_BOX color 47 labelsize 12 align 1
}
Fl_Button item_labelfgcolor_button {
label item_labelfgcolor
callback {Fl_Color val = EditColor(tree->item_labelfgcolor()); // Let user edit the color
tree->item_labelfgcolor(val); // apply modified color to tree
item_labelfgcolor_button->color(val); // update modified color to button}
tooltip {Sets the *default* label foreground color for new items created. Does NOT affect existing items.} xywh {828 340 16 16} box DOWN_BOX labelsize 12 align 7
tooltip {Sets the *default* label foreground color for new items created. Does NOT affect existing items.} xywh {832 472 16 16} box DOWN_BOX labelsize 12 align 7
code0 {o->color(tree->item_labelfgcolor());}
}
Fl_Button item_labelbgcolor_button {
@ -1074,14 +1273,14 @@ item_labelfgcolor_button->color(val); // update modified color to button}
callback {Fl_Color val = EditColor(tree->item_labelbgcolor()); // Let user edit the color
tree->item_labelbgcolor(val); // apply modified color to tree
item_labelbgcolor_button->color(val); // update modified color to button}
tooltip {Sets the *default* label background color for new items created. Does NOT affect existing items.} xywh {828 358 16 16} box DOWN_BOX labelsize 12 align 7
tooltip {Sets the *default* label background color for new items created. Does NOT affect existing items.} xywh {832 490 16 16} box DOWN_BOX labelsize 12 align 7
code0 {item_labelbgcolor_button->color(tree->item_labelbgcolor());}
}
Fl_Choice item_font_choice {
label {Item label font}
callback {Fl_Font val = (Fl_Font)item_font_choice->value(); // get chooser's current font value
tree->item_labelfont(val); // change font in tree}
tooltip {Sets the default font used for new items created. Does NOT affect existing items.} xywh {828 384 140 21} down_box BORDER_BOX labelsize 12 textsize 12
tooltip {Sets the default font used for new items created. Does NOT affect existing items.} xywh {832 516 140 21} down_box BORDER_BOX labelsize 12 textsize 12
code0 {o->value((int)tree->item_labelfont()); // get tree's current font, assign to chooser}
} {
MenuItem {} {
@ -1153,63 +1352,12 @@ tree->item_labelfont(val); // change font in tree}
label item_labelsize
user_data tree
callback {tree->item_labelsize((int)item_labelsize_slider->value());}
tooltip {Sets the default labelsize used for new items. Does NOT affect existing items.} xywh {828 409 140 16} type Horizontal labelsize 12 align 4 textsize 12
tooltip {Sets the default labelsize used for new items. Does NOT affect existing items.} xywh {832 541 140 16} type Horizontal labelsize 12 align 4 textsize 12
code0 {o->value((int)tree->item_labelsize());}
code1 {o->range(1.0, 50.0);}
code2 {o->step(1.0);}
code3 {o->color(46); o->selection_color(FL_RED);}
}
Fl_Button swapselected_button {
label {Swap Selected}
callback {Fl_Tree_Item *item=tree->first();
Fl_Tree_Item *a = 0, *b = 0;
while (item) {
if ( item->is_selected() ) {
if ( !a ) a = item;
else if ( !b ) b = item;
else {
fl_alert("Too many items selected. (must select only two)");
return;
}
}
item = item->next();
}
if ( !a || !b ) {
fl_alert("Too few items selected. (you must select two)");
return;
}
Fl_Tree_Item *pa = a->parent();
Fl_Tree_Item *pb = b->parent();
if ( pa != pb ) {
fl_alert("The two selected items must be siblings");
return;
}
pa->swap_children(a,b);
tree->redraw();}
tooltip {Tests the Fl_Tree_Item::swap_children() method
Swaps two selected items (items must be siblings)} xywh {829 194 95 16} labelsize 9
}
Fl_Button add20k_button {
label {Add 20,000}
callback {static int item_id = 501;
Fl_Tree_Item *item=tree->first();
while (item) {
if ( item->is_selected() ) {
Fl_Tree_Item *parent = item->parent();
if ( parent == 0 ) parent = tree->root();
char s[80];
for ( int i=0; i<20000; i++ ) {
sprintf(s, "Item \#%d", item_id+i);
tree->add(parent, s);
}
item_id += 20000;
break;
}
item = item->next();
}
tree->redraw();}
tooltip {Adds 20,000 items to the selected item's parent} xywh {530 411 95 16} labelsize 9
}
}
Fl_Box resizer_box {
xywh {0 263 15 14}