Fl_Tree.H 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. //
  2. // "$Id: Fl_Tree.H 11976 2016-09-24 23:15:48Z AlbrechtS $"
  3. //
  4. #ifndef FL_TREE_H
  5. #define FL_TREE_H
  6. #include <FL/Fl.H>
  7. #include <FL/Fl_Group.H>
  8. #include <FL/Fl_Scrollbar.H>
  9. #include <FL/fl_draw.H>
  10. #include <FL/Fl_Tree_Item.H>
  11. #include <FL/Fl_Tree_Prefs.H>
  12. //////////////////////
  13. // FL/Fl_Tree.H
  14. //////////////////////
  15. //
  16. // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
  17. // Copyright (C) 2009-2010 by Greg Ercolano.
  18. //
  19. // This library is free software. Distribution and use rights are outlined in
  20. // the file "COPYING" which should have been included with this file. If this
  21. // file is missing or damaged, see the license at:
  22. //
  23. // http://www.fltk.org/COPYING.php
  24. //
  25. // Please report all bugs and problems on the following page:
  26. //
  27. // http://www.fltk.org/str.php
  28. //
  29. ///
  30. /// \file
  31. /// \brief This file contains the definitions of the Fl_Tree class
  32. ///
  33. /// \class Fl_Tree
  34. ///
  35. /// \brief Tree widget.
  36. ///
  37. /// \image html tree-simple.png "Fl_Tree example program"
  38. /// \image latex tree-simple.png "Fl_Tree example program" width=4cm
  39. ///
  40. /// \code
  41. /// Fl_Tree // Top level widget
  42. /// |--- Fl_Tree_Item // Items in the tree
  43. /// |--- Fl_Tree_Prefs // Preferences for the tree
  44. /// |--- Fl_Tree_Connector (enum) // Connection modes
  45. /// |--- Fl_Tree_Select (enum) // Selection modes
  46. /// |--- Fl_Tree_Sort (enum) // Sort behavior
  47. /// \endcode
  48. /// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's arranged
  49. /// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed.
  50. /// Items can be added, deleted, inserted, sorted and re-ordered.
  51. ///
  52. /// The tree items may also contain other FLTK widgets, like buttons, input fields,
  53. /// or even "custom" widgets.
  54. ///
  55. /// The callback() is invoked depending on the value of when():
  56. ///
  57. /// - FL_WHEN_RELEASE -- callback invoked when left mouse button is released on an item
  58. /// - FL_WHEN_CHANGED -- callback invoked when left mouse changes selection state
  59. ///
  60. /// The simple way to define a tree:
  61. /// \code
  62. /// #include <FL/Fl_Tree.H>
  63. /// [..]
  64. /// Fl_Tree tree(X,Y,W,H);
  65. /// tree.begin();
  66. /// tree.add("Flintstones/Fred");
  67. /// tree.add("Flintstones/Wilma");
  68. /// tree.add("Flintstones/Pebbles");
  69. /// tree.add("Simpsons/Homer");
  70. /// tree.add("Simpsons/Marge");
  71. /// tree.add("Simpsons/Bart");
  72. /// tree.add("Simpsons/Lisa");
  73. /// tree.end();
  74. /// \endcode
  75. ///
  76. /// \par FEATURES
  77. /// Items can be added with add(),<BR>
  78. /// removed with remove(),<BR>
  79. /// completely cleared with clear(),<BR>
  80. /// inserted with insert() and insert_above(),<BR>
  81. /// selected/deselected with select() and deselect(),<BR>
  82. /// open/closed with open() and close(),<BR>
  83. /// positioned on the screen with show_item_top(), show_item_middle() and
  84. /// show_item_bottom(),<BR>
  85. /// item children can be swapped around with Fl_Tree_Item::swap_children(),<BR>
  86. /// sorting can be controlled when items are add()ed via sortorder().<BR>
  87. /// You can walk the entire tree with first() and next().<BR>
  88. /// You can walk visible items with first_visible_item()
  89. /// and next_visible_item().<BR>
  90. /// You can walk selected items with first_selected_item() and
  91. /// next_selected_item().<BR>
  92. /// Items can be found by their pathname using find_item(const char*),
  93. /// and an item's pathname can be found with item_pathname().<BR>
  94. /// The selected items' colors are controlled by selection_color()
  95. /// (inherited from Fl_Widget).<BR>
  96. /// A hook is provided to allow you to redefine how item's labels are drawn
  97. /// via Fl_Tree::item_draw_callback().<BR>
  98. ///
  99. /// \par SELECTION OF ITEMS
  100. /// The tree can have different selection behaviors controlled by selectmode().
  101. /// The background color used for selected items is the Fl_Tree::selection_color().
  102. /// The foreground color for selected items is controlled internally with fl_contrast().
  103. ///
  104. /// \par CHILD WIDGETS
  105. /// FLTK widgets (including custom widgets) can be assigned to tree items via
  106. /// Fl_Tree_Item::widget().
  107. /// \par
  108. /// When an Fl_Tree_Item::widget() is defined, the default behavior is for the
  109. /// widget() to be shown in place of the item's label (if it has one).
  110. /// Only the widget()'s width will be used; the widget()'s x() and y() position
  111. /// will be managed by the tree, and the h() will track the item's height.
  112. /// This default behavior can be altered (ABI 1.3.1):
  113. /// Setting Fl_Tree::item_draw_mode()'s FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET flag
  114. /// causes the label + widget to be displayed together in that order, and
  115. /// adding the FL_TREE_ITEM_HEIGHT_FROM_WIDGET flag causes widget's height
  116. /// to define the widget()'s height.
  117. ///
  118. /// \par ICONS
  119. /// The tree's open/close icons can be redefined with
  120. /// Fl_Tree::openicon(), Fl_Tree::closeicon(). User icons
  121. /// can either be changed globally with Fl_Tree::usericon(),
  122. /// or on a per-item basis with Fl_Tree_Item::usericon().
  123. /// \par
  124. /// Various default preferences can be globally manipulated via Fl_Tree_Prefs,
  125. /// including colors, margins, icons, connection lines, etc.
  126. ///
  127. /// \par FONTS AND COLORS
  128. /// When adding new items to the tree, the new items get the
  129. /// defaults for fonts and colors from:
  130. /// \par
  131. /// - Fl_Tree::item_labelfont() -- The default item label font (default: FL_HELVETICA)
  132. /// - Fl_Tree::item_labelsize() -- The default item label size (default: FL_NORMAL_SIZE)
  133. /// - Fl_Tree::item_labelfgcolor() -- The default item label foreground color (default: FL_FOREGROUND_COLOR)
  134. /// - Fl_Tree::item_labelbgcolor() -- The default item label background color (default: 0xffffffff, which tree uses as 'transparent')
  135. /// \par
  136. /// Each item (Fl_Tree_Item) inherits a copy of these font/color attributes when created,
  137. /// and each item has its own methods to let the app change these values on a per-item basis
  138. /// using methods of the same name:
  139. /// \par
  140. /// - Fl_Tree_Item::labelfont() -- The item's label font (default: FL_HELVETICA)
  141. /// - Fl_Tree_Item::labelsize() -- The item's label size (default: FL_NORMAL_SIZE)
  142. /// - Fl_Tree_Item::labelfgcolor() -- The item's label foreground color (default: FL_FOREGROUND_COLOR)
  143. /// - Fl_Tree_Item::labelbgcolor() -- The item's label background color (default: 0xffffffff, which uses the tree's own bg color)
  144. ///
  145. /// \par CALLBACKS
  146. /// The tree's callback() will be invoked when items change state or are open/closed.
  147. /// when() controls when mouse/keyboard events invoke the callback.
  148. /// callback_item() and callback_reason() can be used to determine the cause of the callback. e.g.
  149. /// \par
  150. /// \code
  151. /// void MyTreeCallback(Fl_Widget *w, void *data) {
  152. /// Fl_Tree *tree = (Fl_Tree*)w;
  153. /// Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); // get selected item
  154. /// switch ( tree->callback_reason() ) {
  155. /// case FL_TREE_REASON_SELECTED: [..]
  156. /// case FL_TREE_REASON_DESELECTED: [..]
  157. /// case FL_TREE_REASON_RESELECTED: [..]
  158. /// case FL_TREE_REASON_OPENED: [..]
  159. /// case FL_TREE_REASON_CLOSED: [..]
  160. /// }
  161. /// \endcode
  162. ///
  163. /// \par SIMPLE EXAMPLES
  164. /// To find all the selected items:
  165. /// \code
  166. /// for ( Fl_Tree_Item *i=first_selected_item(); i; i=next_selected_item(i) )
  167. /// printf("Item %s is selected\n", i->label());
  168. /// \endcode
  169. /// To get an item's full menu pathname, use Fl_Tree::item_pathname(), e.g.
  170. /// \code
  171. /// char pathname[256] = "???";
  172. /// tree->item_pathname(pathname, sizeof(pathname), item); // eg. "Parent/Child/Item"
  173. /// \endcode
  174. /// \par
  175. /// To walk all the items of the tree from top to bottom:
  176. /// \code
  177. /// // Walk all the items in the tree, and print their labels
  178. /// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
  179. /// printf("Item: %s\n", item->label());
  180. /// }
  181. /// \endcode
  182. /// \par
  183. /// To recursively walk all the children of a particular item,
  184. /// define a function that uses recursion:
  185. /// \code
  186. /// // Find all of the item's children and print an indented report of their labels
  187. /// void my_print_all_children(Fl_Tree_Item *item, int indent=0) {
  188. /// for ( int t=0; t<item->children(); t++ ) {
  189. /// printf("%*s Item: %s\n", indent, "", item->child(t)->label());
  190. /// my_print_all_children(item->child(t), indent+4); // recurse
  191. /// }
  192. /// }
  193. /// \endcode
  194. /// \par
  195. /// To change the default label font and color when creating new items:
  196. /// \code
  197. /// tree = new Fl_Tree(..);
  198. /// tree->item_labelfont(FL_COURIER); // Use Courier font for all new items
  199. /// tree->item_labelfgcolor(FL_RED); // Use red color for labels of all new items
  200. /// [..]
  201. /// // Now create the items in the tree using the above defaults.
  202. /// tree->add("Aaa");
  203. /// tree->add("Bbb");
  204. /// [..]
  205. /// \endcode
  206. /// \par
  207. /// To change the font and color of all existing items in the tree:
  208. /// \code
  209. /// // Change the font and color of all items currently in the tree
  210. /// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
  211. /// item->labelfont(FL_COURIER);
  212. /// item->labelcolor(FL_RED);
  213. /// }
  214. /// \endcode
  215. ///
  216. /// \par DISPLAY DESCRIPTION
  217. /// The following image shows the tree's various visual elements
  218. /// and the methods that control them:
  219. /// \par
  220. /// \image html tree-elements.png
  221. /// \image latex tree-elements.png "Fl_Tree elements" width=6cm
  222. /// \par
  223. /// The following shows the protected dimension variables 'tree inner' (tix..)
  224. /// and 'tree outer' (tox..):
  225. /// \image html tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm
  226. /// \image latex tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm
  227. ///
  228. /// \par KEYBOARD BINDINGS
  229. /// The following table lists keyboard bindings for navigating the tree:
  230. ///
  231. /// <TABLE BORDER="1" SUMMARY="Fl_Tree keyboard bindings.">
  232. /// <CAPTION ALIGN=TOP>Fl_Tree keyboard bindings.</CAPTION>
  233. /// <TR>
  234. /// <TD WIDTH=25% ALIGN=CENTER><B>Keyboard</B></TD>
  235. /// <TD WIDTH=25% ALIGN=CENTER><B>FL_TREE_SELECT_MULTI</B></TD>
  236. /// <TD WIDTH=25% ALIGN=CENTER><B>FL_TREE_SELECT_SINGLE</B></TD>
  237. /// <TD WIDTH=25% ALIGN=CENTER><B>FL_TREE_SELECT_NONE</B></TD>
  238. ///
  239. /// </TR><TR>
  240. /// <TD ALIGN=CENTER><B>Ctrl-A</B> (Linux/Windows)<BR><B>Command-A</B> (Mac)</TD>
  241. /// <TD ALIGN=CENTER>Select all items.</TD>
  242. /// <TD ALIGN=CENTER>N/A</TD>
  243. /// <TD ALIGN=CENTER>N/A</TD>
  244. ///
  245. /// </TR><TR>
  246. /// <TD ALIGN=CENTER><B>Space </B></TD>
  247. /// <TD ALIGN=CENTER>Selects item.</TD>
  248. /// <TD ALIGN=CENTER>Selects item.</TD>
  249. /// <TD ALIGN=CENTER>N/A</TD>
  250. ///
  251. /// </TR><TR>
  252. /// <TD ALIGN=CENTER><B>Ctrl-Space </B></TD>
  253. /// <TD ALIGN=CENTER>Toggle item.</TD>
  254. /// <TD ALIGN=CENTER>Toggle item.</TD>
  255. /// <TD ALIGN=CENTER>N/A</TD>
  256. ///
  257. /// </TR><TR>
  258. /// <TD ALIGN=CENTER><B>Shift-Space </B></TD>
  259. /// <TD ALIGN=CENTER>Extends selection<BR>from last item.</TD>
  260. /// <TD ALIGN=CENTER>Selects item.</TD>
  261. /// <TD ALIGN=CENTER>N/A</TD>
  262. ///
  263. /// </TR><TR>
  264. /// <TD ALIGN=CENTER><B>Enter,<BR>Ctrl-Enter,<BR>Shift-Enter </B></TD>
  265. /// <TD ALIGN=CENTER>Toggles open/close</TD>
  266. /// <TD ALIGN=CENTER>Toggles open/close</TD>
  267. /// <TD ALIGN=CENTER>Toggles open/close</TD>
  268. ///
  269. /// </TR><TR>
  270. /// <TD ALIGN=CENTER><B>Right / Left</B></TD>
  271. /// <TD ALIGN=CENTER>Open/Close item.</TD>
  272. /// <TD ALIGN=CENTER>Open/Close item.</TD>
  273. /// <TD ALIGN=CENTER>Open/Close item.</TD>
  274. ///
  275. /// </TR><TR>
  276. /// <TD ALIGN=CENTER><B>Up / Down</B></TD>
  277. /// <TD ALIGN=CENTER>Move focus box up/down.</TD>
  278. /// <TD ALIGN=CENTER>Move focus box up/down.</TD>
  279. /// <TD ALIGN=CENTER>N/A</TD>
  280. ///
  281. /// </TR><TR>
  282. /// <TD ALIGN=CENTER><B>Shift-Up / Shift-Down</B></TD>
  283. /// <TD ALIGN=CENTER>Extend selection up/down.</TD>
  284. /// <TD ALIGN=CENTER>Move focus up/down.</TD>
  285. /// <TD ALIGN=CENTER>N/A</TD>
  286. ///
  287. /// </TR><TR>
  288. /// <TD ALIGN=CENTER><B>Home / End</B></TD>
  289. /// <TD ALIGN=CENTER>Move to top/bottom of tree.</TD>
  290. /// <TD ALIGN=CENTER>Move to top/bottom of tree.</TD>
  291. /// <TD ALIGN=CENTER>Move to top/bottom of tree.</TD>
  292. ///
  293. /// </TR><TR>
  294. /// <TD ALIGN=CENTER><B>PageUp / PageDown</B></TD>
  295. /// <TD ALIGN=CENTER>Page up/down.</TD>
  296. /// <TD ALIGN=CENTER>Page up/down.</TD>
  297. /// <TD ALIGN=CENTER>Page up/down.</TD>
  298. ///
  299. /// </TD></TR></TABLE>
  300. ///
  301. /// \enum Fl_Tree_Reason
  302. /// The reason the callback was invoked.
  303. ///
  304. enum Fl_Tree_Reason {
  305. FL_TREE_REASON_NONE=0, ///< unknown reason
  306. FL_TREE_REASON_SELECTED, ///< an item was selected
  307. FL_TREE_REASON_DESELECTED, ///< an item was de-selected
  308. FL_TREE_REASON_RESELECTED, ///< an item was re-selected (e.g. double-clicked)
  309. FL_TREE_REASON_OPENED, ///< an item was opened
  310. FL_TREE_REASON_CLOSED, ///< an item was closed
  311. FL_TREE_REASON_DRAGGED ///< an item was dragged into a new place
  312. };
  313. class FL_EXPORT Fl_Tree : public Fl_Group {
  314. friend class Fl_Tree_Item;
  315. Fl_Tree_Item *_root; // can be null!
  316. Fl_Tree_Item *_item_focus; // item that has focus box
  317. Fl_Tree_Item *_callback_item; // item invoked during callback (can be NULL)
  318. Fl_Tree_Reason _callback_reason; // reason for the callback
  319. Fl_Tree_Prefs _prefs; // all the tree's settings
  320. int _scrollbar_size; // size of scrollbar trough
  321. Fl_Tree_Item *_lastselect;
  322. void fix_scrollbar_order();
  323. protected:
  324. Fl_Scrollbar *_vscroll; ///< Vertical scrollbar
  325. Fl_Scrollbar *_hscroll; ///< Horizontal scrollbar
  326. int _tox,_toy,_tow,_toh; ///< Tree widget outer xywh dimension: outside scrollbars, inside widget border
  327. int _tix,_tiy,_tiw,_tih; ///< Tree widget inner xywh dimension: inside borders + scrollbars
  328. /// the calculated width of the entire tree hierarchy. See calc_tree()
  329. int _tree_w;
  330. /// the calculated height of the entire tree hierarchy. See calc_tree()
  331. int _tree_h;
  332. void item_clicked(Fl_Tree_Item* val);
  333. void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason);
  334. // next_visible_item() and extend_selection() moved to 'public' in ABI 1.3.3
  335. // undocmented draw_tree() dropped -- draw() does all the work now
  336. public:
  337. Fl_Tree(int X, int Y, int W, int H, const char *L=0);
  338. ~Fl_Tree();
  339. int handle(int e);
  340. void draw();
  341. void show_self();
  342. void resize(int,int,int,int);
  343. ///////////////////////
  344. // root methods
  345. ///////////////////////
  346. void root_label(const char *new_label);
  347. Fl_Tree_Item* root();
  348. void root(Fl_Tree_Item *newitem);
  349. const Fl_Tree_Prefs& prefs() const { return _prefs; }
  350. ////////////////////////////////
  351. // Item creation/removal methods
  352. ////////////////////////////////
  353. Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem=0);
  354. Fl_Tree_Item* add(Fl_Tree_Item *parent_item, const char *name);
  355. Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
  356. Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
  357. int remove(Fl_Tree_Item *item);
  358. void clear();
  359. void clear_children(Fl_Tree_Item *item);
  360. ////////////////////////
  361. // Item lookup methods
  362. ////////////////////////
  363. Fl_Tree_Item *find_item(const char *path);
  364. const Fl_Tree_Item *find_item(const char *path) const;
  365. int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
  366. const Fl_Tree_Item* find_clicked(int yonly=0) const;
  367. Fl_Tree_Item* find_clicked(int yonly=0);
  368. Fl_Tree_Item *item_clicked();
  369. Fl_Tree_Item *first();
  370. Fl_Tree_Item *first_visible(); // deprecated in ABI 10303
  371. Fl_Tree_Item *first_visible_item();
  372. Fl_Tree_Item *next(Fl_Tree_Item *item=0);
  373. Fl_Tree_Item *prev(Fl_Tree_Item *item=0);
  374. Fl_Tree_Item *last();
  375. Fl_Tree_Item *last_visible(); // deprecated in ABI 10303
  376. Fl_Tree_Item *last_visible_item();
  377. Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir); // made public in 1.3.3 ABI
  378. Fl_Tree_Item *first_selected_item();
  379. Fl_Tree_Item *last_selected_item();
  380. Fl_Tree_Item *next_item(Fl_Tree_Item *item, int dir=FL_Down, bool visible=false);
  381. Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0, int dir=FL_Down);
  382. int get_selected_items(Fl_Tree_Item_Array &items);
  383. //////////////////////////
  384. // Item open/close methods
  385. //////////////////////////
  386. int open(Fl_Tree_Item *item, int docallback=1);
  387. int open(const char *path, int docallback=1);
  388. void open_toggle(Fl_Tree_Item *item, int docallback=1);
  389. int close(Fl_Tree_Item *item, int docallback=1);
  390. int close(const char *path, int docallback=1);
  391. int is_open(Fl_Tree_Item *item) const;
  392. int is_open(const char *path) const;
  393. int is_close(Fl_Tree_Item *item) const;
  394. int is_close(const char *path) const;
  395. /////////////////////////
  396. // Item selection methods
  397. /////////////////////////
  398. int select(Fl_Tree_Item *item, int docallback=1);
  399. int select(const char *path, int docallback=1);
  400. void select_toggle(Fl_Tree_Item *item, int docallback=1);
  401. int deselect(Fl_Tree_Item *item, int docallback=1);
  402. int deselect(const char *path, int docallback=1);
  403. int deselect_all(Fl_Tree_Item *item=0, int docallback=1);
  404. int select_only(Fl_Tree_Item *selitem, int docallback=1);
  405. int select_all(Fl_Tree_Item *item=0, int docallback=1);
  406. int extend_selection_dir(Fl_Tree_Item *from,
  407. Fl_Tree_Item *to,
  408. int dir,
  409. int val,
  410. bool visible);
  411. int extend_selection(Fl_Tree_Item *from,
  412. Fl_Tree_Item *to,
  413. int val=1,
  414. bool visible=false);
  415. void set_item_focus(Fl_Tree_Item *item);
  416. Fl_Tree_Item *get_item_focus() const;
  417. int is_selected(Fl_Tree_Item *item) const;
  418. int is_selected(const char *path);
  419. /////////////////////////////////
  420. // Item attribute related methods
  421. /////////////////////////////////
  422. Fl_Font item_labelfont() const;
  423. void item_labelfont(Fl_Font val);
  424. Fl_Fontsize item_labelsize() const;
  425. void item_labelsize(Fl_Fontsize val);
  426. Fl_Color item_labelfgcolor(void) const;
  427. void item_labelfgcolor(Fl_Color val);
  428. Fl_Color item_labelbgcolor(void) const;
  429. void item_labelbgcolor(Fl_Color val);
  430. Fl_Color connectorcolor() const;
  431. void connectorcolor(Fl_Color val);
  432. int marginleft() const;
  433. void marginleft(int val);
  434. int margintop() const;
  435. void margintop(int val);
  436. int marginbottom() const;
  437. void marginbottom(int val);
  438. int linespacing() const;
  439. void linespacing(int val);
  440. int openchild_marginbottom() const;
  441. void openchild_marginbottom(int val);
  442. int usericonmarginleft() const;
  443. void usericonmarginleft(int val);
  444. int labelmarginleft() const;
  445. void labelmarginleft(int val);
  446. int widgetmarginleft() const;
  447. void widgetmarginleft(int val);
  448. int connectorwidth() const;
  449. void connectorwidth(int val);
  450. Fl_Image* usericon() const;
  451. void usericon(Fl_Image *val);
  452. Fl_Image* openicon() const;
  453. void openicon(Fl_Image *val);
  454. Fl_Image* closeicon() const;
  455. void closeicon(Fl_Image *val);
  456. int showcollapse() const;
  457. void showcollapse(int val);
  458. int showroot() const;
  459. void showroot(int val);
  460. Fl_Tree_Connector connectorstyle() const;
  461. void connectorstyle(Fl_Tree_Connector val);
  462. Fl_Tree_Sort sortorder() const;
  463. void sortorder(Fl_Tree_Sort val);
  464. Fl_Boxtype selectbox() const;
  465. void selectbox(Fl_Boxtype val);
  466. Fl_Tree_Select selectmode() const;
  467. void selectmode(Fl_Tree_Select val);
  468. Fl_Tree_Item_Reselect_Mode item_reselect_mode() const;
  469. void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode);
  470. Fl_Tree_Item_Draw_Mode item_draw_mode() const;
  471. void item_draw_mode(Fl_Tree_Item_Draw_Mode mode);
  472. void item_draw_mode(int mode);
  473. void calc_dimensions();
  474. void calc_tree();
  475. void recalc_tree();
  476. int displayed(Fl_Tree_Item *item);
  477. void show_item(Fl_Tree_Item *item, int yoff);
  478. void show_item(Fl_Tree_Item *item);
  479. void show_item_top(Fl_Tree_Item *item);
  480. void show_item_middle(Fl_Tree_Item *item);
  481. void show_item_bottom(Fl_Tree_Item *item);
  482. void display(Fl_Tree_Item *item);
  483. int vposition() const;
  484. void vposition(int pos);
  485. int hposition() const;
  486. void hposition(int pos);
  487. int is_scrollbar(Fl_Widget *w);
  488. int scrollbar_size() const;
  489. void scrollbar_size(int size);
  490. int is_vscroll_visible() const;
  491. int is_hscroll_visible() const;
  492. ///////////////////////
  493. // callback related
  494. ///////////////////////
  495. void callback_item(Fl_Tree_Item* item);
  496. Fl_Tree_Item* callback_item();
  497. void callback_reason(Fl_Tree_Reason reason);
  498. Fl_Tree_Reason callback_reason() const;
  499. /// Load FLTK preferences
  500. void load(class Fl_Preferences&);
  501. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Tree, Fl_Group)
  502. };
  503. #endif /*FL_TREE_H*/
  504. //
  505. // End of "$Id: Fl_Tree.H 11976 2016-09-24 23:15:48Z AlbrechtS $".
  506. //