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
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@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.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxRA_USE_CHECKBOX}
|
2008-03-08 08:52:38 -05:00
|
|
|
Use of the checkbox controls instead of radio buttons (currently
|
|
|
|
supported only on PalmOS)
|
|
|
|
@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_RADIOBOX(id, func)}
|
2008-05-04 05:04:38 -04:00
|
|
|
Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED 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}
|
2008-10-13 04:05:18 -04:00
|
|
|
@appearance{radiobox.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-28 12:19:12 -04:00
|
|
|
@see @ref overview_eventhandling, 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
|
2008-05-04 05:04:38 -04:00
|
|
|
Window position. If @c wxDefaultPosition is specified then a
|
|
|
|
default position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-05-04 05:04:38 -04:00
|
|
|
Window size. If @c wxDefaultSize is specified then a default size
|
|
|
|
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
|
|
|
|
@c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
|
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
|
|
|
|
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,
|
2008-11-13 16:32:53 -05:00
|
|
|
int majorDimension = 1,
|
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
|
|
|
|
Window position. If @c wxDefaultPosition is specified then a
|
|
|
|
default position is chosen.
|
|
|
|
@param size
|
|
|
|
Window size. If @c wxDefaultSize is specified then a default size
|
|
|
|
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
|
|
|
|
@c wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
|
|
|
|
@param style
|
|
|
|
Window style. See wxRadioBox.
|
|
|
|
@param validator
|
|
|
|
Window validator.
|
|
|
|
@param name
|
|
|
|
Window name.
|
|
|
|
|
|
|
|
@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,
|
2008-11-13 16:32:53 -05:00
|
|
|
int majorDimension = 1,
|
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()
|
|
|
|
|
|
|
|
@beginWxPythonOnly
|
|
|
|
In place of a single overloaded method name, wxPython implements the following methods:
|
|
|
|
|
|
|
|
@beginTable
|
|
|
|
@row2col{Enable(flag), Enables or disables the entire radiobox.}
|
|
|
|
@row2col{EnableItem(n\, flag), Enables or disables an individual button in the radiobox.}
|
|
|
|
@endTable
|
|
|
|
|
|
|
|
@endWxPythonOnly
|
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)".
|
|
|
|
|
|
|
|
This function is currently only implemented in wxMSW, wxGTK and
|
|
|
|
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.
|
|
|
|
|
|
|
|
This function is currently only implemented in wxMSW, wxGTK and
|
|
|
|
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);
|
|
|
|
|
|
|
|
/**
|
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-05-04 05:04:38 -04:00
|
|
|
@beginWxPythonOnly
|
|
|
|
In place of a single overloaded method name, wxPython implements the following methods:
|
|
|
|
|
|
|
|
@beginTable
|
|
|
|
@row2col{Show(flag), Shows or hides the entire radiobox.}
|
|
|
|
@row2col{ShowItem(n\, flag), Shows or hides individual buttons.}
|
|
|
|
@endTable
|
|
|
|
|
|
|
|
@endWxPythonOnly
|
2008-03-20 09:45:17 -04:00
|
|
|
|
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);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|