X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fabb57533169f2f75367e0d120c762518548890..0180dad680ecbe4cb5cf8e6e45ce569f7a1029f7:/docs/latex/wx/treectrl.tex

diff --git a/docs/latex/wx/treectrl.tex b/docs/latex/wx/treectrl.tex
index c831025d97..ceb31a10d8 100644
--- a/docs/latex/wx/treectrl.tex
+++ b/docs/latex/wx/treectrl.tex
@@ -12,6 +12,10 @@ To intercept events from a tree control, use the event table macros described in
 \helpref{wxEvtHandler}{wxevthandler}\\
 \helpref{wxObject}{wxobject}
 
+\wxheading{Include files}
+
+<wx/treectrl.h>
+
 \wxheading{Window styles}
 
 \twocolwidtha{5cm}
@@ -186,9 +190,15 @@ Expands the given item.
 
 \membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect}
 
-\constfunc{void}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = FALSE}}
+\constfunc{bool}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = FALSE}}
+
+Retrieves the rectangle bounding the {\it item}. If {\it textOnly} is TRUE,
+only the rectangle around the items label will be returned, otherwise the
+items image is also taken into account.
 
-Returns the position and size of the rectangle bounding the item.
+The return value is TRUE if the rectangle was successfully retrieved or FALSE
+if it was not (in this case {\it rect} is not changed) - for example, if the
+item is currently invisible.
 
 \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount}
 
@@ -221,12 +231,15 @@ to make these functions reentrant (i.e. allow more than one
 enumeration on one and the same object simultaneously). The cookie passed to
 GetFirstChild and GetNextChild should be the same.
 
-Returns 0 if there are no further children.
+Returns an invalid tree item if there are no further children.
 
 \wxheading{See also}
 
 \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild}
 
+\pythonnote{In wxPython the returned wxTreeItemId and the new cookie
+value are both returned as a tuple containing the two values.}
+
 \membersection{wxTreeCtrl::GetFirstVisibleItem}\label{wxtreectrlgetfirstvisibleitem}
 
 \constfunc{wxTreeItemId}{GetFirstVisibleItem}{\void}
@@ -262,6 +275,13 @@ Returns the tree item data associated with the item.
 
 \helpref{wxTreeItemData}{wxtreeitemdata}
 
+\pythonnote{wxPython provides the following shortcut method:\par
+\indented{2cm}{\begin{twocollist}
+\twocolitem{\bf{GetPyData(item)}}{Returns the Python Object
+associated with the wxTreeItemData for the given item Id.}
+\end{twocollist}}
+}
+
 \membersection{wxTreeCtrl::GetItemImage}\label{wxtreectrlgetitemimage}
 
 \constfunc{int}{GetItemImage}{\param{const wxTreeItemId\& }{item}}
@@ -274,6 +294,17 @@ Gets the normal item image.
 
 Returns the item label.
 
+\membersection{wxTreeCtrl::GetLastChild}\label{wxtreectrlgetlastchild}
+
+\constfunc{wxTreeItemId}{GetLastChild}{\param{const wxTreeItemId\&}{ item}}
+
+Returns the last child of the item (or an invalid tree item if this item has no children).
+
+\wxheading{See also}
+
+\helpref{GetFirstChild}{wxtreectrlgetfirstchild},
+\helpref{GetLastChild}{wxtreectrlgetlastchild}
+
 \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild}
 
 \constfunc{wxTreeItemId}{GetNextChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}}
@@ -286,19 +317,22 @@ to make these functions reentrant (i.e. allow more than one
 enumeration on one and the same object simultaneously). The cookie passed to
 GetFirstChild and GetNextChild should be the same.
 
-Returns 0 if there are no further children.
+Returns an invalid tree item if there are no further children.
 
 \wxheading{See also}
 
 \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild}
 
+\pythonnote{In wxPython the returned wxTreeItemId and the new cookie
+value are both returned as a tuple containing the two values.}
+
 \membersection{wxTreeCtrl::GetNextSibling}\label{wxtreectrlgetnextsibling}
 
 \constfunc{wxTreeItemId}{GetNextSibling}{\param{const wxTreeItemId\&}{ item}}
 
 Returns the next sibling of the specified item; call \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} for the previous sibling.
 
-Returns 0 if there are no further siblings.
+Returns an invalid tree item if there are no further siblings.
 
 \wxheading{See also}
 
@@ -322,7 +356,7 @@ Returns the item's parent.
 
 Returns the previous sibling of the specified item; call \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} for the next sibling.
 
-Returns 0 if there are no further children.
+Returns an invalid tree item if there are no further children.
 
 \wxheading{See also}
 
@@ -340,9 +374,9 @@ Returns the previous visible item.
 
 Returns the root item for the tree control.
 
-\membersection{wxTreeCtrl::GetSelectedItemImage}\label{wxtreectrlgetselecteditemimage}
+\membersection{wxTreeCtrl::GetItemSelectedImage}\label{wxtreectrlgetitemselectedimage}
 
-\constfunc{int}{GetSelectedItemImage}{\param{const wxTreeItemId\& }{item}}
+\constfunc{int}{GetItemSelectedImage}{\param{const wxTreeItemId\& }{item}}
 
 Gets the selected item image.
 
