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
|
|
|
|
@wxheader{choice.h}
|
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
|
|
|
|
listbox, only the selection is visible until the user pulls down the
|
|
|
|
menu of choices.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxCB_SORT}:
|
|
|
|
Sorts the entries alphabetically.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginEventTable
|
2008-03-09 12:33:59 +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}
|
|
|
|
@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:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a choice.
|
|
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +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-08 13:52:38 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxChoice();
|
2008-03-09 12:33:59 +00:00
|
|
|
wxChoice(wxWindow* parent, wxWindowID id,
|
2008-03-08 14:43:31 +00: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 12:33:59 +00:00
|
|
|
wxChoice(wxWindow* parent, wxWindowID id,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the choice item.
|
|
|
|
*/
|
|
|
|
~wxChoice();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates the choice for two-step construction. See wxChoice().
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxSize& size, int n,
|
|
|
|
const wxString choices[],
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "choice");
|
2008-03-08 13:52:38 +00: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 12:33:59 +00:00
|
|
|
other platforms.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumns() const;
|
2008-03-08 13:52:38 +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-03-10 15:24:38 +00:00
|
|
|
|
|
|
|
@wxsince{2.6.2} (before this version
|
2008-03-08 13:52:38 +00:00
|
|
|
wxControlWithItems::GetSelection itself behaved like
|
|
|
|
this).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetCurrentSelection() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the number of columns in this choice item.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
Number of columns.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetColumns(int n = 1);
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|