1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tglbtn.h
3 // Purpose: Declaration of the wxToggleButton class, which implements a
4 // toggle button under wxMSW.
5 // Author: John Norris, minor changes by Axel Schlueter
9 // Copyright: (c) 2000 Johnny C. Norris II
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_TOGGLEBUTTON_H_
14 #define _WX_TOGGLEBUTTON_H_
16 #include "wx/bitmap.h"
18 //-----------------------------------------------------------------------------
19 // wxBitmapToggleButton
20 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButtonBase
26 // construction/destruction
27 wxBitmapToggleButton() { Init(); }
28 wxBitmapToggleButton(wxWindow
*parent
,
30 const wxBitmap
& label
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxCheckBoxNameStr
)
37 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
41 bool Create(wxWindow
*parent
,
43 const wxBitmap
& label
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
, long style
= 0,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxCheckBoxNameStr
);
50 void SetValue(bool state
);
51 bool GetValue() const;
54 virtual void SetLabel(const wxString
& label
) { wxControl::SetLabel(label
); }
55 virtual void SetLabel(const wxBitmap
& label
);
56 bool Enable(bool enable
= true);
62 wxBitmap m_disabledBitmap
;
64 bool m_depressed
,m_oldValue
;
66 void OnPaint(wxPaintEvent
&event
);
67 void OnMouse(wxMouseEvent
&event
);
68 void OnChar(wxKeyEvent
&event
);
69 void OnSize(wxSizeEvent
&event
);
71 virtual wxSize
DoGetBestSize() const;
75 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
78 // Checkbox item (single checkbox)
79 class WXDLLIMPEXP_CORE wxToggleButton
: public wxToggleButtonBase
83 wxToggleButton(wxWindow
*parent
,
85 const wxString
& label
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
89 const wxValidator
& validator
= wxDefaultValidator
,
90 const wxString
& name
= wxCheckBoxNameStr
)
92 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
95 bool Create(wxWindow
*parent
,
97 const wxString
& label
,
98 const wxPoint
& pos
= wxDefaultPosition
,
99 const wxSize
& size
= wxDefaultSize
,
101 const wxValidator
& validator
= wxDefaultValidator
,
102 const wxString
& name
= wxCheckBoxNameStr
);
104 virtual void SetValue(bool value
);
105 virtual bool GetValue() const ;
107 virtual void SetLabel(const wxString
& label
);
109 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
110 virtual void Command(wxCommandEvent
& event
);
112 // returns true if the platform should explicitly apply a theme border
113 virtual bool CanApplyThemeBorder() const { return false; }
116 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
117 virtual wxSize
DoGetBestSize() const;
119 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
122 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton
)
125 #endif // _WX_TOGGLEBUTTON_H_