X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70b62288b46265f1724ff94c3f6a7dc243a319d9..b0ee47ff76c278c053ac2ad36bb3129b0fcd050f:/docs/latex/wx/listctrl.tex diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index 267a44e972..783a2ffaf7 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -2,8 +2,21 @@ A list control presents lists in a number of formats: list view, report view, icon view and small icon view. In any case, elements are numbered from zero. - -Using many of wxListCtrl is shown in the +For all these modes, the items are stored in the control and must be added to +it using \helpref{InsertItem}{wxlistctrlinsertitem} method. + +A special case of report view quite different from the other modes of the list +control is a virtual control in which the items data (including text, images +and attributes) is managed by the main program and is requested by the control +itself only when needed which allows to have controls with millions of items +without consuming much memory. To use virtual list control you must use +\helpref{SetItemCount}{wxlistctrlsetitemcount} first and overload at least +\helpref{OnGetItemText}{wxlistctrlongetitemtext} (and optionally +\helpref{OnGetItemImage}{wxlistctrlongetitemimage} and +\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}) to return the information +about the items when the control requests it. + +Using many of wxListCtrl features is shown in the \helpref{corresponding sample}{samplelistctrl}. To intercept events from a list control, use the event table macros described @@ -22,12 +35,13 @@ in \helpref{wxListEvent}{wxlistevent}. \wxheading{Window styles} -\twocolwidtha{5cm} +\twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxLC\_LIST}}{multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in wxLC\_REPORT. In other words, the list wraps, unlike a wxListBox.} \twocolitem{\windowstyle{wxLC\_REPORT}}{single or multicolumn report view, with optional header.} +\twocolitem{\windowstyle{wxLC\_VIRTUAL}}{virtual control, may only be used with wxLC\_REPORT} \twocolitem{\windowstyle{wxLC\_ICON}}{Large icon view, with optional labels.} \twocolitem{\windowstyle{wxLC\_SMALL\_ICON}}{Small icon view, with optional labels.} \twocolitem{\windowstyle{wxLC\_ALIGN\_TOP}}{Icons align to the top. Win32 default, Win32 only. } @@ -67,6 +81,7 @@ functions that take a \helpref{wxListEvent}{wxlistevent} argument. \twocolitem{{\bf EVT\_LIST\_INSERT\_ITEM(id, func)}}{An item has been inserted.} \twocolitem{{\bf EVT\_LIST\_COL\_CLICK(id, func)}}{A column ({\bf m\_col}) has been left-clicked.} \twocolitem{{\bf EVT\_LIST\_ITEM\_RIGHT\_CLICK(id, func)}}{An item has been right-clicked.} +\twocolitem{{\bf EVT\_LIST\_CACHE\_HINT(id, func)}}{Prepare cache for a virtual list control} \end{twocollist}% \wxheading{See also} @@ -148,15 +163,6 @@ wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL, wxIMAGE\_LIST\_STATE (the last is u Deletes all items and all columns. -\membersection{wxListCtrl::DeleteItem}\label{wxlistctrldeleteitem} - -\func{bool}{DeleteItem}{\param{long }{item}} - -Deletes the specified item. This function sends the -{\tt wxEVT\_COMMAND\_LIST\_DELETE\_ITEM} event for the item being deleted. - -See also: \helpref{DeleteAllItems}{wxlistctrldeleteallitems} - \membersection{wxListCtrl::Create}\label{wxlistctrlcreate} \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp @@ -181,6 +187,15 @@ from the control would be too slow then (unlike \helpref{DeleteItem}{wxlistctrld Deletes a column. +\membersection{wxListCtrl::DeleteItem}\label{wxlistctrldeleteitem} + +\func{bool}{DeleteItem}{\param{long }{item}} + +Deletes the specified item. This function sends the +{\tt wxEVT\_COMMAND\_LIST\_DELETE\_ITEM} event for the item being deleted. + +See also: \helpref{DeleteAllItems}{wxlistctrldeleteallitems} + \membersection{wxListCtrl::EditLabel}\label{wxlistctrledit} \func{void}{EditLabel}{\param{long }{item}} @@ -225,6 +240,15 @@ implements the following methods:\par \end{twocollist}} } +\perlnote{In wxPerl there are three methods instead of a single overloaded +method:\par +\indented{2cm}{\begin{twocollist} +\twocolitem{{\bf FindItem( start, str, partial = FALSE ) }}{} +\twocolitem{{\bf FindItemData( start, data ) }}{} +\twocolitem{{\bf FindItemAtPos( start, point, direction )}}{} +\end{twocollist} +}} + \membersection{wxListCtrl::GetColumn}\label{wxlistctrlgetcolumn} \constfunc{bool}{GetColumn}{\param{int }{col}, \param{wxListItem\& }{item}} @@ -232,6 +256,9 @@ implements the following methods:\par Gets information about this column. See \helpref{wxListCtrl::SetItem}{wxlistctrlsetitem} for more information. +\perlnote{In wxPerl this method takes only the {\bf col} parameter and + returns a Wx::ListItem ( or undef ).} + \membersection{wxListCtrl::GetColumnWidth}\label{wxlistctrlgetcolumnwidth} \constfunc{int}{GetColumnWidth}{\param{int }{col}} @@ -273,12 +300,15 @@ Returns the specified image list. {\it which} may be one of: Gets information about the item. See \helpref{wxListCtrl::SetItem}{wxlistctrlsetitem} for more information. -You must call {\it info.SetId()} to se ID of item you're interested in +You must call {\it info.SetId()} to the ID of item you're interested in before calling this method. \pythonnote{The wxPython version of this method takes an integer parameter for the item ID, an optional integer for the column number, and -returns the wxListItem object. } +returns the wxListItem object.} + +\perlnote{In wxPerl this method takes as parameter the {\bf ID} of the item +and ( optionally ) the column, and returns a Wx::ListItem object.} \membersection{wxListCtrl::GetItemCount}\label{wxlistctrlgetitemcount} @@ -301,6 +331,9 @@ Returns the position of the item, in icon or small icon view. \pythonnote{The wxPython version of this method accepts only the item ID and returns the wxPoint.} +\perlnote{In wxPerl this method takes only the {\bf item} parameter and +returns a Wx::Point ( or undef ).} + \membersection{wxListCtrl::GetItemRect}\label{wxlistctrlgetitemrect} \constfunc{bool}{GetItemRect}{\param{long }{item}, \param{wxRect\& }{rect}, \param{int }{code = wxLIST\_RECT\_BOUNDS}} @@ -312,6 +345,9 @@ Returns the rectangle representing the item's size and position, in client coord \pythonnote{The wxPython version of this method accepts only the item ID and code and returns the wxRect.} +\perlnote{In wxPerl this method takes only the {\bf item} parameter and +retutrns a Wx::Rect ( or undef ).} + \membersection{wxListCtrl::GetItemSpacing}\label{wxlistctrlgetitemspacing} \constfunc{int}{GetItemSpacing}{\param{bool }{isSmall}} @@ -432,6 +468,9 @@ wxLIST\_HITTEST\_ONITEMSTATEICON.} this method. The first value is the item id and the second is the flags value mentioned above.} +\perlnote{In wxPerl this method only takes the {\bf point} parameter + and returns a 2-element list ( item, flags ).} + \membersection{wxListCtrl::InsertColumn}\label{wxlistctrlinsertcolumn} \func{long}{InsertColumn}{\param{long }{col}, \param{wxListItem\& }{info}} @@ -492,6 +531,62 @@ implements the following methods:\par \end{twocollist}} } +\perlnote{In wxPerl there are four methods instead of a single overloaded +method:\par +\indented{2cm}{\begin{twocollist} +\twocolitem{{\bf InsertItem( item )}}{Inserts a Wx::ListItem} +\twocolitem{{\bf InsertStringItem( index, label )}}{Inserts a string item} +\twocolitem{{\bf InsertImageItem( index, imageIndex )}}{Inserts an image item} +\twocolitem{{\bf InsertImageStringItem( index, label, imageIndex )}}{Inserts + an item with a string and an image} +\end{twocollist} +}} + +\membersection{wxListCtrl::OnGetItemAttr}\label{wxlistctrlongetitemattr} + +\func{virtual wxString}{OnGetItemAttr}{\param{long }{item}} + +This function may be overloaded in the derived class for a control with +{\tt wxLC\_VIRTUAL} style. It should return the attribute for the +for the specified {\tt item} or {\tt NULL} to use the default appearance +parameters. + +The base class version always returns {\tt NULL}. + +\wxheading{See also} + +\helpref{OnGetItemImage}{wxlistctrlongetitemimage},\\ +\helpref{OnGetItemText}{wxlistctrlongetitemtext} + +\membersection{wxListCtrl::OnGetItemImage}\label{wxlistctrlongetitemimage} + +\func{virtual wxString}{OnGetItemImage}{\param{long }{item}} + +This function may be overloaded in the derived class for a control with +{\tt wxLC\_VIRTUAL} style. It should return the index of the items image in the +controls image list or $-1$ for no image. + +The base class version always returns $-1$. + +\wxheading{See also} + +\helpref{OnGetItemText}{wxlistctrlongetitemtext},\\ +\helpref{OnGetItemAttr}{wxlistctrlongetitemattr} + +\membersection{wxListCtrl::OnGetItemText}\label{wxlistctrlongetitemtext} + +\func{virtual wxString}{OnGetItemText}{\param{long }{item}, \param{long }{column}} + +This function {\bf must} be overloaded in the derived class for a control with +{\tt wxLC\_VIRTUAL} style. It should return the string containing the text of +the given {\it column} for the specified {\tt item}. + +\wxheading{See also} + +\helpref{SetItemCount}{wxlistctrlsetitemcount},\\ +\helpref{OnGetItemImage}{wxlistctrlongetitemimage},\\ +\helpref{OnGetItemAttr}{wxlistctrlongetitemattr} + \membersection{wxListCtrl::ScrollList}\label{wxlistctrlscrolllist} \func{bool}{ScrollList}{\param{int }{dx}, \param{int }{dy}} @@ -611,6 +706,16 @@ string or image at a given location.} \end{twocollist}} } +\membersection{wxListCtrl::SetItemCount}\label{wxlistctrlsetitemcount} + +\func{void}{SetItemCount}{\param{long }{count}} + +This method can only be used with virtual list controls. It is used to indicate +to the control the number of items it contains. After calling it, the main +program should be ready to handle calls to various item callbacks (such as +\helpref{OnGetItemText}{wxlistctrlongetitemtext}) for all vitems in the range +from $0$ to {\it count}. + \membersection{wxListCtrl::SetItemData}\label{wxlistctrlsetitemdata} \func{bool}{SetItemData}{\param{long }{item}, \param{long }{data}} @@ -699,3 +804,7 @@ function to call, so it is not available for programmer use. Call SortItems with a reference to a callable object that expects two parameters.} +\perlnote{In wxPerl the comparison function must take just two parameters; + however, you may use a closure to achieve an effect similar to the + SortItems third parameter.} +