]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/checkbox.h
Respect wxListItem::m_mask in general list control Set/GetItem() and allow
[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 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CHECKBOX_H_
13 #define _WX_CHECKBOX_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "checkbox.h"
17 #endif
18
19 // Checkbox item (single checkbox)
20 class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
21 {
22 public:
23 wxCheckBox() { }
24 wxCheckBox(wxWindow *parent,
25 wxWindowID id,
26 const wxString& label,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxCheckBoxNameStr)
32 {
33 Create(parent, id, label, pos, size, style, validator, name);
34 }
35
36 bool Create(wxWindow *parent,
37 wxWindowID id,
38 const wxString& label,
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 void SetValue(bool value);
46 virtual bool GetValue() const;
47
48 // override some base class virtuals
49 virtual bool MSWCommand(WXUINT param, WXWORD id);
50 virtual void Command(wxCommandEvent& event);
51 virtual bool SetForegroundColour(const wxColour& colour);
52
53 protected:
54 virtual wxSize DoGetBestSize() const;
55 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
56
57 virtual void DoSet3StateValue(wxCheckBoxState value);
58 virtual wxCheckBoxState DoGet3StateValue() const;
59
60 // make the checkbox owner drawn or reset it to normal style
61 void MakeOwnerDrawn(bool ownerDrawn);
62
63 // return true if this checkbox is owner drawn
64 bool IsOwnerDrawn() const;
65
66 private:
67 // common part of all ctors
68 void Init();
69
70 // event handlers used by owner-drawn checkbox
71 void OnMouseEnterOrLeave(wxMouseEvent& event);
72 void OnMouseLeft(wxMouseEvent& event);
73 void OnFocus(wxFocusEvent& event);
74
75
76 // current state of the checkbox
77 wxCheckBoxState m_state;
78
79 // true if the checkbox is currently pressed
80 bool m_isPressed;
81
82 // true if mouse is currently over the control
83 bool m_isHot;
84
85
86 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox)
87 };
88
89 #endif
90 // _WX_CHECKBOX_H_