2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tglbtn.h
|
2008-10-04 11:55:28 +00:00
|
|
|
// Purpose: interface of wxBitmapToggleButton, wxToggleButton
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2013-04-25 10:11:03 +00:00
|
|
|
wxEventType wxEVT_TOGGLEBUTTON;
|
2012-12-29 02:32:16 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxToggleButton
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-04 11:55:28 +00:00
|
|
|
wxToggleButton is a button that stays pressed when clicked by the user.
|
|
|
|
In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Since wxWidgets version 2.9.0 this control emits an update UI event.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-04 11:55:28 +00:00
|
|
|
You can see wxToggleButton in action in @ref page_samples_controls.
|
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_TOGGLEBUTTON(id, func)}
|
2013-04-25 10:11:03 +00:00
|
|
|
Handles a wxEVT_TOGGLEBUTTON event.
|
2008-03-08 13:52:38 +00:00
|
|
|
@endEventTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 18:32:50 +00:00
|
|
|
@appearance{togglebutton}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxCheckBox, wxButton, wxBitmapToggleButton
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2011-11-04 03:38:09 +00:00
|
|
|
class wxToggleButton : public wxAnyButton
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-09-01 13:48:57 +00:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxToggleButton();
|
2008-09-21 23:13:49 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a toggle button.
|
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-03-09 12:33:59 +00:00
|
|
|
Toggle button identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param label
|
2008-03-09 12:33:59 +00:00
|
|
|
Text to be displayed next to the toggle button.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-10-04 11:55:28 +00:00
|
|
|
Toggle button position.
|
2009-04-21 11:21:36 +00:00
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-10-04 11:55:28 +00:00
|
|
|
Toggle button size.
|
2009-04-21 11:21:36 +00:00
|
|
|
If ::wxDefaultSize is specified then a default size is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxToggleButton.
|
2008-10-04 14:52:38 +00:00
|
|
|
@param val
|
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
|
|
|
|
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
|
|
|
wxToggleButton(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2008-03-25 12:22:08 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2008-09-21 23:13:49 +00:00
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the toggle button.
|
|
|
|
*/
|
2008-03-25 12:22:08 +00:00
|
|
|
virtual ~wxToggleButton();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:55:28 +00:00
|
|
|
Creates the toggle button for two-step construction.
|
|
|
|
See wxToggleButton() for details.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2008-03-25 12:22:08 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2008-09-21 23:13:49 +00:00
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the state of the toggle button.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return Returns @true if it is pressed, @false otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool GetValue() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-04 11:55:28 +00:00
|
|
|
Sets the toggle button to the given state.
|
|
|
|
This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param state
|
2008-03-09 12:33:59 +00:00
|
|
|
If @true, the button is pressed.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual void SetValue(bool state);
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-25 12:22:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxBitmapToggleButton
|
|
|
|
|
2010-10-01 13:05:36 +00:00
|
|
|
wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
|
|
|
|
text.
|
|
|
|
|
|
|
|
This class is not available in all ports currently (although it is
|
|
|
|
available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to
|
|
|
|
determine whether it can be used (in addition for possibly testing for
|
|
|
|
@c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for
|
|
|
|
this class and wxToggleButton).
|
2008-03-25 12:22:08 +00:00
|
|
|
|
|
|
|
This control emits an update UI event.
|
|
|
|
|
2009-02-18 17:58:51 +00:00
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-04-06 14:43:04 +00:00
|
|
|
@event{EVT_TOGGLEBUTTON(id, func)}
|
2013-04-25 10:11:03 +00:00
|
|
|
Handles a wxEVT_TOGGLEBUTTON event.
|
2008-03-25 12:22:08 +00:00
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
|
|
|
*/
|
2011-11-04 03:38:09 +00:00
|
|
|
class wxBitmapToggleButton : public wxToggleButton
|
2008-03-25 12:22:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-09-01 13:48:57 +00:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxBitmapToggleButton();
|
2008-09-21 23:13:49 +00:00
|
|
|
|
2008-03-25 12:22:08 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a toggle button with the bitmap @e label.
|
|
|
|
Internally calls Create().
|
|
|
|
*/
|
|
|
|
wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2008-09-21 23:13:49 +00:00
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
2008-03-25 12:22:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Create method for two-step construction.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2008-09-21 23:13:49 +00:00
|
|
|
const wxString& name = wxCheckBoxNameStr);
|
2008-03-25 12:22:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the state of the toggle button.
|
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return Returns @true if it is pressed, @false otherwise.
|
2008-03-25 12:22:08 +00:00
|
|
|
*/
|
|
|
|
virtual bool GetValue() const;
|
|
|
|
|
|
|
|
/**
|
2008-10-04 11:55:28 +00:00
|
|
|
Sets the toggle button to the given state.
|
|
|
|
This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
|
2008-03-25 12:22:08 +00:00
|
|
|
|
|
|
|
@param state
|
|
|
|
If @true, the button is pressed.
|
|
|
|
*/
|
|
|
|
virtual void SetValue(bool state);
|
|
|
|
};
|
|
|
|
|