diff options
| author | Greg Ercolano <erco@seriss.com> | 2010-08-26 13:32:30 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2010-08-26 13:32:30 +0000 |
| commit | c7ef0f1d17f30f98342117f0635702121ce61d9a (patch) | |
| tree | ee7d0742b9e4454d69aec87f363a9c903c444e9d /test/unittest_scrollbarsize.cxx | |
| parent | 23303736e3cb6a51e72dec08660ca06902925adb (diff) | |
Fl_Tree related mods
* open() / close() now can invoke the callback().
New method callback_reason() lets one determine the cause.
(Used FLU's tree for reference on this)
* new Fl_Tree methods:
> item_pathname()
> show_item(), show_top(), show_middle(), show_bottom().
> next_selected_item() -- loop through the selected items.
> callback_item() -- the item that caused the callback
> callback_reason() -- reason the callback was invoked
FL_TREE_REASON_SELECTED -- item was selected
FL_TREE_REASON_DESELECTED -- item was de-selected
FL_TREE_REASON_OPENED -- item was opened
FL_TREE_REASON_CLOSED -- item was closed
> position()
> display()
* new Fl_Tree_Item methods:
> find_child_item() -- searches children for a path
> find_item() -- searches self and children for a path
> next(item) -- loop forward through tree
> prev(item) -- loop backward through tree
> first_selected_item()
> next_selected_item()
> x(), y(), w(), h()
* deprecated:
> item_clicked(). Use callback_item() instead
* the 'docallback' optional integer argument for all methods
is now back to 0 or 1 only. (Other values became unnecessary
when above new callback() behavior was defined)
* test/tree has new "Test Callback Flags" button to test the
'docallback' flags for eg. open/close/select/deselect
to make sure no bugs creep in.
* INTERNAL: added free_path() to free special path array created by parse_path().
* Various docs strengthened:
* How to use first()/next() and last()/prev() to walk tree
> made sure more method's options use \param[in]
> Added more \see references
* Moved several implementations from .H -> .cxx
* Added autoscroll to keyboard nav and mouse drags
* test/unittests: added Fl_Tree to scrollsize test
TODO:
o Horiz scroll bar (see Johannes Schock's email re. additions he sent)
o Need to allow keyboard nav to move focus to child FLTK widgets
o Fix fast-selections so that no gaps are left behind.
(Select all items from the last selected item to the current)
o Investigate non-default values of when() causing odd behavior.
(See the tree demo's when() pulldown..)
* tree demo modified to include top/mid/bot buttons that test the above.
* Keyboard navigation added:
Up/Down -- move focus
Left/Right -- closes/opens tree item in focus
Spacebar -- toggle selection state of item in focus
Enter -- selects the item in focus, deselecting all others
Tab/Shift-Tab -- change widget focus
* All Fl_Tree select() and deselect() methods now return a value
that indicates if the item's state was changed.
* Fixed focus box drawing (focus box resides more precisely within item's box)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7691 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/unittest_scrollbarsize.cxx')
| -rw-r--r-- | test/unittest_scrollbarsize.cxx | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/test/unittest_scrollbarsize.cxx b/test/unittest_scrollbarsize.cxx index 2c2725e3e..babb82269 100644 --- a/test/unittest_scrollbarsize.cxx +++ b/test/unittest_scrollbarsize.cxx @@ -27,6 +27,7 @@ #include <FL/Fl_Group.H> #include <FL/Fl_Browser.H> +#include <FL/Fl_Tree.H> #include <FL/Fl_Value_Slider.H> // @@ -34,10 +35,12 @@ // class ScrollBarSizeTest : public Fl_Group { Fl_Browser *brow_a, *brow_b, *brow_c; + Fl_Tree *tree_a, *tree_b, *tree_c; Fl_Browser *makebrowser(int X,int Y,int W,int H,const char*L=0) { Fl_Browser *b = new Fl_Browser(X,Y,W,H,L); b->type(FL_MULTI_BROWSER); + b->align(FL_ALIGN_TOP); b->add("Papa"); b->add("Delta"); b->add("Hotel"); b->add("Long entry will show h-bar"); b->add("Charlie"); b->add("Echo"); b->add("Foxtrot"); @@ -59,12 +62,29 @@ class ScrollBarSizeTest : public Fl_Group { b->add("Whisky"); b->add("Zulu"); return(b); } + Fl_Tree *maketree(int X,int Y,int W,int H,const char*L=0) { + Fl_Tree *b = new Fl_Tree(X,Y,W,H,L); + b->type(FL_TREE_SELECT_MULTI); + b->align(FL_ALIGN_TOP); + b->add("Papa"); b->add("Delta"); b->add("Hotel"); + b->add("Long entry will show h-bar"); + b->add("Charlie"); b->add("Echo"); b->add("Foxtrot"); + b->add("Golf"); b->add("Lima"); b->add("Victor"); + b->add("Alpha"); b->add("Xray"); b->add("Yankee"); + b->add("Oscar"); b->add("India"); b->add("Juliet"); + b->add("Kilo"); b->add("Mike"); b->add("Sierra"); + b->add("November"); b->add("Tango"); b->add("Quebec"); + b->add("Bravo"); b->add("Romeo"); b->add("Uniform"); + b->add("Whisky"); b->add("Zulu"); + return(b); + } void slide_cb2(Fl_Value_Slider *in) { const char *label = in->label(); int val = in->value(); //fprintf(stderr, "VAL='%d'\n",val); if ( strcmp(label,"A: Scroll Size") == 0 ) { brow_a->scrollbar_size(val); + tree_a->scrollbar_size(val); } else { Fl::scrollbar_size(val); } @@ -82,10 +102,36 @@ public: // CTOR ScrollBarSizeTest(int X, int Y, int W, int H) : Fl_Group(X,Y,W,H) { begin(); - brow_a = makebrowser(X+ 10,Y+40,100,H-170,"Browser A"); - brow_b = makebrowser(X+120,Y+40,100,H-170,"Browser B"); - brow_c = makebrowser(X+240,Y+40,100,H-170,"Browser C"); - Fl_Value_Slider *slide_glob = new Fl_Value_Slider(X+100,Y+10,100,18,"Global Scroll Size"); + // _____________ _______________ + // |_____________| |_______________| + // --- ----- <-- tgrpy + // brow_a brow_b brow_c | 14 | + // ---------- ---------- ---------- --- | <-- browy + // | | | | | | | | + // | | | | | | |browh | + // | | | | | | | | + // ---------- ---------- ---------- --- tgrph + // | | + // tree_a tree_b tree_c | 20 | + // ---------- ---------- ---------- --- | <-- treey + // | | | | | | | | + // | | | | | | |treeh | + // | | | | | | | | + // ---------- ---------- ---------- --- ------ + // + int tgrpy = Y+30; + int tgrph = H-130; + int browy = tgrpy+14; + int browh = tgrph/2 - 20; + int treey = browy + browh + 20; + int treeh = browh; + brow_a = makebrowser(X+ 10,browy,100,browh,"Browser A"); + brow_b = makebrowser(X+120,browy,100,browh,"Browser B"); + brow_c = makebrowser(X+240,browy,100,browh,"Browser C"); + tree_a = maketree(X+ 10,treey,100,treeh,"Tree A"); + tree_b = maketree(X+120,treey,100,treeh,"Tree B"); + tree_c = maketree(X+240,treey,100,treeh,"Tree C"); + Fl_Value_Slider *slide_glob = new Fl_Value_Slider(X+100,Y,100,18,"Global Scroll Size"); slide_glob->value(16); slide_glob->type(FL_HORIZONTAL); slide_glob->align(FL_ALIGN_LEFT); @@ -93,7 +139,7 @@ public: slide_glob->step(1.0); slide_glob->callback(slide_cb, (void*)this); slide_glob->labelsize(12); - Fl_Value_Slider *slide_browa = new Fl_Value_Slider(X+350,Y+10,100,18,"A: Scroll Size"); + Fl_Value_Slider *slide_browa = new Fl_Value_Slider(X+350,Y,100,18,"A: Scroll Size"); slide_browa->value(16); slide_browa->type(FL_HORIZONTAL); slide_browa->align(FL_ALIGN_LEFT); |
