]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/checklst.h
fix wxBitmapComboBox Gtk-CRITICAL assertion `GTK_IS_ENTRY (entry)' failed
[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
KB
6// Created: 16.11.97
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10///////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef __CHECKLST__H_
13#define __CHECKLST__H_
2bda0e17 14
f97c9854 15#if !wxUSE_OWNER_DRAWN
2bda0e17
KB
16 #error "wxCheckListBox class requires owner-drawn functionality."
17#endif
18
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
20class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
2bda0e17 21
53a2db12 22class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
2bda0e17 23{
2bda0e17 24public:
85ee88cd
VZ
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);
dd3c394a 42
85ee88cd 43 bool Create(wxWindow *parent, wxWindowID id,
799cea00
VS
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);
85ee88cd 50 bool Create(wxWindow *parent, wxWindowID id,
584ad2a3
MB
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);
799cea00 57
85ee88cd
VZ
58 // items may be checked
59 virtual bool IsChecked(unsigned int uiIndex) const;
60 virtual void Check(unsigned int uiIndex, bool bCheck = true);
61 virtual void Toggle(unsigned int uiIndex);
2bda0e17 62
85ee88cd
VZ
63 // we create our items ourselves and they have non-standard size,
64 // so we need to override these functions
65 virtual wxOwnerDrawn *CreateLboxItem(size_t n);
66 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
2bda0e17 67
6f02a879 68protected:
85ee88cd
VZ
69 // pressing space or clicking the check box toggles the item
70 void OnKeyDown(wxKeyEvent& event);
71 void OnLeftClick(wxMouseEvent& event);
2bda0e17 72
85ee88cd
VZ
73 // send an "item checked" event
74 void SendEvent(unsigned int uiIndex)
75 {
76 wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
77 event.SetInt(uiIndex);
78 event.SetEventObject(this);
79 event.SetString(GetString(uiIndex));
80 ProcessCommand(event);
81 }
6d50c6a7 82
85ee88cd 83 wxSize DoGetBestClientSize() const;
2bda0e17 84
85ee88cd
VZ
85 DECLARE_EVENT_TABLE()
86 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox)
2bda0e17
KB
87};
88
89#endif //_CHECKLST_H