]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/checkbox.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / msw / checkbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/checkbox.h
3 // Purpose: wxCheckBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_CHECKBOX_H_
12 #define _WX_CHECKBOX_H_
13
14 // Checkbox item (single checkbox)
15 class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
16 {
17 public:
18 wxCheckBox() { }
19 wxCheckBox(wxWindow *parent,
20 wxWindowID id,
21 const wxString& label,
22 const wxPoint& pos = wxDefaultPosition,
23 const wxSize& size = wxDefaultSize,
24 long style = 0,
25 const wxValidator& validator = wxDefaultValidator,
26 const wxString& name = wxCheckBoxNameStr)
27 {
28 Create(parent, id, label, pos, size, style, validator, name);
29 }
30
31 bool Create(wxWindow *parent,
32 wxWindowID id,
33 const wxString& label,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString& name = wxCheckBoxNameStr);
39
40 virtual void SetValue(bool value);
41 virtual bool GetValue() const;
42
43 // override some base class virtuals
44 virtual void SetLabel(const wxString& label);
45
46 virtual bool MSWCommand(WXUINT param, WXWORD id);
47 virtual void Command(wxCommandEvent& event);
48 virtual bool SetForegroundColour(const wxColour& colour);
49 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
50
51 // returns true if the platform should explicitly apply a theme border
52 virtual bool CanApplyThemeBorder() const { return false; }
53
54 // make the checkbox owner drawn or reset it to normal style
55 void MSWMakeOwnerDrawn(bool ownerDrawn);
56
57 // implementation only from now on
58 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
59
60 protected:
61 virtual wxSize DoGetBestClientSize() const;
62
63 virtual void DoSet3StateValue(wxCheckBoxState value);
64 virtual wxCheckBoxState DoGet3StateValue() const;
65
66 // return true if this checkbox is owner drawn
67 bool IsOwnerDrawn() const;
68
69 private:
70 // common part of all ctors
71 void Init();
72
73 // event handlers used by owner-drawn checkbox
74 void OnMouseEnterOrLeave(wxMouseEvent& event);
75 void OnMouseLeft(wxMouseEvent& event);
76 void OnFocus(wxFocusEvent& event);
77
78
79 // current state of the checkbox
80 wxCheckBoxState m_state;
81
82 // true if the checkbox is currently pressed
83 bool m_isPressed;
84
85 // true if mouse is currently over the control
86 bool m_isHot;
87
88
89 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox)
90 };
91
92 #endif
93 // _WX_CHECKBOX_H_