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
|
|
|
|
@wxheader{radiobox.h}
|
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-03-08 08:52:38 -05:00
|
|
|
Process a wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton
|
|
|
|
is clicked.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2008-05-02 00:52:42 -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:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
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-03-09 08:33:59 -04:00
|
|
|
Window identifier. The value 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-03-09 08:33:59 -04:00
|
|
|
Window position. If wxDefaultPosition is specified then a default
|
|
|
|
position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Window size. If 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-03-09 08:33:59 -04:00
|
|
|
Specifies the maximum number of rows (if style contains wxRA_SPECIFY_ROWS)
|
|
|
|
or columns (if style contains 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
|
|
|
*/
|
|
|
|
wxRadioBox();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& point = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString choices[] = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "radioBox");
|
|
|
|
wxRadioBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& point,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "radioBox");
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the radiobox item.
|
|
|
|
*/
|
|
|
|
~wxRadioBox();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates the radiobox for two-step construction. See wxRadioBox()
|
|
|
|
for further details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& point = wxDefaultPosition,
|
|
|
|
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,
|
|
|
|
const wxString& name = "radioBox");
|
2008-03-08 09:43:31 -05:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& point,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
int majorDimension = 0,
|
|
|
|
long style = wxRA_SPECIFY_COLS,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "radioBox");
|
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-03-09 08:33:59 -04:00
|
|
|
@see wxWindow::Enable
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual bool Enable(bool enable = true);
|
|
|
|
virtual bool Enable(unsigned int n, bool enable = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Finds a button matching the given string, returning the position if found, or
|
|
|
|
-1 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-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int FindString(const wxString& string) 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-03-09 12:24:26 -04:00
|
|
|
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-03-09 08:33:59 -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 radiobox label.
|
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 index.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetLabel()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetLabel() 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 the zero-based position of the selected button.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the label for the button at the given position.
|
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-03-09 12:24:26 -04:00
|
|
|
wxString GetString(unsigned int n) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the selected string.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetStringSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is enabled or @false if it was disabled using
|
|
|
|
@ref enable() "Enable(n, @false)".
|
|
|
|
@b Platform note: 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-03-09 12:24:26 -04:00
|
|
|
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
|
|
|
|
using
|
|
|
|
@ref show() "Show(n, @false)".
|
|
|
|
Note that this function returns @true for an item which hadn't been hidden
|
|
|
|
even
|
|
|
|
if the entire radiobox is not currently shown.
|
|
|
|
@b Platform note: 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-03-09 12:24:26 -04:00
|
|
|
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.
|
|
|
|
@b Platform note: 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-03-09 08:33:59 -04:00
|
|
|
@see GetItemToolTip(), wxWindow::SetToolTip
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetItemToolTip(unsigned int item, const wxString& text);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the radiobox label.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
The label to set.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The zero-based button index.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetLabel(const wxString& label);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets a button by passing the desired string position. This does not cause
|
|
|
|
a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
|
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
|
|
|
*/
|
|
|
|
void SetSelection(int n);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the selection to a button by passing the desired string. This does not
|
|
|
|
cause
|
|
|
|
a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
|
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 label of the button to select.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetStringSelection(const wxString& string);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|