2008-03-08 13:52:38 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Name: choice.h
|
2008-03-10 15:24:38 +00:00
|
|
|
|
// Purpose: interface of wxChoice
|
2008-03-08 13:52:38 +00:00
|
|
|
|
// Author: wxWidgets team
|
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@class wxChoice
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
A choice item is used to select one of a list of strings. Unlike a
|
2008-04-05 09:12:23 +00:00
|
|
|
|
wxListBox, only the selection is visible until the user pulls down the
|
2008-03-08 13:52:38 +00:00
|
|
|
|
menu of choices.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
@beginStyleTable
|
2008-04-06 14:43:04 +00:00
|
|
|
|
@style{wxCB_SORT}
|
2008-03-08 13:52:38 +00:00
|
|
|
|
Sorts the entries alphabetically.
|
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
2009-02-18 17:58:51 +00:00
|
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-04-06 14:43:04 +00:00
|
|
|
|
@event{EVT_CHOICE(id, func)}
|
2008-03-08 13:52:38 +00:00
|
|
|
|
Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
|
|
|
|
|
list is selected.
|
|
|
|
|
@endEventTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
@library{wxcore}
|
|
|
|
|
@category{ctrl}
|
2008-10-13 08:05:18 +00:00
|
|
|
|
@appearance{choice.png}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
@see wxListBox, wxComboBox, wxCommandEvent
|
2008-03-08 13:52:38 +00:00
|
|
|
|
*/
|
|
|
|
|
class wxChoice : public wxControlWithItems
|
|
|
|
|
{
|
|
|
|
|
public:
|
2008-04-05 09:12:23 +00:00
|
|
|
|
/**
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
|
*/
|
|
|
|
|
wxChoice();
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
//@{
|
|
|
|
|
/**
|
|
|
|
|
Constructor, creating and showing a choice.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Window position.
|
2009-04-21 11:21:36 +00:00
|
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param size
|
2009-04-21 11:21:36 +00:00
|
|
|
|
Window size.
|
|
|
|
|
If ::wxDefaultSize is specified then the choice is sized appropriately.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Number of strings with which to initialise the choice control.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param choices
|
2008-03-09 12:33:59 +00:00
|
|
|
|
An array of strings with which to initialise the choice control.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Window style. See wxChoice.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Window validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Window name.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
|
@see Create(), wxValidator
|
2008-04-05 09:12:23 +00: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 13:52:38 +00:00
|
|
|
|
*/
|
2009-01-10 23:44:44 +00:00
|
|
|
|
wxChoice( wxWindow *parent, wxWindowID id,
|
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
|
long style = 0,
|
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
2008-08-30 12:44:43 +00: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
|
|
|
|
|
*/
|
2009-01-10 23:44:44 +00:00
|
|
|
|
wxChoice( wxWindow *parent, wxWindowID id,
|
|
|
|
|
const wxPoint& pos,
|
|
|
|
|
const wxSize& size,
|
|
|
|
|
const wxArrayString& choices,
|
|
|
|
|
long style = 0,
|
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
2008-03-08 13:52:38 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Destructor, destroying the choice item.
|
|
|
|
|
*/
|
2008-09-22 19:01:17 +00:00
|
|
|
|
virtual ~wxChoice();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
//@{
|
|
|
|
|
/**
|
|
|
|
|
Creates the choice for two-step construction. See wxChoice().
|
|
|
|
|
*/
|
2009-01-10 23:44:44 +00:00
|
|
|
|
bool Create( wxWindow *parent, wxWindowID id,
|
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
|
long style = 0,
|
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
|
|
|
|
bool Create( wxWindow *parent, wxWindowID id,
|
|
|
|
|
const wxPoint& pos,
|
|
|
|
|
const wxSize& size,
|
|
|
|
|
const wxArrayString& choices,
|
|
|
|
|
long style = 0,
|
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
|
const wxString& name = wxChoiceNameStr );
|
2008-03-08 13:52:38 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Gets the number of columns in this choice item.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
2009-01-10 23:44:44 +00:00
|
|
|
|
@remarks This is implemented for GTK and Motif only and always
|
2008-06-16 13:32:43 +00:00
|
|
|
|
returns 1 for the other platforms.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
*/
|
2008-09-22 19:01:17 +00:00
|
|
|
|
virtual int GetColumns() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2008-04-05 09:12:23 +00: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 10:34:23 +00:00
|
|
|
|
@since 2.6.2.
|
|
|
|
|
In older versions, wxControlWithItems::GetSelection() itself
|
|
|
|
|
behaved like this.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
*/
|
2008-09-22 19:01:17 +00:00
|
|
|
|
virtual int GetCurrentSelection() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Sets the number of columns in this choice item.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
|
Number of columns.
|
2008-04-05 09:12:23 +00:00
|
|
|
|
|
2009-01-10 23:44:44 +00:00
|
|
|
|
@remarks This is implemented for GTK and Motif only and doesn’t do
|
2008-06-16 13:32:43 +00:00
|
|
|
|
anything under other platforms.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
*/
|
2008-09-22 19:01:17 +00:00
|
|
|
|
virtual void SetColumns(int n = 1);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|
|