@@ -350,7 +384,7 @@ Gets the selected item image.
 
 \constfunc{wxTreeItemId}{GetSelection}{\void}
 
-Returns the selection, or 0 if there is no selection.
+Returns the selection, or an invalid item if there is no selection.
 
 \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest}
 
@@ -384,6 +418,14 @@ Inserts an item after a given one.
 If {\it image} > -1 and {\it selImage} is -1, the same image is used for
 both selected and unselected items.
 
+\membersection{wxTreeCtrl::IsBold}\label{wxtreectrlisbold}
+
+\constfunc{bool}{IsBold}{\param{const wxTreeItemId\& }{item}}
+
+Returns TRUE if the given item is in bold state.
+
+See also: \helpref{SetItemBold}{wxtreectrlsetitembold}
+
 \membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded}
 
 \constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}}
@@ -408,6 +450,19 @@ Returns TRUE if the item is visible (it might be outside the view, or not expand
 
 Returns TRUE if the item has children.
 
+\membersection{wxTreeCtrl::OnCompareItems}\label{wxtreectrloncompareitems}
+
+\func{int}{OnCompareItems}{\param{const wxTreeItemId\& }{item1}, \param{const wxTreeItemId\& }{item2}}
+
+Override this function in the derived class to change the sort order of the
+items in the tree control. The function should return a negative, zero or
+positive value if the first item is less than, equal to or greater than the
+second one.
+
+The base class version compares items alphabetically.
+
+See also: \helpref{SortChildren}{wxtreectrlsortchildren}
+
 \membersection{wxTreeCtrl::PrependItem}\label{wxtreectrlprependitem}
 
 \func{wxTreeItemId}{PrependItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text},
@@ -443,12 +498,28 @@ Sets the indentation for the tree control.
 Sets the image list. {\it which} should be one of wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL and
 wxIMAGE\_LIST\_STATE.
 
+\membersection{wxTreeCtrl::SetItemBold}\label{wxtreectrlsetitembold}
+
+\func{void}{SetItemBold}{\param{const wxTreeItemId\& }{item}, \param{bool}{ bold = TRUE}}
+
+Makes item appear in bold font if {\it bold} parameter is TRUE or resets it to
+the normal state.
+
+See also: \helpref{IsBold}{wxtreectrlisbold}
+
 \membersection{wxTreeCtrl::SetItemData}\label{wxtreectrlsetitemdata}
 
 \func{void}{SetItemData}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemData* }{data}}
 
 Sets the item client data.
 
+\pythonnote{wxPython provides the following shortcut method:\par
+\indented{2cm}{\begin{twocollist}
+\twocolitem{\bf{SetPyData(item, obj)}}{Associate the given Python
+Object with the wxTreeItemData for the given item Id.}
+\end{twocollist}}
+}
+
 \membersection{wxTreeCtrl::SetItemHasChildren}\label{wxtreectrlsetitemhaschildren}
 
 \func{void}{SetItemHasChildren}{\param{const wxTreeItemId\&}{ item}, \param{bool }{hasChildren = TRUE}}
@@ -478,24 +549,16 @@ Sets the item label.
 
 \membersection{wxTreeCtrl::SortChildren}\label{wxtreectrlsortchildren}
 
-\func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemCmpFunc*}{ cmpFunction = NULL}}
-
-Sorts the children of the given item. If {\it cmpFunction} is NULL, sorts in ascending alphabetical order;
-otherwise the custom sort function is used, as follows:
+\func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}}
 
-{\small
-\begin{verbatim}
-// a callback function used for sorting tree items, it should return -1 if the
-// first item precedes the second, +1 if the second precedes the first or 0 if
-// they're equivalent
-class wxTreeItemData;
-typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2);
-\end{verbatim}
-}
+Sorts the children of the given item using
+\helpref{OnCompareItems}{wxtreectrloncompareitems} method of wxTreeCtrl. You
+should override that method to change the sort order (default is ascending
+alphabetical order).
 
 \wxheading{See also}
 
-\helpref{wxTreeItemData}{wxtreeitemdata}
+\helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{OnCompareItems}{wxtreectrloncompareitems}
 
 \membersection{wxTreeCtrl::Toggle}\label{wxtreectrltoggle}
 
@@ -527,6 +590,10 @@ always be allocated on the heap.
 
 wxTreeItemId
 
+\wxheading{Include files}
+
+<wx/treectrl.h>
+
 \wxheading{See also}
 
 \helpref{wxTreeCtrl}{wxtreectrl}
@@ -539,6 +606,21 @@ wxTreeItemId
 
 Default constructor.
 
+\pythonnote{The wxPython version of this constructor optionally
+accepts any Python object as a parameter.  This object is then
+associated with the tree item using the wxTreeItemData as a
+container.
+
+In addition, the following methods are added in wxPython for accessing
+the object:\par
+\indented{2cm}{\begin{twocollist}
+\twocolitem{\bf{GetData()}}{Returns a reference to the Python Object}
+\twocolitem{\bf{SetData(obj)}}{Associates a new Python Object with the
+wxTreeItemData}
+\end{twocollist}}
+}
+
+
 \membersection{wxTreeItemData::\destruct{wxTreeItemData}}
 
 \func{void}{\destruct{wxTreeItemData}}{\void}
