]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/checklst.h
fix from Francesco for the latest version of wxPresets
[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
d90879fa
VZ
19class WXDLLEXPORT wxOwnerDrawn;
20class WXDLLEXPORT wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
2bda0e17 21
d90879fa 22class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
2bda0e17 23{
2bda0e17
KB
24public:
25 // ctors
26 wxCheckListBox();
debe6624 27 wxCheckListBox(wxWindow *parent, wxWindowID id,
2bda0e17
KB
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
0c35333e 30 int nStrings = 0,
2bda0e17 31 const wxString choices[] = NULL,
debe6624 32 long style = 0,
2bda0e17
KB
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxListBoxNameStr);
584ad2a3
MB
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
799cea00
VS
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);
584ad2a3
MB
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);
799cea00 57
dd3c394a 58 // override base class virtuals
aa61d352 59 virtual void Delete(unsigned int n);
2bda0e17 60
0c35333e
RD
61 virtual bool SetFont( const wxFont &font );
62
2bda0e17 63 // items may be checked
aa61d352
VZ
64 virtual bool IsChecked(unsigned int uiIndex) const;
65 virtual void Check(unsigned int uiIndex, bool bCheck = true);
2bda0e17 66
15c3723c
VZ
67 // return the index of the item at this position or wxNOT_FOUND
68 int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); }
69 int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); }
70
2bda0e17 71 // accessors
dd3c394a 72 size_t GetItemHeight() const { return m_nItemHeight; }
2bda0e17 73
2bda0e17
KB
74 // we create our items ourselves and they have non-standard size,
75 // so we need to override these functions
2b5f62a0 76 virtual wxOwnerDrawn *CreateLboxItem(size_t n);
2bda0e17
KB
77 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
78
6f02a879 79protected:
15c3723c
VZ
80 // this can't be called DoHitTest() because wxWindow already has this method
81 int DoHitTestItem(wxCoord x, wxCoord y) const;
82
2bda0e17 83 // pressing space or clicking the check box toggles the item
d90879fa 84 void OnKeyDown(wxKeyEvent& event);
2bda0e17
KB
85 void OnLeftClick(wxMouseEvent& event);
86
6d50c6a7
RD
87 wxSize DoGetBestSize() const;
88
2bda0e17 89private:
3cda6353 90 size_t m_nItemHeight; // height of checklistbox items (the same for all)
2bda0e17
KB
91
92 DECLARE_EVENT_TABLE()
fc7a2a60 93 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox)
2bda0e17
KB
94};
95
96#endif //_CHECKLST_H