2008-03-08 08:52:38 -05:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Name: choice.h
|
2008-03-10 11:24:38 -04:00
|
|
|
|
// Purpose: interface of wxChoice
|
2008-03-08 08:52:38 -05:00
|
|
|
|
// Author: wxWidgets team
|
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@class wxChoice
|
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
|
2008-04-05 05:12:23 -04:00
|
|
|
|
wxListBox, only the selection is visible until the user pulls down the
|
2008-03-08 08:52:38 -05:00
|
|
|
|
menu of choices.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
|
@style{wxCB_SORT}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
Sorts the entries alphabetically.
|
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
2008-03-28 12:19:12 -04:00
|
|
|
|
@beginEventTable{wxCommandEvent}
|
2008-04-06 10:43:04 -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}
|
2008-04-05 05:12:23 -04:00
|
|
|
|
<!-- @appearance{choice.png} -->
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
@see wxListBox, wxComboBox, wxCommandEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
|
*/
|
|
|
|
|
class wxChoice : public wxControlWithItems
|
|
|
|
|
{
|
|
|
|
|
public:
|
2008-04-05 05:12:23 -04:00
|
|
|
|
/**
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
|
*/
|
|
|
|
|
wxChoice();
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
|
//@{
|
|
|
|
|
/**
|
|
|
|
|
Constructor, creating and showing a choice.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
|
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-04-05 05:12:23 -04:00
|
|
|
|
Window size. If wxDefaultSize is specified then the choice is sized
|
2008-03-09 08:33:59 -04:00
|
|
|
|
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-20 09:45:17 -04:00
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
|
@see Create(), wxValidator
|
2008-04-05 05:12:23 -04:00
|
|
|
|
|
|
|
|
|
@beginWxPythonOnly
|
|
|
|
|
|
|
|
|
|
The wxChoice constructor in wxPython reduces the @a n and @a choices
|
|
|
|
|
arguments to a single argument, which is a list of strings.
|
|
|
|
|
|
|
|
|
|
@endWxPythonOnly
|
2008-03-08 08:52:38 -05:00
|
|
|
|
*/
|
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-08-30 08:44:43 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Constructor, creating and showing a choice.
|
|
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
|
Parent window. Must not be @NULL.
|
|
|
|
|
@param id
|
|
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
|
|
|
|
@param pos
|
|
|
|
|
Window position.
|
|
|
|
|
@param size
|
|
|
|
|
Window size. If wxDefaultSize is specified then the choice is sized
|
|
|
|
|
appropriately.
|
|
|
|
|
@param choices
|
|
|
|
|
An array of strings with which to initialise the choice control.
|
|
|
|
|
@param style
|
|
|
|
|
Window style. See wxChoice.
|
|
|
|
|
@param validator
|
|
|
|
|
Window validator.
|
|
|
|
|
@param name
|
|
|
|
|
Window name.
|
|
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
|
|
|
|
|
|
@beginWxPythonOnly
|
|
|
|
|
|
|
|
|
|
The wxChoice constructor in wxPython reduces the @a n and @a choices
|
|
|
|
|
arguments to a single argument, which is a list of strings.
|
|
|
|
|
|
|
|
|
|
@endWxPythonOnly
|
|
|
|
|
*/
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
|
2008-06-16 09:32:43 -04:00
|
|
|
|
@remarks This is implemented for GTK and Motif only and always
|
|
|
|
|
returns 1 for the other platforms.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
|
int GetColumns() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
|
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.
|
|
|
|
|
|
2008-04-21 06:34:23 -04:00
|
|
|
|
@since 2.6.2.
|
|
|
|
|
In older versions, wxControlWithItems::GetSelection() itself
|
|
|
|
|
behaved like this.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
|
int GetCurrentSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Sets the number of columns in this choice item.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
|
Number of columns.
|
2008-04-05 05:12:23 -04:00
|
|
|
|
|
2008-06-16 09:32:43 -04:00
|
|
|
|
@remarks This is implemented for GTK and Motif only and doesn’t do
|
|
|
|
|
anything under other platforms.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
*/
|
|
|
|
|
void SetColumns(int n = 1);
|
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|