Support using GetTextExtent() with empty string to get descent in wxOSX.
[wxWidgets.git] / include / wx / univ / tglbtn.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/tglbtn.h
3 // Purpose: wxToggleButton for wxUniversal
4 // Author: Vadim Zeitlin
5 // Modified by: David Bjorkevik
6 // Created: 16.05.06
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_TGLBTN_H_
13 #define _WX_UNIV_TGLBTN_H_
14
15 #include "wx/button.h"
16
17 // ----------------------------------------------------------------------------
18 // wxToggleButton: a push button
19 // ----------------------------------------------------------------------------
20
21 class WXDLLIMPEXP_CORE wxToggleButton: public wxButton
22 {
23 public:
24 wxToggleButton();
25
26 wxToggleButton(wxWindow *parent,
27 wxWindowID id,
28 const wxBitmap& bitmap,
29 const wxString& label = wxEmptyString,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxCheckBoxNameStr);
35
36 wxToggleButton(wxWindow *parent,
37 wxWindowID id,
38 const wxString& label = wxEmptyString,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxCheckBoxNameStr);
44
45 virtual ~wxToggleButton();
46
47 virtual bool IsPressed() const { return m_isPressed || m_value; }
48
49 // wxToggleButton actions
50 virtual void Toggle();
51 virtual void Click();
52
53 // Get/set the value
54 void SetValue(bool state);
55 bool GetValue() const { return m_value; }
56
57 protected:
58 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
59
60 // the current value
61 bool m_value;
62
63 private:
64 // common part of all ctors
65 void Init();
66
67 DECLARE_DYNAMIC_CLASS(wxToggleButton)
68 };
69
70 #endif // _WX_UNIV_TGLBTN_H_