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