X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..ea160f01c60cfc879e1ba3ffec76d113a0404603:/interface/wx/tglbtn.h diff --git a/interface/wx/tglbtn.h b/interface/wx/tglbtn.h index 4a679c7ee1..672836ebc0 100644 --- a/interface/wx/tglbtn.h +++ b/interface/wx/tglbtn.h @@ -1,40 +1,43 @@ ///////////////////////////////////////////////////////////////////////////// // Name: tglbtn.h -// Purpose: interface of wxBitmapToggleButton +// Purpose: interface of wxBitmapToggleButton, wxToggleButton // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +wxEventType wxEVT_TOGGLEBUTTON; + /** @class wxToggleButton - @wxheader{tglbtn.h} - 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. + 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. Since wxWidgets version 2.9.0 this control emits an update UI event. - You can see wxToggleButton in action in the sixth page of the - controls() sample. + You can see wxToggleButton in action in @ref page_samples_controls. - @beginEventTable{wxCommandEvent} + @beginEventEmissionTable{wxCommandEvent} @event{EVT_TOGGLEBUTTON(id, func)} - Handles a toggle button click event. + Handles a wxEVT_TOGGLEBUTTON event. @endEventTable @library{wxcore} @category{ctrl} - + @appearance{togglebutton} @see wxCheckBox, wxButton, wxBitmapToggleButton */ -class wxToggleButton : public wxControl +class wxToggleButton : public wxAnyButton { public: - //@{ + /** + Default constructor. + */ + wxToggleButton(); + /** Constructor, creating and showing a toggle button. @@ -45,29 +48,27 @@ public: @param label Text to be displayed next to the toggle button. @param pos - Toggle button position. If wxDefaultPosition is specified then a - default position is chosen. + Toggle button position. + If ::wxDefaultPosition is specified then a default position is chosen. @param size - Toggle button size. If wxDefaultSize is specified then a - default size is chosen. + Toggle button size. + If ::wxDefaultSize is specified then a default size is chosen. @param style Window style. See wxToggleButton. - @param validator + @param val Window validator. @param name Window name. @see Create(), wxValidator */ - wxToggleButton(); wxToggleButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val = wxDefaultValidator, - const wxString& name = "checkBox"); - //@} + const wxString& name = wxCheckBoxNameStr); /** Destructor, destroying the toggle button. @@ -75,8 +76,8 @@ public: virtual ~wxToggleButton(); /** - Creates the toggle button for two-step construction. See wxToggleButton() - for details. + Creates the toggle button for two-step construction. + See wxToggleButton() for details. */ bool Create(wxWindow* parent, wxWindowID id, const wxString& label, @@ -84,61 +85,67 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val = wxDefaultValidator, - const wxString& name = "checkBox"); + const wxString& name = wxCheckBoxNameStr); /** Gets the state of the toggle button. @return Returns @true if it is pressed, @false otherwise. */ - bool GetValue() const; + virtual bool GetValue() const; /** - Sets the toggle button to the given state. This does not cause a - @c EVT_TOGGLEBUTTON event to be emitted. + Sets the toggle button to the given state. + This does not cause a @c EVT_TOGGLEBUTTON event to be emitted. @param state If @true, the button is pressed. */ - void SetValue(bool state); + virtual void SetValue(bool state); }; /** @class wxBitmapToggleButton - @wxheader{tglbtn.h} - wxBitmapToggleButton is a wxToggleButton - that contains a bitmap instead of text. + 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). This control emits an update UI event. - @beginEventTable{wxCommandEvent} + @beginEventEmissionTable{wxCommandEvent} @event{EVT_TOGGLEBUTTON(id, func)} - Handles a toggle button click event. + Handles a wxEVT_TOGGLEBUTTON event. @endEventTable @library{wxcore} @category{ctrl} - */ -class wxBitmapToggleButton : public wxControl +class wxBitmapToggleButton : public wxToggleButton { public: - //@{ + /** + Default constructor. + */ + wxBitmapToggleButton(); + /** Constructor, creating and showing a toggle button with the bitmap @e label. Internally calls Create(). */ - wxBitmapToggleButton(); wxBitmapToggleButton(wxWindow* parent, wxWindowID id, const wxBitmap& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val = wxDefaultValidator, - const wxString& name = "checkBox"); - //@} + const wxString& name = wxCheckBoxNameStr); /** Create method for two-step construction. @@ -149,7 +156,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val = wxDefaultValidator, - const wxString& name = "checkBox"); + const wxString& name = wxCheckBoxNameStr); /** Gets the state of the toggle button. @@ -159,8 +166,8 @@ public: virtual bool GetValue() const; /** - Sets the toggle button to the given state. This does not cause a - @c EVT_TOGGLEBUTTON event to be emitted. + Sets the toggle button to the given state. + This does not cause a @c EVT_TOGGLEBUTTON event to be emitted. @param state If @true, the button is pressed.