2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: radiobox.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxRadioBox
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRadioBox
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A radio box item is used to select one of number of mutually exclusive
|
|
|
|
choices. It is displayed as a vertical column or horizontal row of
|
|
|
|
labelled buttons.
|
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{wxRA_SPECIFY_ROWS}
|
2008-03-08 08:52:38 -05:00
|
|
|
The major dimension parameter refers to the maximum number of rows.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxRA_SPECIFY_COLS}
|
2008-03-08 08:52:38 -05:00
|
|
|
The major dimension parameter refers to the maximum number of
|
|
|
|
columns.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-04-06 10:43:04 -04:00
|
|
|
@event{EVT_RADIOBOX(id, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_RADIOBOX event, when a radiobutton
|
2008-03-08 08:52:38 -05:00
|
|
|
is clicked.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 14:32:50 -04:00
|
|
|
@appearance{radiobox}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-02-17 19:19:22 -05:00
|
|
|
@see @ref overview_events, wxRadioButton, wxCheckBox
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 18:12:31 -04:00
|
|
|
class wxRadioBox : public wxControl, wxItemContainerImmutable
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-05-04 05:04:38 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
|
|
|
wxRadioBox();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a radiobox.
|
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-05-04 05:04:38 -04:00
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
Label for the static box surrounding the radio buttons.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2009-03-13 20:49:24 -04:00
|
|
|
Window position. If ::wxDefaultPosition is specified then a
|
2008-05-04 05:04:38 -04:00
|
|
|
default position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2009-03-13 20:49:24 -04:00
|
|
|
Window size. If ::wxDefaultSize is specified then a default size
|
2008-05-04 05:04:38 -04:00
|
|
|
is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
Number of choices with which to initialize the radiobox.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param choices
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of choices with which to initialize the radiobox.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param majorDimension
|
2008-05-04 05:04:38 -04:00
|
|
|
Specifies the maximum number of rows (if style contains
|
|
|
|
@c wxRA_SPECIFY_ROWS) or columns (if style contains
|
2010-08-10 14:57:36 -04:00
|
|
|
@c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
|
|
|
|
value of 0 means to use the number of items, i.e. @a n.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxRadioBox.
|
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
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
Not supported by wxPerl.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 05:04:38 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString choices[] = NULL,
|
2010-08-10 14:57:36 -04:00
|
|
|
int majorDimension = 0,
|
2008-03-08 09:43:31 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-05-04 05:04:38 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a radiobox.
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
Parent window. Must not be @NULL.
|
|
|
|
@param id
|
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
|
|
|
@param label
|
|
|
|
Label for the static box surrounding the radio buttons.
|
|
|
|
@param pos
|
2009-03-13 20:49:24 -04:00
|
|
|
Window position. If ::wxDefaultPosition is specified then a
|
2008-05-04 05:04:38 -04:00
|
|
|
default position is chosen.
|
|
|
|
@param size
|
2009-03-13 20:49:24 -04:00
|
|
|
Window size. If ::wxDefaultSize is specified then a default size
|
2008-05-04 05:04:38 -04:00
|
|
|
is chosen.
|
|
|
|
@param choices
|
|
|
|
An array of choices with which to initialize the radiobox.
|
|
|
|
@param majorDimension
|
|
|
|
Specifies the maximum number of rows (if style contains
|
|
|
|
@c wxRA_SPECIFY_ROWS) or columns (if style contains
|
2010-08-10 14:57:36 -04:00
|
|
|
@c wxRA_SPECIFY_COLS) for a two-dimensional radiobox. The default
|
|
|
|
value of 0 means to use the number of items, i.e. number of
|
|
|
|
elements in @a choices.
|
2008-05-04 05:04:38 -04:00
|
|
|
@param style
|
|
|
|
Window style. See wxRadioBox.
|
|
|
|
@param validator
|
|
|
|
Window validator.
|
|
|
|
@param name
|
|
|
|
Window name.
|
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
Use an array reference for the @a choices parameter.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 05:04:38 -04:00
|
|
|
const wxPoint& pos,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
2010-08-10 14:57:36 -04:00
|
|
|
int majorDimension = 0,
|
2008-03-08 09:43:31 -05:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the radiobox item.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxRadioBox();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the radiobox for two-step construction. See wxRadioBox()
|
|
|
|
for further details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 05:04:38 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString choices[] = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-05-04 05:04:38 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the radiobox for two-step construction. See wxRadioBox()
|
|
|
|
for further details.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 05:04:38 -04:00
|
|
|
const wxPoint& pos,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Enables or disables an individual button in the radiobox.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param enable
|
2008-03-09 08:33:59 -04:00
|
|
|
@true to enable, @false to disable.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The zero-based button to enable or disable.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@see wxWindow::Enable()
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual bool Enable(unsigned int n, bool enable = true);
|
2008-05-04 05:04:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-11-03 06:57:07 -05:00
|
|
|
Finds a button matching the given string, returning the position if found,
|
|
|
|
or @c wxNOT_FOUND if not found.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param string
|
2008-03-09 08:33:59 -04:00
|
|
|
The string to find.
|
2008-11-03 06:57:07 -05:00
|
|
|
@param bCase
|
|
|
|
Should the search be case-sensitive?
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-03 06:57:07 -05:00
|
|
|
virtual int FindString(const wxString& string, bool bCase = false) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of columns in the radiobox.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
unsigned int GetColumnCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a radio box item under the point, a zero-based item index, or @c
|
|
|
|
wxNOT_FOUND if no item is under the point.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pt
|
2008-03-09 08:33:59 -04:00
|
|
|
Point in client coordinates.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual int GetItemFromPoint(const wxPoint& pt) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Returns the helptext associated with the specified @a item if any or @c
|
2008-03-08 08:52:38 -05:00
|
|
|
wxEmptyString.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param item
|
2008-03-09 08:33:59 -04:00
|
|
|
The zero-based item index.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetItemHelpText()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetItemHelpText(unsigned int item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Returns the tooltip associated with the specified @a item if any or @NULL.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@see SetItemToolTip(), wxWindow::GetToolTip()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxToolTip* GetItemToolTip(unsigned int item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of rows in the radiobox.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
unsigned int GetRowCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is enabled or @false if it was disabled using
|
2008-05-04 05:04:38 -04:00
|
|
|
@ref Enable(unsigned int,bool) "Enable(n, false)".
|
|
|
|
|
2014-08-23 21:50:11 -04:00
|
|
|
This function is currently only implemented in wxMSW, wxGTK, wxQT and
|
2008-05-04 05:04:38 -04:00
|
|
|
wxUniversal and always returns @true in the other ports.
|
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
|
|
|
The zero-based button position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsItemEnabled(unsigned int n) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is currently shown or @false if it was hidden
|
2008-05-04 05:04:38 -04:00
|
|
|
using @ref Show(unsigned int,bool) "Show(n, false)".
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Note that this function returns @true for an item which hadn't been hidden
|
2008-05-04 05:04:38 -04:00
|
|
|
even if the entire radiobox is not currently shown.
|
|
|
|
|
2014-08-23 21:50:11 -04:00
|
|
|
This function is currently only implemented in wxMSW, wxGTK, wxQT and
|
2008-05-04 05:04:38 -04:00
|
|
|
wxUniversal and always returns @true in the other ports.
|
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
|
|
|
The zero-based button position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsItemShown(unsigned int n) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the helptext for an item. Empty string erases any existing helptext.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param item
|
2008-03-09 08:33:59 -04:00
|
|
|
The zero-based item index.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param helptext
|
2008-03-09 08:33:59 -04:00
|
|
|
The help text to set for the item.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetItemHelpText()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetItemHelpText(unsigned int item, const wxString& helptext);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the tooltip text for the specified item in the radio group.
|
2008-05-04 05:04:38 -04:00
|
|
|
|
|
|
|
This function is currently only implemented in wxMSW and wxGTK2 and
|
|
|
|
does nothing in the other ports.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param item
|
2008-03-09 08:33:59 -04:00
|
|
|
Index of the item the tooltip will be shown for.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param text
|
2008-03-09 08:33:59 -04:00
|
|
|
Tooltip text for the item, the tooltip is removed if empty.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@see GetItemToolTip(), wxWindow::SetToolTip()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetItemToolTip(unsigned int item, const wxString& text);
|
|
|
|
|
2013-05-31 19:21:40 -04:00
|
|
|
/**
|
|
|
|
Sets the selection to the given item.
|
|
|
|
|
|
|
|
Notice that a radio box always has selection, so @a n must be valid
|
|
|
|
here and passing @c wxNOT_FOUND is not allowed.
|
|
|
|
*/
|
|
|
|
virtual void SetSelection(int n);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-04 05:04:38 -04:00
|
|
|
Shows or hides individual buttons.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@param show
|
|
|
|
@true to show, @false to hide.
|
|
|
|
@param item
|
|
|
|
The zero-based position of the button to show or hide.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@return
|
|
|
|
@true if the item has been shown or hidden or @false if nothing
|
|
|
|
was done because it already was in the requested state.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-04 05:04:38 -04:00
|
|
|
@see
|
|
|
|
wxWindow::Show()
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
*/
|
2008-11-13 16:32:53 -05:00
|
|
|
virtual bool Show(unsigned int item, bool show = true);
|
2011-10-26 01:52:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
// pure virtuals that have implementations here
|
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual wxString GetString(unsigned int n) const;
|
|
|
|
virtual void SetString(unsigned int n, const wxString& string);
|
2020-11-10 07:12:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the index of the selected item.
|
|
|
|
|
|
|
|
As radio boxes always have a selected item, the return value is never
|
|
|
|
@c wxNOT_FOUND for this class.
|
|
|
|
*/
|
2011-10-26 01:52:53 -04:00
|
|
|
virtual int GetSelection() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|