2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: choice.h
|
|
|
|
// Purpose: documentation for wxChoice class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxChoice
|
|
|
|
@wxheader{choice.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A choice item is used to select one of a list of strings. Unlike a
|
|
|
|
listbox, only the selection is visible until the user pulls down the
|
|
|
|
menu of choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxCB_SORT}:
|
|
|
|
Sorts the entries alphabetically.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginEventTable
|
2008-03-09 08:33:59 -04:00
|
|
|
@event{EVT_CHOICE(id, func)}:
|
2008-03-08 08:52:38 -05:00
|
|
|
Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
|
|
|
|
list is selected.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
|
|
|
@appearance{choice.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@seealso
|
|
|
|
wxListBox, wxComboBox, wxCommandEvent
|
|
|
|
*/
|
|
|
|
class wxChoice : public wxControlWithItems
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a choice.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Window size. If wxDefaultSize is specified then the choice is
|
|
|
|
sized
|
|
|
|
appropriately.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
Number of strings with which to initialise the choice control.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param choices
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of strings with which to initialise the choice control.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxChoice.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Window validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxChoice();
|
2008-03-09 08:33:59 -04:00
|
|
|
wxChoice(wxWindow* parent, wxWindowID id,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, int n,
|
|
|
|
const wxString choices[],
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-09 08:33:59 -04:00
|
|
|
wxChoice(wxWindow* parent, wxWindowID id,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the choice item.
|
|
|
|
*/
|
|
|
|
~wxChoice();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates the choice for two-step construction. See wxChoice().
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxSize& size, int n,
|
|
|
|
const wxString choices[],
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-09 08:33:59 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the number of columns in this choice item.
|
|
|
|
|
|
|
|
@remarks This is implemented for Motif only and always returns 1 for the
|
2008-03-09 08:33:59 -04:00
|
|
|
other platforms.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int GetColumns();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Unlike wxControlWithItems::GetSelection which only
|
|
|
|
returns the accepted selection value, i.e. the selection in the control once
|
|
|
|
the user closes the dropdown list, this function returns the current selection.
|
|
|
|
That is, while the dropdown list is shown, it returns the currently selected
|
|
|
|
item in it. When it is not shown, its result is the same as for the other
|
|
|
|
function.
|
|
|
|
This function is new since wxWidgets version 2.6.2 (before this version
|
|
|
|
wxControlWithItems::GetSelection itself behaved like
|
|
|
|
this).
|
|
|
|
*/
|
|
|
|
int GetCurrentSelection();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the number of columns in this choice item.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
Number of columns.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetColumns(int n = 1);
|
|
|
|
};
|