]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 16.11.97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
9 | // Licence: wxWindows license | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __CHECKLST_H__ | |
13 | #define __CHECKLST_H__ | |
14 | ||
15 | typedef unsigned int uint; | |
16 | ||
17 | #if !USE_OWNER_DRAWN | |
18 | #error "wxCheckListBox class requires owner-drawn functionality." | |
19 | #endif | |
20 | ||
21 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp | |
22 | ||
23 | class wxCheckListBox : public wxListBox | |
24 | { | |
25 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
26 | public: | |
27 | // ctors | |
28 | wxCheckListBox(); | |
29 | wxCheckListBox(wxWindow *parent, const wxWindowID id, | |
30 | const wxPoint& pos = wxDefaultPosition, | |
31 | const wxSize& size = wxDefaultSize, | |
32 | const int nStrings = 0, | |
33 | const wxString choices[] = NULL, | |
34 | const long style = 0, | |
35 | const wxValidator& validator = wxDefaultValidator, | |
36 | const wxString& name = wxListBoxNameStr); | |
37 | // const wxFont& font = wxNullFont); | |
38 | ||
39 | // items may be checked | |
40 | bool IsChecked(uint uiIndex) const; | |
41 | void Check(uint uiIndex, bool bCheck = TRUE); | |
42 | ||
43 | // accessors | |
44 | uint GetItemHeight() const { return m_nItemHeight; } | |
45 | ||
46 | protected: | |
47 | // we create our items ourselves and they have non-standard size, | |
48 | // so we need to override these functions | |
49 | virtual wxOwnerDrawn *CreateItem(uint n); | |
50 | virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); | |
51 | ||
52 | // pressing space or clicking the check box toggles the item | |
53 | void OnChar(wxKeyEvent& event); | |
54 | void OnLeftClick(wxMouseEvent& event); | |
55 | ||
56 | private: | |
57 | uint m_nItemHeight; // height of checklistbox items (the same for all) | |
58 | ||
59 | DECLARE_EVENT_TABLE() | |
60 | }; | |
61 | ||
62 | #endif //_CHECKLST_H |