nobody at rubyforge.org
2007-Apr-13 19:18 UTC
[Wxruby-development] [956] branches/wxruby2/wxwidgets_282: Additions to TreeCtrl API 2.6->2.8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[956] branches/wxruby2/wxwidgets_282: Additions to TreeCtrl API 2.6->2.8</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>956</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2007-04-13 15:18:00 -0400 (Fri, 13 Apr 2007)</dd> </dl> <h3>Log Message</h3> <pre>Additions to TreeCtrl API 2.6->2.8</pre> <h3>Modified Paths</h3> <ul> <li><a href="#brancheswxruby2wxwidgets_282doctextiletreectrltxtl">branches/wxruby2/wxwidgets_282/doc/textile/treectrl.txtl</a></li> <li><a href="#brancheswxruby2wxwidgets_282swigclassesincludewxTreeCtrlh">branches/wxruby2/wxwidgets_282/swig/classes/include/wxTreeCtrl.h</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="brancheswxruby2wxwidgets_282doctextiletreectrltxtl"></a> <div class="modfile"><h4>Modified: branches/wxruby2/wxwidgets_282/doc/textile/treectrl.txtl (955 => 956)</h4> <pre class="diff"><span> <span class="info">--- branches/wxruby2/wxwidgets_282/doc/textile/treectrl.txtl        2007-04-13 19:16:19 UTC (rev 955) +++ branches/wxruby2/wxwidgets_282/doc/textile/treectrl.txtl        2007-04-13 19:18:00 UTC (rev 956) </span><span class="lines">@@ -134,6 +134,8 @@ </span><span class="cx"> * "TreeCtrl#assign_image_list":#TreeCtrl_assignimagelist </span><span class="cx"> * "TreeCtrl#assign_state_image_list":#TreeCtrl_assignstateimagelist </span><span class="cx"> * "TreeCtrl#collapse":#TreeCtrl_collapse </span><ins>+* "TreeCtrl#collapse_all":#TreeCtrl_collapseall +* "TreeCtrl#collapse_all_children":#TreeCtrl_collapseallchildren </ins><span class="cx"> * "TreeCtrl#collapse_and_reset":#TreeCtrl_collapseandreset </span><span class="cx"> * "TreeCtrl#create":#TreeCtrl_create </span><span class="cx"> * "TreeCtrl#delete":#TreeCtrl_delete </span><span class="lines">@@ -143,6 +145,8 @@ </span><span class="cx"> * "TreeCtrl#end_edit_label":#TreeCtrl_endeditlabel </span><span class="cx"> * "TreeCtrl#ensure_visible":#TreeCtrl_ensurevisible </span><span class="cx"> * "TreeCtrl#expand":#TreeCtrl_expand </span><ins>+* "TreeCtrl#expand_all":#TreeCtrl_expandall +* "TreeCtrl#expand_all_children":#TreeCtrl_expandallchildren </ins><span class="cx"> * "TreeCtrl#get_bounding_rect":#TreeCtrl_getboundingrect </span><span class="cx"> * "TreeCtrl#get_buttons_image_list":#TreeCtrl_getbuttonsimagelist </span><span class="cx"> * "TreeCtrl#get_children_count":#TreeCtrl_getchildrencount </span><span class="lines">@@ -163,9 +167,9 @@ </span><span class="cx"> * "TreeCtrl#get_next_sibling":#TreeCtrl_getnextsibling </span><span class="cx"> * "TreeCtrl#get_next_visible":#TreeCtrl_getnextvisible </span><span class="cx"> * "TreeCtrl#get_item_parent":#TreeCtrl_getitemparent </span><del>-* "TreeCtrl#get_parent":#TreeCtrl_getparent </del><span class="cx"> * "TreeCtrl#get_prev_sibling":#TreeCtrl_getprevsibling </span><span class="cx"> * "TreeCtrl#get_prev_visible":#TreeCtrl_getprevvisible </span><ins>+* "TreeCtrl#get_quick_best_size":#TreeCtrl_getquickbestsize </ins><span class="cx"> * "TreeCtrl#get_root_item":#TreeCtrl_getrootitem </span><span class="cx"> * "TreeCtrl#get_item_selected_image":#TreeCtrl_getitemselectedimage </span><span class="cx"> * "TreeCtrl#get_selection":#TreeCtrl_getselection </span><span class="lines">@@ -175,6 +179,7 @@ </span><span class="cx"> * "TreeCtrl#insert_item":#TreeCtrl_insertitem </span><span class="cx"> * "TreeCtrl#insert_item_before":#TreeCtrl_insertitembefore </span><span class="cx"> * "TreeCtrl#is_bold":#TreeCtrl_isbold </span><ins>+* "TreeCtrl#is_empty":#TreeCtrl_isempty </ins><span class="cx"> * "TreeCtrl#is_expanded":#TreeCtrl_isexpanded </span><span class="cx"> * "TreeCtrl#is_selected":#TreeCtrl_isselected </span><span class="cx"> * "TreeCtrl#is_visible":#TreeCtrl_isvisible </span><span class="lines">@@ -196,6 +201,7 @@ </span><span class="cx"> * "TreeCtrl#set_item_selected_image":#TreeCtrl_setitemselectedimage </span><span class="cx"> * "TreeCtrl#set_item_text":#TreeCtrl_setitemtext </span><span class="cx"> * "TreeCtrl#set_item_text_colour":#TreeCtrl_setitemtextcolour </span><ins>+* "TreeCtrl#set_quick_best_size":#TreeCtrl_setquickbestsize </ins><span class="cx"> * "TreeCtrl#set_state_image_list":#TreeCtrl_setstateimagelist </span><span class="cx"> * "TreeCtrl#set_window_style":#TreeCtrl_setwindowstyle </span><span class="cx"> * "TreeCtrl#sort_children":#TreeCtrl_sortchildren </span><span class="lines">@@ -214,7 +220,7 @@ </span><span class="cx"> %(arg-type)Size% size = DEFAULT_SIZE, </span><span class="cx"> %(arg-type)Integer% style = TR_HAS_BUTTONS, </span><span class="cx"> %(arg-type)Validator% validator = DEFAULT_VALIDATOR, </span><del>- %(arg-type)String% name = "listCtrl") </del><ins>+ %(arg-type)String% name = "treeCtrl") </ins><span class="cx"> </span><span class="cx"> Constructor, creating and showing a tree control. </span><span class="cx"> </span><span class="lines">@@ -312,6 +318,28 @@ </span><span class="cx"> Collapses the given item. </span><span class="cx"> </span><span class="cx"> </span><ins>+h3(#TreeCtrl_collapseall). TreeCtrl#collapse_all + + *collapse_all*() + +Collapses the root item. + +h4. See also + +"expand_all":#TreeCtrl_expandall + + +h3(#TreeCtrl_collapseallchildren). TreeCtrl#collapse_all_children + + *collapse_all_children*(%(arg-type)TreeItemId% item) + +Collapses this item and all of its children, recursively. + +h4. See also + +"expand_all_children":#TreeCtrl_expandallchildren + + </ins><span class="cx"> h3(#TreeCtrl_collapseandreset). TreeCtrl#collapse_and_reset </span><span class="cx"> </span><span class="cx"> *collapse_and_reset*(%(arg-type)TreeItemId% item) </span><span class="lines">@@ -326,7 +354,7 @@ </span><span class="cx"> %(arg-type)Size% size = DEFAULT_SIZE, </span><span class="cx"> %(arg-type)Integer% style = TR_HAS_BUTTONS, </span><span class="cx"> %(arg-type)Validator% validator = DEFAULT_VALIDATOR, </span><del>- %(arg-type)String% name = "listCtrl") </del><ins>+ %(arg-type)String% name = "treeCtrl") </ins><span class="cx"> </span><span class="cx"> Creates the tree control. See "TreeCtrl.new":treectrl.html#TreeCtrl_new for further details. </span><span class="cx"> </span><span class="lines">@@ -345,7 +373,7 @@ </span><span class="cx"> </span><span class="cx"> *delete_all_items*() </span><span class="cx"> </span><del>-Deletes all the items in the control. Note that this may not generate </del><ins>+Deletes all items in the control. Note that this may not generate </ins><span class="cx"> @EVT_TREE_DELETE_ITEM@ events under some Windows versions although </span><span class="cx"> normally such event is generated for each removed item. </span><span class="cx"> </span><span class="lines">@@ -355,7 +383,7 @@ </span><span class="cx"> *delete_children*(%(arg-type)TreeItemId% item) </span><span class="cx"> </span><span class="cx"> Deletes all children of the given item (but not the item itself). Note that </span><del>-this will *not* generate any events unlike </del><ins>+this will *not* generate any events unlike </ins><span class="cx"> "Delete":treectrldelete.html method. </span><span class="cx"> </span><span class="cx"> If you have called "TreeCtrl#set_item_has_children":treectrl.html#TreeCtrl_setitemhaschildren, you </span><span class="lines">@@ -408,6 +436,20 @@ </span><span class="cx"> Expands the given item. </span><span class="cx"> </span><span class="cx"> </span><ins>+h3(#TreeCtrl_expandall). TreeCtrl#expand_all + + *expand_all*() + +Expands all items in the tree. + + +h3(#TreeCtrl_expandallchildren). TreeCtrl#expand_all_children + + *expand_all_children*(%(arg-type)TreeItemId% item) + +Expands the given item and all its children recursively. + + </ins><span class="cx"> h3(#TreeCtrl_getitemrect). TreeCtrl#get_bounding_rect </span><span class="cx"> </span><span class="cx"> Boolean *get_bounding_rect*(%(arg-type)TreeItemId% item, %(arg-type)Rect% rect, </span><span class="lines">@@ -418,14 +460,18 @@ </span><span class="cx"> item''s image is also taken into account. </span><span class="cx"> </span><span class="cx"> The return value is @true@ if the rectangle was successfully retrieved or @false@ </span><del>-if it was not (in this case _rect_ is not changed) - for example, if the </del><ins>+if it was not (in this case _rect_ is not changed) -- for example, if the </ins><span class="cx"> item is currently invisible. </span><span class="cx"> </span><ins>+Notice that the rectangle coordinates are logical, not physical ones. So, for +example, the x coordinate may be negative if the tree has a horizontal +scrollbar and its position is not $0$. </ins><span class="cx"> </span><span class="cx"> </span><span class="cx"> </span><span class="cx"> </span><span class="cx"> </span><ins>+ </ins><span class="cx"> h3(#TreeCtrl_getbuttonsimagelist). TreeCtrl#get_buttons_image_list </span><span class="cx"> </span><span class="cx"> "ImageList":imagelist.html *get_buttons_image_list*() </span><span class="lines">@@ -437,7 +483,8 @@ </span><span class="cx"> </span><span class="cx"> h3(#TreeCtrl_getchildrencount). TreeCtrl#get_children_count </span><span class="cx"> </span><del>- size_t *get_children_count*(%(arg-type)TreeItemId% item, %(arg-type)Boolean% recursively = @true@) </del><ins>+ unsigned int *get_children_count*(%(arg-type)TreeItemId% item, + %(arg-type)Boolean% recursively = @true@) </ins><span class="cx"> </span><span class="cx"> Returns the number of items in the branch. If _recursively_ is @true@, returns the total number </span><span class="cx"> of descendants, otherwise only one level of children is counted. </span><span class="lines">@@ -445,7 +492,7 @@ </span><span class="cx"> </span><span class="cx"> h3(#TreeCtrl_getcount). TreeCtrl#get_count </span><span class="cx"> </span><del>- Integer *get_count*() </del><ins>+ unsigned int *get_count*() </ins><span class="cx"> </span><span class="cx"> Returns the number of items in the control. </span><span class="cx"> </span><span class="lines">@@ -624,18 +671,6 @@ </span><span class="cx"> Returns the item''s parent. </span><span class="cx"> </span><span class="cx"> </span><del>-h3(#TreeCtrl_getparent). TreeCtrl#get_parent - - "TreeItemId":treeitemid.html *get_parent*(%(arg-type)TreeItemId% item) - -*NOTE:* This function is deprecated and will only work if @WXWIN_COMPATIBILITY_2_2@ -is defined. Use "TreeCtrl#get_item_parent":treectrl.html#TreeCtrl_getitemparent instead. - -Returns the item''s parent. - - - - </del><span class="cx"> h3(#TreeCtrl_getprevsibling). TreeCtrl#get_prev_sibling </span><span class="cx"> </span><span class="cx"> "TreeItemId":treeitemid.html *get_prev_sibling*(%(arg-type)TreeItemId% item) </span><span class="lines">@@ -656,6 +691,18 @@ </span><span class="cx"> Returns the previous visible item. </span><span class="cx"> </span><span class="cx"> </span><ins>+h3(#TreeCtrl_getquickbestsize). TreeCtrl#get_quick_best_size + + Boolean *get_quick_best_size*() + +Returns true if the control will use a quick calculation for the best size, +looking only at the first and last items. The default is false. + +h4. See also + +"TreeCtrl#set_quick_best_size":treectrl.html#TreeCtrl_setquickbestsize + + </ins><span class="cx"> h3(#TreeCtrl_getrootitem). TreeCtrl#get_root_item </span><span class="cx"> </span><span class="cx"> "TreeItemId":treeitemid.html *get_root_item*() </span><span class="lines">@@ -683,7 +730,7 @@ </span><span class="cx"> </span><span class="cx"> h3(#TreeCtrl_getselections). TreeCtrl#get_selections </span><span class="cx"> </span><del>- size_t *get_selections*(%(arg-type)ArrayTreeItemIds% selection) </del><ins>+ unsigned int *get_selections*(%(arg-type)ArrayTreeItemIds% selection) </ins><span class="cx"> </span><span class="cx"> Fills the array of tree items passed in with the currently selected items. This </span><span class="cx"> function can be called only if the control has the TR_MULTIPLE style. </span><span class="lines">@@ -767,6 +814,13 @@ </span><span class="cx"> See also: "set_item_bold":#TreeCtrl_setitembold </span><span class="cx"> </span><span class="cx"> </span><ins>+h3(#TreeCtrl_isempty). TreeCtrl#is_empty + + Boolean *is_empty*() + +Returns if the control is empty (i.e. has no items, even no root one). + + </ins><span class="cx"> h3(#TreeCtrl_isexpanded). TreeCtrl#is_expanded </span><span class="cx"> </span><span class="cx"> Boolean *is_expanded*(%(arg-type)TreeItemId% item) </span><span class="lines">@@ -804,7 +858,12 @@ </span><span class="cx"> positive value if the first item is less than, equal to or greater than the </span><span class="cx"> second one. </span><span class="cx"> </span><del>-The base class version compares items alphabetically. </del><ins>+Please note that you must use RTTI macros +"DECLARE_DYNAMIC_CLASS":declaredynamicclass.html and +"IMPLEMENT_DYNAMIC_CLASS":implementdynamicclass.html if you override this +function because otherwise the base class considers that it is not overridden +and uses the default comparison, i.e. sorts the items alphabetically, which +allows it optimize away the calls to the virtual function completely. </ins><span class="cx"> </span><span class="cx"> See also: "sort_children":#TreeCtrl_sortchildren </span><span class="cx"> </span><span class="lines">@@ -834,7 +893,7 @@ </span><span class="cx"> </span><span class="cx"> h3(#TreeCtrl_selectitem). TreeCtrl#select_item </span><span class="cx"> </span><del>- Boolean *select_item*(%(arg-type)TreeItemId% item, %(arg-type)Boolean% select = ) </del><ins>+ *select_item*(%(arg-type)TreeItemId% item, %(arg-type)Boolean% select = ) </ins><span class="cx"> </span><span class="cx"> Selects the given item. In multiple selection controls, can be also used to </span><span class="cx"> deselect a currently selected item if the value of select is false. </span><span class="lines">@@ -962,6 +1021,19 @@ </span><span class="cx"> Sets the colour of the item''s text. </span><span class="cx"> </span><span class="cx"> </span><ins>+h3(#TreeCtrl_setquickbestsize). TreeCtrl#set_quick_best_size + + *set_quick_best_size*(%(arg-type)Boolean% quickBestSize) + +If true is passed, specifies that the control will use a quick calculation for the best size, +looking only at the first and last items. Otherwise, it will look at all items. +The default is false. + +h4. See also + +"TreeCtrl#get_quick_best_size":treectrl.html#TreeCtrl_getquickbestsize + + </ins><span class="cx"> h3(#TreeCtrl_setstateimagelist). TreeCtrl#set_state_image_list </span><span class="cx"> </span><span class="cx"> *set_state_image_list*(%(arg-type)ImageList% imageList) </span><span class="lines">@@ -1032,3 +1104,8 @@ </span><span class="cx"> Unselects the given item. This works in multiselection controls only. </span><span class="cx"> </span><span class="cx"> </span><ins>+ + + + + </ins></span></pre></div> <a id="brancheswxruby2wxwidgets_282swigclassesincludewxTreeCtrlh"></a> <div class="modfile"><h4>Modified: branches/wxruby2/wxwidgets_282/swig/classes/include/wxTreeCtrl.h (955 => 956)</h4> <pre class="diff"><span> <span class="info">--- branches/wxruby2/wxwidgets_282/swig/classes/include/wxTreeCtrl.h        2007-04-13 19:16:19 UTC (rev 955) +++ branches/wxruby2/wxwidgets_282/swig/classes/include/wxTreeCtrl.h        2007-04-13 19:18:00 UTC (rev 956) </span><span class="lines">@@ -1,4 +1,4 @@ </span><del>-// Copyright 2006 by Kevin Smith </del><ins>+// Copyright 2006 - 2007 by Kevin Smith </ins><span class="cx"> // released under the MIT-style wxruby2 license </span><span class="cx"> </span><span class="cx"> #if !defined(_wxTreeCtrl_h_) </span><span class="lines">@@ -148,6 +148,7 @@ </span><span class="cx"> // is item text in bold font? </span><span class="cx"> bool IsBold(const wxTreeItemId& item) const; </span><span class="cx"> // does the layout include space for a button? </span><ins>+        bool IsEmpty() const; </ins><span class="cx"> </span><span class="cx"> // number of children </span><span class="cx"> // ------------------ </span><span class="lines">@@ -174,14 +175,7 @@ </span><span class="cx"> // get the parent of this item (may return NULL if root) </span><span class="cx"> wxTreeItemId GetItemParent(const wxTreeItemId& item) const; </span><span class="cx"> </span><del>-#if WXWIN_COMPATIBILITY_2_2 - // deprecated: Use GetItemParent instead. - wxTreeItemId GetParent(const wxTreeItemId& item) const; </del><span class="cx"> </span><del>- // Expose the base class method hidden by the one above. Not deprecatable. - wxWindow *GetParent() const; -#endif // WXWIN_COMPATIBILITY_2_2 - </del><span class="cx"> // for this enumeration function you must pass in a "cookie" parameter </span><span class="cx"> // which is opaque for the application but is necessary for the library </span><span class="cx"> // to make these functions reentrant (i.e. allow more than one </span><span class="lines">@@ -257,11 +251,15 @@ </span><span class="cx"> // NB: this won''t send wxEVT_COMMAND_TREE_ITEM_DELETED events </span><span class="cx"> void DeleteAllItems(); </span><span class="cx"> </span><del>- // expand this item </del><span class="cx"> void Expand(const wxTreeItemId& item); </span><ins>+        void ExpandAll(); +        void ExpandAllChildren(const wxTreeItemId& item); </ins><span class="cx"> </span><del>- // collapse the item without removing its children </del><ins>+ </ins><span class="cx"> void Collapse(const wxTreeItemId& item); </span><ins>+        void CollapseAll(); +        void CollapseAllChildren(const wxTreeItemId& item); + </ins><span class="cx"> // collapse the item and remove all children </span><span class="cx"> void CollapseAndReset(const wxTreeItemId& item); </span><span class="cx"> // toggles the current state </span><span class="lines">@@ -305,6 +303,9 @@ </span><span class="cx"> // be edited simultaneously) </span><span class="cx"> wxTextCtrl* GetEditControl() const; </span><span class="cx"> </span><ins>+        bool GetQuickBestSize() const; +        void SetQuickBestSize(bool quickBestSize); + </ins><span class="cx"> // sorting </span><span class="cx"> // this function is called to compare 2 items and should return -1, 0 </span><span class="cx"> // or +1 if the first item is less than, equal to or greater than the </span><span class="lines">@@ -366,8 +367,7 @@ </span><span class="cx"> // Only for internal use right now, but should probably be public </span><span class="cx"> wxTreeItemId GetNext(const wxTreeItemId& item) const; </span><span class="cx">         bool HasChildren(const wxTreeItemId& item) const; </span><del>- void ExpandAll(); - void ExpandAllChildren(const wxTreeItemId& item);         </del><ins>+ </ins><span class="cx"> void AdjustMyScrollbars(); </span><span class="cx"> void Edit( const wxTreeItemId& item ); </span><span class="cx"> void OnSetFocus( wxFocusEvent &event ); </span></span></pre> </div> </div> </body> </html>
Possibly Parallel Threads
- [831] trunk/wxruby2: Use simple ruby Integers to represent TreeItemIds
- [888] branches/wxruby2/wxwidgets_282/swig/shared/treeitemid_typemaps.i: Fix compile warning for TreeItemId typemap (Artur Kuptel)
- [779] trunk/wxruby2: Added TreeCtrl#traverse method and documentation
- [799] trunk/wxruby2: Fixed TreeItemId == method
- [797] trunk/wxruby2/swig/classes/TreeCtrl.i: Traverse method moved to wxSugar