2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: radiobox.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxRadioBox
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRadioBox
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00: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 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxRA_SPECIFY_ROWS}
|
2008-03-08 13:52:38 +00:00
|
|
|
The major dimension parameter refers to the maximum number of rows.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxRA_SPECIFY_COLS}
|
2008-03-08 13:52:38 +00:00
|
|
|
The major dimension parameter refers to the maximum number of
|
|
|
|
columns.
|
|
|
|
@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_RADIOBOX(id, func)}
|
2008-05-04 09:04:38 +00:00
|
|
|
Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
|
2008-03-08 13:52:38 +00:00
|
|
|
is clicked.
|
|
|
|
@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{radiobox.png}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2009-02-18 00:19:22 +00:00
|
|
|
@see @ref overview_events, wxRadioButton, wxCheckBox
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-04-11 22:12:31 +00:00
|
|
|
class wxRadioBox : public wxControl, wxItemContainerImmutable
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-05-04 09:04:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
|
|
|
wxRadioBox();
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a radiobox.
|
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-05-04 09:04:38 +00:00
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param label
|
2008-03-09 12:33:59 +00:00
|
|
|
Label for the static box surrounding the radio buttons.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2009-03-14 00:49:24 +00:00
|
|
|
Window position. If ::wxDefaultPosition is specified then a
|
2008-05-04 09:04:38 +00:00
|
|
|
default position is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2009-03-14 00:49:24 +00:00
|
|
|
Window size. If ::wxDefaultSize is specified then a default size
|
2008-05-04 09:04:38 +00:00
|
|
|
is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
Number of choices with which to initialize the radiobox.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param choices
|
2008-03-09 12:33:59 +00:00
|
|
|
An array of choices with which to initialize the radiobox.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param majorDimension
|
2008-05-04 09:04:38 +00:00
|
|
|
Specifies the maximum number of rows (if style contains
|
|
|
|
@c wxRA_SPECIFY_ROWS) or columns (if style contains
|
2010-08-10 18:57:36 +00: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 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxRadioBox.
|
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
|
|
|
|
2009-10-18 17:47:01 +00:00
|
|
|
@beginWxPerlOnly
|
|
|
|
Not supported by wxPerl.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 09:04:38 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 12:33:59 +00:00
|
|
|
const wxString choices[] = NULL,
|
2010-08-10 18:57:36 +00:00
|
|
|
int majorDimension = 0,
|
2008-03-08 14:43:31 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 21:32:53 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-05-04 09:04:38 +00: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-14 00:49:24 +00:00
|
|
|
Window position. If ::wxDefaultPosition is specified then a
|
2008-05-04 09:04:38 +00:00
|
|
|
default position is chosen.
|
|
|
|
@param size
|
2009-03-14 00:49:24 +00:00
|
|
|
Window size. If ::wxDefaultSize is specified then a default size
|
2008-05-04 09:04:38 +00: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 18:57:36 +00: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 09:04:38 +00:00
|
|
|
@param style
|
|
|
|
Window style. See wxRadioBox.
|
|
|
|
@param validator
|
|
|
|
Window validator.
|
|
|
|
@param name
|
|
|
|
Window name.
|
|
|
|
|
2009-10-18 17:47:01 +00:00
|
|
|
@beginWxPerlOnly
|
|
|
|
Use an array reference for the @a choices parameter.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-05-04 09:04:38 +00:00
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 09:04:38 +00:00
|
|
|
const wxPoint& pos,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
2010-08-10 18:57:36 +00:00
|
|
|
int majorDimension = 0,
|
2008-03-08 14:43:31 +00:00
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 21:32:53 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the radiobox item.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxRadioBox();
|
2008-03-08 13:52:38 +00: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 09:04:38 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 12:33:59 +00:00
|
|
|
const wxString choices[] = NULL,
|
2008-03-08 13:52:38 +00:00
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 21:32:53 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-05-04 09:04:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the radiobox for two-step construction. See wxRadioBox()
|
|
|
|
for further details.
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
2008-05-04 09:04:38 +00:00
|
|
|
const wxPoint& pos,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-13 21:32:53 +00:00
|
|
|
const wxString& name = wxRadioBoxNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Enables or disables an individual button in the radiobox.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param enable
|
2008-03-09 12:33:59 +00:00
|
|
|
@true to enable, @false to disable.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
The zero-based button to enable or disable.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-04 09:04:38 +00:00
|
|
|
@see wxWindow::Enable()
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
virtual bool Enable(unsigned int n, bool enable = true);
|
2008-05-04 09:04:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-11-03 11:57:07 +00:00
|
|
|
Finds a button matching the given string, returning the position if found,
|
|
|
|
or @c wxNOT_FOUND if not found.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param string
|
2008-03-09 12:33:59 +00:00
|
|
|
The string to find.
|
2008-11-03 11:57:07 +00:00
|
|
|
@param bCase
|
|
|
|
Should the search be case-sensitive?
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-11-03 11:57:07 +00:00
|
|
|
virtual int FindString(const wxString& string, bool bCase = false) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of columns in the radiobox.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
unsigned int GetColumnCount() const;
|
2008-03-08 13:52:38 +00: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 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pt
|
2008-03-09 12:33:59 +00:00
|
|
|
Point in client coordinates.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
virtual int GetItemFromPoint(const wxPoint& pt) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Returns the helptext associated with the specified @a item if any or @c
|
2008-03-08 13:52:38 +00:00
|
|
|
wxEmptyString.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param item
|
2008-03-09 12:33:59 +00:00
|
|
|
The zero-based item index.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetItemHelpText()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetItemHelpText(unsigned int item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Returns the tooltip associated with the specified @a item if any or @NULL.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-04 09:04:38 +00:00
|
|
|
@see SetItemToolTip(), wxWindow::GetToolTip()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxToolTip* GetItemToolTip(unsigned int item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of rows in the radiobox.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
unsigned int GetRowCount() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is enabled or @false if it was disabled using
|
2008-05-04 09:04:38 +00: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 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
The zero-based button position.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool IsItemEnabled(unsigned int n) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is currently shown or @false if it was hidden
|
2008-05-04 09:04:38 +00:00
|
|
|
using @ref Show(unsigned int,bool) "Show(n, false)".
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Note that this function returns @true for an item which hadn't been hidden
|
2008-05-04 09:04:38 +00: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 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
The zero-based button position.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool IsItemShown(unsigned int n) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the helptext for an item. Empty string erases any existing helptext.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param item
|
2008-03-09 12:33:59 +00:00
|
|
|
The zero-based item index.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param helptext
|
2008-03-09 12:33:59 +00:00
|
|
|
The help text to set for the item.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetItemHelpText()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemHelpText(unsigned int item, const wxString& helptext);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the tooltip text for the specified item in the radio group.
|
2008-05-04 09:04:38 +00:00
|
|
|
|
|
|
|
This function is currently only implemented in wxMSW and wxGTK2 and
|
|
|
|
does nothing in the other ports.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param item
|
2008-03-09 12:33:59 +00:00
|
|
|
Index of the item the tooltip will be shown for.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param text
|
2008-03-09 12:33:59 +00:00
|
|
|
Tooltip text for the item, the tooltip is removed if empty.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-04 09:04:38 +00:00
|
|
|
@see GetItemToolTip(), wxWindow::SetToolTip()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemToolTip(unsigned int item, const wxString& text);
|
|
|
|
|
|
|
|
/**
|
2008-05-04 09:04:38 +00:00
|
|
|
Shows or hides individual buttons.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-04 09:04:38 +00: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 13:52:38 +00:00
|
|
|
|
2008-05-04 09:04:38 +00: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 13:45:17 +00:00
|
|
|
|
2008-05-04 09:04:38 +00:00
|
|
|
@see
|
|
|
|
wxWindow::Show()
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
*/
|
2008-11-13 21:32:53 +00:00
|
|
|
virtual bool Show(unsigned int item, bool show = true);
|
2011-10-26 05:52:53 +00: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);
|
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|