]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/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/defs.h" | |
19 | ||
20 | class wxOwnerDrawn; // so the compiler knows, it is a class. | |
21 | ||
22 | class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase | |
23 | { | |
24 | public: | |
25 | // | |
26 | // Ctors | |
27 | // | |
28 | wxCheckListBox(); | |
29 | wxCheckListBox( wxWindow* pParent | |
30 | ,wxWindowID vId | |
31 | ,const wxPoint& rPos = wxDefaultPosition | |
32 | ,const wxSize& vSize = wxDefaultSize | |
33 | ,int nStrings = 0 | |
34 | ,const wxString asChoices[] = NULL | |
35 | ,long lStyle = 0 | |
36 | ,const wxValidator& rValidator = wxDefaultValidator | |
37 | ,const wxString& rsName = wxListBoxNameStr | |
38 | ); | |
39 | wxCheckListBox( wxWindow* pParent | |
40 | ,wxWindowID vId | |
41 | ,const wxPoint& rPos | |
42 | ,const wxSize& vSize | |
43 | ,const wxArrayString& asChoices | |
44 | ,long lStyle = 0 | |
45 | ,const wxValidator& rValidator = wxDefaultValidator | |
46 | ,const wxString& rsName = wxListBoxNameStr | |
47 | ); | |
48 | ||
49 | // | |
50 | // Override base class virtuals | |
51 | // | |
52 | virtual void Delete(int n); | |
53 | ||
54 | virtual bool SetFont(const wxFont &rFont); | |
55 | ||
56 | // | |
57 | // Items may be checked | |
58 | // | |
59 | bool IsChecked(size_t uiIndex) const; | |
60 | void Check( size_t uiIndex | |
61 | ,bool bCheck = true | |
62 | ); | |
63 | ||
64 | // | |
65 | // Accessors | |
66 | // | |
67 | size_t GetItemHeight(void) const { return m_nItemHeight; } | |
68 | ||
69 | protected: | |
70 | // | |
71 | // We create our items ourselves and they have non-standard size, | |
72 | // so we need to override these functions | |
73 | // | |
74 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
75 | virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); | |
76 | ||
77 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
78 | ||
79 | // | |
80 | // Pressing space or clicking the check box toggles the item | |
81 | // | |
82 | void OnChar(wxKeyEvent& rEvent); | |
83 | void OnLeftClick(wxMouseEvent& rEvent); | |
84 | ||
85 | private: | |
86 | size_t m_nItemHeight; // height of checklistbox items (the same for all) | |
87 | ||
88 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
89 | DECLARE_EVENT_TABLE() | |
90 | }; // end of CLASS wxCheckListBox | |
91 | ||
92 | #endif | |
93 | // _WX_CHECKLST_H_ |