2003-05-09 08:58:28 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2003-01-01 17:08:11 -05:00
|
|
|
%% Name: ctrlsub.tex
|
|
|
|
%% Purpose: wxControlWithItems documentation
|
|
|
|
%% Author: Vadim Zeitlin
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 01.01.03
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) 2003 Vadim Zeitlin
|
2005-02-22 10:09:56 -05:00
|
|
|
%% License: wxWindows license
|
2003-05-09 08:58:28 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
\section{\class{wxControlWithItems}}\label{wxcontrolwithitems}
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
This class is an abstract base class for some wxWidgets controls which contain
|
2006-03-14 14:30:06 -05:00
|
|
|
several items, such as \helpref{wxListBox}{wxlistbox} and
|
|
|
|
\helpref{wxCheckListBox}{wxchecklistbox} derived from it,
|
2003-01-01 17:08:11 -05:00
|
|
|
\helpref{wxChoice}{wxchoice} and \helpref{wxComboBox}{wxcombobox}.
|
|
|
|
|
|
|
|
It defines the methods for accessing the controls items and although each of
|
|
|
|
the derived classes implements them differently, they still all conform to the
|
|
|
|
same interface.
|
|
|
|
|
2006-05-28 19:56:51 -04:00
|
|
|
The items in a wxControlWithItems have (non-empty) string labels and,
|
2003-01-01 17:08:11 -05:00
|
|
|
optionally, client data associated with them. Client data may be of two
|
|
|
|
different kinds: either simple untyped ({\tt void *}) pointers which are simply
|
|
|
|
stored by the control but not used in any way by it, or typed pointers
|
|
|
|
({\tt wxClientData *}) which are owned by the control meaning that the typed
|
2006-03-14 14:30:06 -05:00
|
|
|
client data (and only it) will be deleted when an item is
|
|
|
|
\helpref{deleted}{wxcontrolwithitemsdelete} or the entire control is
|
2003-01-01 17:08:11 -05:00
|
|
|
\helpref{cleared}{wxcontrolwithitemsclear} (which also happens when it is
|
|
|
|
destroyed). Finally note that in the same control all items must have client
|
|
|
|
data of the same type (typed or untyped), if any. This type is determined by
|
|
|
|
the first call to \helpref{Append}{wxcontrolwithitemsappend} (the version with
|
|
|
|
client data pointer) or \helpref{SetClientData}{wxcontrolwithitemssetclientdata}.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxControl}{wxcontrol}\\
|
|
|
|
\helpref{wxWindow}{wxwindow}\\
|
|
|
|
\helpref{wxEvtHandler}{wxevthandler}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/ctrlsub.h> but usually never included directly
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::Append}\label{wxcontrolwithitemsappend}
|
|
|
|
|
|
|
|
\func{int}{Append}{\param{const wxString\& }{ item}}
|
|
|
|
|
|
|
|
Adds the item to the end of the list box.
|
|
|
|
|
|
|
|
\func{int}{Append}{\param{const wxString\& }{ item}, \param{void *}{clientData}}
|
|
|
|
|
|
|
|
\func{int}{Append}{\param{const wxString\& }{ item}, \param{wxClientData *}{clientData}}
|
|
|
|
|
|
|
|
Adds the item to the end of the list box, associating the given, typed or
|
|
|
|
untyped, client data pointer with the item.
|
|
|
|
|
|
|
|
\func{void}{Append}{\param{const wxArrayString\& }{strings}}
|
|
|
|
|
|
|
|
Appends several items at once to the control. Notice that calling this method
|
|
|
|
may be much faster than appending the items one by one if you need to add a lot
|
|
|
|
of items.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{item}{String to add.}
|
|
|
|
|
|
|
|
\docparam{clientData}{Client data to associate with the item.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
When appending a single item, the return value is the index of the newly added
|
|
|
|
item which may be different from the last one if the control is sorted (e.g.
|
|
|
|
has {\tt wxLB\_SORT} or {\tt wxCB\_SORT} style).
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::Clear}\label{wxcontrolwithitemsclear}
|
|
|
|
|
|
|
|
\func{void}{Clear}{\void}
|
|
|
|
|
|
|
|
Removes all items from the control.
|
|
|
|
|
|
|
|
{\it Clear()} also deletes the client data of the existing items if it is owned
|
|
|
|
by the control.
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::Delete}\label{wxcontrolwithitemsdelete}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{void}{Delete}{\param{unsigned int}{ n}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Deletes an item from the control. The client data associated with the item
|
|
|
|
will be also deleted if it is owned by the control.
|
|
|
|
|
|
|
|
Note that it is an error (signalled by an assert failure in debug builds) to
|
|
|
|
remove an item with the index negative or greater or equal than the number of
|
|
|
|
items in the control.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based item index.}
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Clear}{wxcontrolwithitemsclear}
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::FindString}\label{wxcontrolwithitemsfindstring}
|
|
|
|
|
2005-09-27 12:38:17 -04:00
|
|
|
\func{int}{FindString}{\param{const wxString\& }{string}, \param{bool}{ caseSensitive = false}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Finds an item whose label matches the given string.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{string}{String to find.}
|
|
|
|
|
2005-09-27 12:38:17 -04:00
|
|
|
\docparam{caseSensitive}{Whether search is case sensitive (default is not).}
|
|
|
|
|
2003-01-01 17:08:11 -05:00
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The zero-based position of the item, or {\tt wxNOT\_FOUND} if the string was
|
|
|
|
not found.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetClientData}\label{wxcontrolwithitemsgetclientdata}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\constfunc{void *}{GetClientData}{\param{unsigned int}{ n}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Returns a pointer to the client data associated with the given item (if any).
|
|
|
|
It is an error to call this function for a control which doesn't have untyped
|
|
|
|
client data at all although it is ok to call it even if the given item doesn't
|
|
|
|
have any client data associated with it (but other items do).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based position of the item.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
A pointer to the client data, or {\tt NULL} if not present.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetClientObject}\label{wxcontrolwithitemsgetclientobject}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\constfunc{wxClientData *}{GetClientObject}{\param{unsigned int}{ n}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Returns a pointer to the client data associated with the given item (if any).
|
|
|
|
It is an error to call this function for a control which doesn't have typed
|
|
|
|
client data at all although it is ok to call it even if the given item doesn't
|
|
|
|
have any client data associated with it (but other items do).
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based position of the item.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
A pointer to the client data, or {\tt NULL} if not present.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetCount}\label{wxcontrolwithitemsgetcount}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\constfunc{unsigned int}{GetCount}{\void}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Returns the number of items in the control.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{IsEmpty}{wxcontrolwithitemsisempty}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetSelection}\label{wxcontrolwithitemsgetselection}
|
|
|
|
|
|
|
|
\constfunc{int}{GetSelection}{\void}
|
|
|
|
|
|
|
|
Returns the index of the selected item or {\tt wxNOT\_FOUND} if no item is
|
|
|
|
selected.
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The position of the current selection.
|
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
2006-03-14 14:30:06 -05:00
|
|
|
This method can be used with single selection list boxes only, you should use
|
2003-01-01 17:08:11 -05:00
|
|
|
\helpref{wxListBox::GetSelections}{wxlistboxgetselections} for the list boxes
|
|
|
|
with {\tt wxLB\_MULTIPLE} style.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{SetSelection}{wxcontrolwithitemssetselection},\rtfsp
|
|
|
|
\helpref{GetStringSelection}{wxcontrolwithitemsgetstringselection}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetString}\label{wxcontrolwithitemsgetstring}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\constfunc{wxString}{GetString}{\param{unsigned int}{ n}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Returns the label of the item with the given index.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based index.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The label of the item or an empty string if the position was invalid.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::GetStringSelection}\label{wxcontrolwithitemsgetstringselection}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetStringSelection}{\void}
|
|
|
|
|
|
|
|
Returns the label of the selected item or an empty string if no item is
|
|
|
|
selected.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{GetSelection}{wxcontrolwithitemsgetselection}
|
|
|
|
|
|
|
|
|
2003-05-09 08:58:28 -04:00
|
|
|
\membersection{wxControlWithItems::Insert}\label{wxcontrolwithitemsinsert}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}}
|
2003-05-09 08:58:28 -04:00
|
|
|
|
|
|
|
Inserts the item into the list before pos.
|
|
|
|
Not valid for {\tt wxLB\_SORT} or {\tt wxCB\_SORT} styles, use Append instead.
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}, \param{void *}{clientData}}
|
2003-05-09 08:58:28 -04:00
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{int}{Insert}{\param{const wxString\& }{ item}, \param{unsigned int }{pos}, \param{wxClientData *}{clientData}}
|
2003-05-09 08:58:28 -04:00
|
|
|
|
|
|
|
Inserts the item into the list before pos, associating the given, typed or
|
|
|
|
untyped, client data pointer with the item.
|
|
|
|
Not valid for {\tt wxLB\_SORT} or {\tt wxCB\_SORT} styles, use Append instead.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{item}{String to add.}
|
|
|
|
|
|
|
|
\docparam{pos}{Position to insert item before, zero based.}
|
|
|
|
|
|
|
|
\docparam{clientData}{Client data to associate with the item.}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The return value is the index of the newly inserted item. If the insertion failed
|
|
|
|
for some reason, -1 is returned.
|
|
|
|
|
|
|
|
|
2003-01-01 17:08:11 -05:00
|
|
|
\membersection{wxControlWithItems::IsEmpty}\label{wxcontrolwithitemsisempty}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsEmpty}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if the control is empty or {\tt false} if it has some items.
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{GetCount}{wxcontrolwithitemsgetcount}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::Number}\label{wxcontrolwithitemsnumber}
|
|
|
|
|
|
|
|
\constfunc{int}{Number}{\void}
|
|
|
|
|
|
|
|
{\bf Obsolescence note:} This method is obsolete and was replaced with
|
|
|
|
\helpref{GetCount}{wxcontrolwithitemsgetcount}, please use the new method in
|
2006-03-14 14:30:06 -05:00
|
|
|
the new code. This method is only available if wxWidgets was compiled with
|
2003-01-01 17:08:11 -05:00
|
|
|
{\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in
|
|
|
|
future versions.
|
|
|
|
|
|
|
|
|
2005-02-13 12:08:27 -05:00
|
|
|
\membersection{wxControlWithItems::Select}\label{wxcontrolwithitemsselect}
|
|
|
|
|
|
|
|
\func{void}{Select}{\param{int}{ n}}
|
|
|
|
|
|
|
|
This is the same as \helpref{SetSelection}{wxcontrolwithitemssetselection} and
|
|
|
|
exists only because it is slightly more natural for controls which support
|
|
|
|
multiple selection.
|
|
|
|
|
|
|
|
|
2003-01-01 17:08:11 -05:00
|
|
|
\membersection{wxControlWithItems::SetClientData}\label{wxcontrolwithitemssetclientdata}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{void}{SetClientData}{\param{unsigned int}{ n}, \param{void *}{data}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Associates the given untyped client data pointer with the given item. Note that
|
|
|
|
it is an error to call this function if any typed client data pointers had been
|
|
|
|
associated with the control items before.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based item index.}
|
|
|
|
|
|
|
|
\docparam{data}{The client data to associate with the item.}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::SetClientObject}\label{wxcontrolwithitemssetclientobject}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{void}{SetClientObject}{\param{unsigned int}{ n}, \param{wxClientData *}{data}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
2006-03-14 14:30:06 -05:00
|
|
|
Associates the given typed client data pointer with the given item: the
|
2003-01-01 17:08:11 -05:00
|
|
|
{\it data} object will be deleted when the item is deleted (either explicitly
|
|
|
|
by using \helpref{Deletes}{wxcontrolwithitemsdelete} or implicitly when the
|
|
|
|
control itself is destroyed).
|
|
|
|
|
|
|
|
Note that it is an error to call this function if any untyped client data
|
|
|
|
pointers had been associated with the control items before.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based item index.}
|
|
|
|
|
|
|
|
\docparam{data}{The client data to associate with the item.}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::SetSelection}\label{wxcontrolwithitemssetselection}
|
|
|
|
|
|
|
|
\func{void}{SetSelection}{\param{int}{ n}}
|
|
|
|
|
2004-10-17 20:18:43 -04:00
|
|
|
Sets the selection to the given item \arg{n} or removes the selection entirely
|
2004-10-20 07:12:56 -04:00
|
|
|
if \arg{n} $==$ {\tt wxNOT\_FOUND}.
|
2004-10-17 20:18:43 -04:00
|
|
|
|
2005-02-13 12:08:27 -05:00
|
|
|
Note that this does not cause any command events to be emitted nor does it
|
|
|
|
deselect any other items in the controls which support multiple selections.
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The string position to select, starting from zero.}
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{SetString}{wxcontrolwithitemssetstring},\rtfsp
|
|
|
|
\helpref{SetStringSelection}{wxcontrolwithitemssetstringselection}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::SetString}\label{wxcontrolwithitemssetstring}
|
|
|
|
|
2006-03-23 17:05:23 -05:00
|
|
|
\func{void}{SetString}{\param{unsigned int}{ n}, \param{const wxString\& }{ string}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Sets the label for the given item.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{n}{The zero-based item index.}
|
|
|
|
|
|
|
|
\docparam{string}{The label to set.}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxControlWithItems::SetStringSelection}\label{wxcontrolwithitemssetstringselection}
|
|
|
|
|
2005-02-13 11:29:31 -05:00
|
|
|
\func{bool}{SetStringSelection}{\param{const wxString\& }{ string}}
|
2003-01-01 17:08:11 -05:00
|
|
|
|
|
|
|
Selects the item with the specified string in the control. This doesn't cause
|
|
|
|
any command events being emitted.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{string}{The string to select.}
|
|
|
|
|
2005-02-13 11:29:31 -05:00
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
\true if the specified string has been selected, \false if it wasn't found in
|
|
|
|
the control.
|
|
|
|
|
2003-01-01 17:08:11 -05:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{SetSelection}{wxcontrolwithitemssetselection}
|