]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/checklst.h
correction to last commit: Korean and Romanian translations will only be in 2.9.1...
[wxWidgets.git] / include / wx / msw / checklst.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/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 #if !wxUSE_OWNER_DRAWN
16 #error "wxCheckListBox class requires owner-drawn functionality."
17 #endif
18
19 class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
20 class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
21
22 class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
23 {
24 public:
25 // ctors
26 wxCheckListBox();
27 wxCheckListBox(wxWindow *parent, wxWindowID id,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 int nStrings = 0,
31 const wxString choices[] = NULL,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxListBoxNameStr);
35 wxCheckListBox(wxWindow *parent, wxWindowID id,
36 const wxPoint& pos,
37 const wxSize& size,
38 const wxArrayString& choices,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxListBoxNameStr);
42
43 bool Create(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = NULL,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr);
50 bool Create(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos,
52 const wxSize& size,
53 const wxArrayString& choices,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxListBoxNameStr);
57
58 // override base class virtuals
59 virtual void Delete(unsigned int n);
60
61 virtual bool SetFont( const wxFont &font );
62
63 // items may be checked
64 virtual bool IsChecked(unsigned int uiIndex) const;
65 virtual void Check(unsigned int uiIndex, bool bCheck = true);
66
67 // accessors
68 size_t GetItemHeight() const { return m_nItemHeight; }
69
70 // we create our items ourselves and they have non-standard size,
71 // so we need to override these functions
72 virtual wxOwnerDrawn *CreateLboxItem(size_t n);
73 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
74
75 protected:
76 // pressing space or clicking the check box toggles the item
77 void OnKeyDown(wxKeyEvent& event);
78 void OnLeftClick(wxMouseEvent& event);
79
80 wxSize DoGetBestSize() const;
81
82 private:
83 size_t m_nItemHeight; // height of checklistbox items (the same for all)
84
85 DECLARE_EVENT_TABLE()
86 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox)
87 };
88
89 #endif //_CHECKLST_H