]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Note: this is an optional class. | |
37f214d5 | 5 | // Author: David Webster |
a419c3b1 | 6 | // Modified by: |
37f214d5 | 7 | // Created: 10/13/99 |
0e320a79 | 8 | // RCS-ID: $Id$ |
37f214d5 | 9 | // Copyright: (c) David Webster |
0e320a79 DW |
10 | // Licence: wxWindows licence |
11 | /////////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_CHECKLST_H_ | |
14 | #define _WX_CHECKLST_H_ | |
15 | ||
37f214d5 | 16 | #include <stddef.h> |
0e320a79 | 17 | |
37f214d5 | 18 | #include "wx/setup.h" |
0e320a79 | 19 | |
1de4baa3 | 20 | class wxOwnerDrawn; // so the compiler knows, it is a class. |
023d13a6 | 21 | |
37f214d5 | 22 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp |
0e320a79 | 23 | |
37f214d5 | 24 | class WXDLLEXPORT wxCheckListBox : public wxListBox |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
f5ea767e | 27 | // |
1de4baa3 DW |
28 | // Ctors |
29 | // | |
30 | wxCheckListBox(); | |
31 | wxCheckListBox( wxWindow* pParent | |
32 | ,wxWindowID vId | |
33 | ,const wxPoint& rPos = wxDefaultPosition | |
34 | ,const wxSize& vSize = wxDefaultSize | |
35 | ,int nStrings = 0 | |
36 | ,const wxString asChoices[] = NULL | |
37 | ,long lStyle = 0 | |
1de4baa3 | 38 | ,const wxValidator& rValidator = wxDefaultValidator |
1de4baa3 DW |
39 | ,const wxString& rsName = wxListBoxNameStr |
40 | ); | |
584ad2a3 MB |
41 | wxCheckListBox( wxWindow* pParent |
42 | ,wxWindowID vId | |
43 | ,const wxPoint& rPos | |
44 | ,const wxSize& vSize | |
45 | ,const wxArrayString& asChoices | |
46 | ,long lStyle = 0 | |
47 | ,const wxValidator& rValidator = wxDefaultValidator | |
48 | ,const wxString& rsName = wxListBoxNameStr | |
49 | ); | |
1de4baa3 | 50 | |
f5ea767e | 51 | // |
1de4baa3 DW |
52 | // Override base class virtuals |
53 | // | |
54 | virtual void Delete(int n); | |
55 | virtual void InsertItems( int nItems | |
56 | ,const wxString asItems[] | |
57 | ,int nPos | |
58 | ); | |
59 | ||
60 | virtual bool SetFont(const wxFont &rFont); | |
61 | ||
f5ea767e | 62 | // |
1de4baa3 DW |
63 | // Items may be checked |
64 | // | |
65 | bool IsChecked(size_t uiIndex) const; | |
66 | void Check( size_t uiIndex | |
67 | ,bool bCheck = TRUE | |
68 | ); | |
69 | ||
f5ea767e | 70 | // |
1de4baa3 DW |
71 | // Accessors |
72 | // | |
73 | size_t GetItemHeight(void) const { return m_nItemHeight; } | |
37f214d5 DW |
74 | |
75 | protected: | |
f5ea767e | 76 | // |
1de4baa3 DW |
77 | // We create our items ourselves and they have non-standard size, |
78 | // so we need to override these functions | |
79 | // | |
80 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
f5ea767e | 81 | virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); |
1de4baa3 | 82 | |
f5ea767e | 83 | // |
1de4baa3 DW |
84 | // Pressing space or clicking the check box toggles the item |
85 | // | |
86 | void OnChar(wxKeyEvent& rEvent); | |
87 | void OnLeftClick(wxMouseEvent& rEvent); | |
37f214d5 DW |
88 | |
89 | private: | |
1de4baa3 DW |
90 | size_t m_nItemHeight; // height of checklistbox items (the same for all) |
91 | ||
1de4baa3 DW |
92 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) |
93 | DECLARE_EVENT_TABLE() | |
94 | }; // end of CLASS wxCheckListBoxItem | |
0e320a79 DW |
95 | |
96 | #endif | |
a419c3b1 | 97 | // _WX_CHECKLST_H_ |