]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/checklst.h
Made return a const reference
[wxWidgets.git] / include / wx / msw / checklst.h
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 licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __CHECKLST__H_
13 #define __CHECKLST__H_
14
15 #ifdef __GNUG__
16 #pragma interface "checklst.h"
17 #endif
18
19 // No!
20 // typedef unsigned int size_t;
21 #include <stddef.h>
22
23 #if !wxUSE_OWNER_DRAWN
24 #error "wxCheckListBox class requires owner-drawn functionality."
25 #endif
26
27 class wxCheckListBoxItem; // fwd decl, define in checklst.cpp
28
29 class WXDLLEXPORT wxCheckListBox : public wxListBox
30 {
31 DECLARE_DYNAMIC_CLASS(wxCheckListBox)
32 public:
33 // ctors
34 wxCheckListBox();
35 wxCheckListBox(wxWindow *parent, wxWindowID id,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 int nStrings = 0,
39 const wxString choices[] = NULL,
40 long style = 0,
41 const wxValidator& validator = wxDefaultValidator,
42 const wxString& name = wxListBoxNameStr);
43
44 // override base class virtuals
45 virtual void Delete(int n);
46 virtual void InsertItems(int nItems, const wxString items[], int pos);
47
48 // items may be checked
49 bool IsChecked(size_t uiIndex) const;
50 void Check(size_t uiIndex, bool bCheck = TRUE);
51
52 // accessors
53 size_t GetItemHeight() const { return m_nItemHeight; }
54
55 protected:
56 // we create our items ourselves and they have non-standard size,
57 // so we need to override these functions
58 virtual wxOwnerDrawn *CreateItem(size_t n);
59 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
60
61 // pressing space or clicking the check box toggles the item
62 void OnChar(wxKeyEvent& event);
63 void OnLeftClick(wxMouseEvent& event);
64
65 private:
66 size_t m_nItemHeight; // height of checklistbox items (the same for all)
67
68 DECLARE_EVENT_TABLE()
69 };
70
71 #endif //_CHECKLST_H