summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2014-01-23 21:05:17 +0000
committerGreg Ercolano <erco@seriss.com>2014-01-23 21:05:17 +0000
commita41a41583fbb1c0e2b4f185409794b45752000aa (patch)
treec005a529d2b8f01afa302962a3fe6351a41486cf
parent4eee9f1f63fa81e64c15e0659231475a0c2d6ce7 (diff)
Added some code examples to docs for
Fl_Tree::insert() Fl_Tree::insert_above() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10079 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Tree.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx
index f701117b6..143e4848b 100644
--- a/src/Fl_Tree.cxx
+++ b/src/Fl_Tree.cxx
@@ -955,9 +955,21 @@ Fl_Tree_Item* Fl_Tree::add(Fl_Tree_Item *parent_item, const char *name) {
}
/// Inserts a new item \p 'name' above the specified Fl_Tree_Item \p 'above'.
+/// Example:
+/// \code
+/// tree->add("Aaa/000"); // "000" is index 0 in Aaa's children
+/// tree->add("Aaa/111"); // "111" is index 1 in Aaa's children
+/// tree->add("Aaa/222"); // "222" is index 2 in Aaa's children
+/// ..
+/// // How to insert an item between items Aaa/111 and Aaa/222
+/// Fl_Tree_Item *item = tree->find_item("Aaa/222"); // get item Aaa/222
+/// if (item) tree->insert_above(item, "New item"); // insert new item above it
+/// \endcode
+///
/// \param[in] above -- the item above which to insert the new item. Must not be NULL.
/// \param[in] name -- the name of the new item
/// \returns The new item added, or 0 if 'above' could not be found.
+/// \see insert()
///
Fl_Tree_Item* Fl_Tree::insert_above(Fl_Tree_Item *above, const char *name) {
return(above->insert_above(_prefs, name));
@@ -965,10 +977,22 @@ Fl_Tree_Item* Fl_Tree::insert_above(Fl_Tree_Item *above, const char *name) {
/// Insert a new item \p 'name' into \p 'item's children at position \p 'pos'.
///
+/// Example:
+/// \code
+/// tree->add("Aaa/000"); // "000" is index 0 in Aaa's children
+/// tree->add("Aaa/111"); // "111" is index 1 in Aaa's children
+/// tree->add("Aaa/222"); // "222" is index 2 in Aaa's children
+/// ..
+/// // How to insert an item between items Aaa/111 and Aaa/222
+/// Fl_Tree_Item *item = tree->find_item("Aaa"); // get parent item Aaa
+/// if (item) tree->insert(item, "New item", 2); // insert as a child of Aaa at index #2
+/// \endcode
+///
/// \param[in] item The existing item to insert new child into. Must not be NULL.
/// \param[in] name The label for the new item
/// \param[in] pos The position of the new item in the child list
/// \returns The new item added.
+/// \see insert_above()
///
Fl_Tree_Item* Fl_Tree::insert(Fl_Tree_Item *item, const char *name, int pos) {
return(item->insert(_prefs, name, pos));