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 // License: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_TOGGLEBUTTON_H_
14 #define _WX_TOGGLEBUTTON_H_
16 #include "wx/bitmap.h"
18 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr
[];
20 //-----------------------------------------------------------------------------
21 // wxBitmapToggleButton
22 //-----------------------------------------------------------------------------
25 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButtonBase
28 // construction/destruction
29 wxBitmapToggleButton() { Init(); }
30 wxBitmapToggleButton(wxWindow
*parent
,
32 const wxBitmap
& label
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
36 const wxValidator
& validator
= wxDefaultValidator
,
37 const wxString
& name
= wxCheckBoxNameStr
)
39 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
43 bool Create(wxWindow
*parent
,
45 const wxBitmap
& label
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
, long style
= 0,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxCheckBoxNameStr
);
52 void SetValue(bool state
);
53 bool GetValue() const;
56 virtual void SetLabel(const wxString
& label
) { wxControl::SetLabel(label
); }
57 virtual void SetLabel(const wxBitmap
& label
);
58 bool Enable(bool enable
= true);
64 wxBitmap m_disabledBitmap
;
66 bool m_depressed
,m_oldValue
;
68 void OnPaint(wxPaintEvent
&event
);
69 void OnMouse(wxMouseEvent
&event
);
70 void OnChar(wxKeyEvent
&event
);
71 void OnSize(wxSizeEvent
&event
);
73 virtual wxSize
DoGetBestSize() const;
77 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
80 // Checkbox item (single checkbox)
81 class WXDLLIMPEXP_CORE wxToggleButton
: public wxToggleButtonBase
85 wxToggleButton(wxWindow
*parent
,
87 const wxString
& label
,
88 const wxPoint
& pos
= wxDefaultPosition
,
89 const wxSize
& size
= wxDefaultSize
,
91 const wxValidator
& validator
= wxDefaultValidator
,
92 const wxString
& name
= wxCheckBoxNameStr
)
94 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
97 bool Create(wxWindow
*parent
,
99 const wxString
& label
,
100 const wxPoint
& pos
= wxDefaultPosition
,
101 const wxSize
& size
= wxDefaultSize
,
103 const wxValidator
& validator
= wxDefaultValidator
,
104 const wxString
& name
= wxCheckBoxNameStr
);
106 virtual void SetValue(bool value
);
107 virtual bool GetValue() const ;
109 virtual void SetLabel(const wxString
& label
);
111 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
112 virtual void Command(wxCommandEvent
& event
);
114 // returns true if the platform should explicitly apply a theme border
115 virtual bool CanApplyThemeBorder() const { return false; }
118 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
119 virtual wxSize
DoGetBestSize() const;
121 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
124 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton
)
127 #endif // _WX_TOGGLEBUTTON_H_