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