]>
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 WXDLLIMPEXP_CORE 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(unsigned int n); | |
53 | ||
54 | virtual bool SetFont(const wxFont &rFont); | |
55 | ||
56 | // | |
57 | // Items may be checked | |
58 | // | |
59 | bool IsChecked(unsigned int uiIndex) const; | |
60 | void Check(unsigned int uiIndex, bool bCheck = true); | |
61 | ||
62 | // | |
63 | // Accessors | |
64 | // | |
65 | size_t GetItemHeight(void) const { return m_nItemHeight; } | |
66 | ||
67 | protected: | |
68 | // | |
69 | // We create our items ourselves and they have non-standard size, | |
70 | // so we need to override these functions | |
71 | // | |
72 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
73 | virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); | |
74 | ||
75 | // | |
76 | // Pressing space or clicking the check box toggles the item | |
77 | // | |
78 | void OnChar(wxKeyEvent& rEvent); | |
79 | void OnLeftClick(wxMouseEvent& rEvent); | |
80 | ||
81 | private: | |
82 | size_t m_nItemHeight; // height of checklistbox items (the same for all) | |
83 | ||
84 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
85 | DECLARE_EVENT_TABLE() | |
86 | }; // end of CLASS wxCheckListBox | |
87 | ||
88 | #endif | |
89 | // _WX_CHECKLST_H_ |