| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: checkbox.h |
| 3 | // Purpose: wxCheckBox class |
| 4 | // Author: David Webster |
| 5 | // Modified by: |
| 6 | // Created: 10/13/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) David Webster |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_CHECKBOX_H_ |
| 13 | #define _WX_CHECKBOX_H_ |
| 14 | |
| 15 | #include "wx/control.h" |
| 16 | |
| 17 | // Checkbox item (single checkbox) |
| 18 | class WXDLLEXPORT wxBitmap; |
| 19 | class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase |
| 20 | { |
| 21 | public: |
| 22 | inline wxCheckBox() { } |
| 23 | inline wxCheckBox( wxWindow* pParent |
| 24 | ,wxWindowID vId |
| 25 | ,const wxString& rsLabel |
| 26 | ,const wxPoint& rPos = wxDefaultPosition |
| 27 | ,const wxSize& rSize = wxDefaultSize |
| 28 | ,long lStyle = 0 |
| 29 | #if wxUSE_VALIDATORS |
| 30 | ,const wxValidator& rValidator = wxDefaultValidator |
| 31 | #endif |
| 32 | ,const wxString& rsName = wxCheckBoxNameStr |
| 33 | ) |
| 34 | { |
| 35 | Create( pParent |
| 36 | ,vId |
| 37 | ,rsLabel |
| 38 | ,rPos |
| 39 | ,rSize |
| 40 | ,lStyle |
| 41 | #if wxUSE_VALIDATORS |
| 42 | ,rValidator |
| 43 | #endif |
| 44 | ,rsName |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | bool Create( wxWindow* pParent |
| 49 | ,wxWindowID vId |
| 50 | ,const wxString& rsLabel |
| 51 | ,const wxPoint& rPos = wxDefaultPosition |
| 52 | ,const wxSize& rSize = wxDefaultSize |
| 53 | ,long lStyle = 0 |
| 54 | #if wxUSE_VALIDATORS |
| 55 | ,const wxValidator& rValidator = wxDefaultValidator |
| 56 | #endif |
| 57 | ,const wxString& rsName = wxCheckBoxNameStr |
| 58 | ); |
| 59 | |
| 60 | virtual void SetValue(bool bValue); |
| 61 | virtual bool GetValue(void) const ; |
| 62 | |
| 63 | virtual bool OS2Command( WXUINT uParam |
| 64 | ,WXWORD wId |
| 65 | ); |
| 66 | virtual void SetLabel(const wxString& rsLabel); |
| 67 | virtual void Command(wxCommandEvent& rEvent); |
| 68 | |
| 69 | protected: |
| 70 | virtual wxSize DoGetBestSize(void) const; |
| 71 | private: |
| 72 | DECLARE_DYNAMIC_CLASS(wxCheckBox) |
| 73 | }; |
| 74 | |
| 75 | class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox |
| 76 | { |
| 77 | public: |
| 78 | |
| 79 | inline wxBitmapCheckBox() { m_nCheckWidth = -1; m_nCheckHeight = -1; } |
| 80 | inline wxBitmapCheckBox( wxWindow* pParent |
| 81 | ,wxWindowID vId |
| 82 | ,const wxBitmap* pLabel |
| 83 | ,const wxPoint& rPos = wxDefaultPosition |
| 84 | ,const wxSize& rSize = wxDefaultSize |
| 85 | ,long lStyle = 0 |
| 86 | #if wxUSE_VALIDATORS |
| 87 | ,const wxValidator& rValidator = wxDefaultValidator |
| 88 | #endif |
| 89 | ,const wxString& rsName = wxCheckBoxNameStr |
| 90 | ) |
| 91 | { |
| 92 | Create( pParent |
| 93 | ,vId |
| 94 | ,pLabel |
| 95 | ,rPos |
| 96 | ,rSize |
| 97 | ,lStyle |
| 98 | ,rValidator |
| 99 | ,rsName |
| 100 | ); |
| 101 | } |
| 102 | |
| 103 | bool Create( wxWindow* pParent |
| 104 | ,wxWindowID vId |
| 105 | ,const wxBitmap* pLabel |
| 106 | ,const wxPoint& rPos = wxDefaultPosition |
| 107 | ,const wxSize& rSize = wxDefaultSize |
| 108 | ,long lStyle = 0 |
| 109 | #if wxUSE_VALIDATORS |
| 110 | ,const wxValidator& rValidator = wxDefaultValidator |
| 111 | #endif |
| 112 | ,const wxString& rsName = wxCheckBoxNameStr |
| 113 | ); |
| 114 | |
| 115 | virtual void SetLabel(const wxBitmap& rBitmap); |
| 116 | |
| 117 | int m_nCheckWidth; |
| 118 | int m_nCheckHeight; |
| 119 | |
| 120 | private: |
| 121 | |
| 122 | virtual void SetLabel(const wxString& rsString) |
| 123 | { wxCheckBox::SetLabel(rsString); }; |
| 124 | DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) |
| 125 | }; |
| 126 | #endif |
| 127 | // _WX_CHECKBOX_H_ |