]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/checklst.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / checklst.h
CommitLineData
2bda0e17 1///////////////////////////////////////////////////////////////////////////////
aa61d352 2// Name: wx/msw/checklst.h
2bda0e17
KB
3// Purpose: wxCheckListBox class - a listbox with checkable items
4// Author: Vadim Zeitlin
0c35333e 5// Modified by:
2bda0e17 6// Created: 16.11.97
2bda0e17 7// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 8// Licence: wxWindows licence
2bda0e17
KB
9///////////////////////////////////////////////////////////////////////////////
10
bbcdf8bc
JS
11#ifndef __CHECKLST__H_
12#define __CHECKLST__H_
2bda0e17 13
f97c9854 14#if !wxUSE_OWNER_DRAWN
2bda0e17
KB
15 #error "wxCheckListBox class requires owner-drawn functionality."
16#endif
17
b5dbe15d
VS
18class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
19class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
2bda0e17 20
53a2db12 21class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
2bda0e17 22{
2bda0e17 23public:
85ee88cd
VZ
24 // ctors
25 wxCheckListBox();
26 wxCheckListBox(wxWindow *parent, wxWindowID id,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 int nStrings = 0,
30 const wxString choices[] = NULL,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxListBoxNameStr);
34 wxCheckListBox(wxWindow *parent, wxWindowID id,
35 const wxPoint& pos,
36 const wxSize& size,
37 const wxArrayString& choices,
38 long style = 0,
39 const wxValidator& validator = wxDefaultValidator,
40 const wxString& name = wxListBoxNameStr);
dd3c394a 41
85ee88cd 42 bool Create(wxWindow *parent, wxWindowID id,
799cea00
VS
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 int n = 0, const wxString choices[] = NULL,
46 long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxListBoxNameStr);
85ee88cd 49 bool Create(wxWindow *parent, wxWindowID id,
584ad2a3
MB
50 const wxPoint& pos,
51 const wxSize& size,
52 const wxArrayString& choices,
53 long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxListBoxNameStr);
799cea00 56
85ee88cd
VZ
57 // items may be checked
58 virtual bool IsChecked(unsigned int uiIndex) const;
59 virtual void Check(unsigned int uiIndex, bool bCheck = true);
60 virtual void Toggle(unsigned int uiIndex);
2bda0e17 61
85ee88cd
VZ
62 // we create our items ourselves and they have non-standard size,
63 // so we need to override these functions
64 virtual wxOwnerDrawn *CreateLboxItem(size_t n);
65 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
2bda0e17 66
6f02a879 67protected:
85ee88cd
VZ
68 // pressing space or clicking the check box toggles the item
69 void OnKeyDown(wxKeyEvent& event);
70 void OnLeftClick(wxMouseEvent& event);
2bda0e17 71
85ee88cd
VZ
72 // send an "item checked" event
73 void SendEvent(unsigned int uiIndex)
74 {
ce7fe42e 75 wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId());
85ee88cd
VZ
76 event.SetInt(uiIndex);
77 event.SetEventObject(this);
78 event.SetString(GetString(uiIndex));
79 ProcessCommand(event);
80 }
6d50c6a7 81
85ee88cd 82 wxSize DoGetBestClientSize() const;
2bda0e17 83
85ee88cd
VZ
84 DECLARE_EVENT_TABLE()
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox)
2bda0e17
KB
86};
87
88#endif //_CHECKLST_H