]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/listbox.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / os2 / listbox.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/os2/listbox.h
0e320a79 3// Purpose: wxListBox class
fb9010ed 4// Author: David Webster
0e320a79 5// Modified by:
fb9010ed 6// Created: 10/09/99
fb9010ed 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
0e320a79
DW
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_LISTBOX_H_
12#define _WX_LISTBOX_H_
13
dcd307ee
DW
14// ----------------------------------------------------------------------------
15// simple types
16// ----------------------------------------------------------------------------
0e320a79 17
fb9010ed 18#if wxUSE_OWNER_DRAWN
b5dbe15d 19 class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
fb9010ed 20
7e1e6965 21 // define the array of list box items
c0089c96 22 #include "wx/dynarray.h"
fb9010ed 23
7e1e6965 24 WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray);
dcd307ee 25#endif // wxUSE_OWNER_DRAWN
fb9010ed 26
0e320a79 27// forward decl for GetSelections()
dcd307ee 28class wxArrayInt;
0e320a79 29
dcd307ee
DW
30// ----------------------------------------------------------------------------
31// List box control
32// ----------------------------------------------------------------------------
0e320a79 33
53a2db12 34class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
0e320a79 35{
dcd307ee
DW
36public:
37 // ctors and such
38 wxListBox();
934dac2f
DW
39 wxListBox( wxWindow* pParent
40 ,wxWindowID vId
41 ,const wxPoint& rPos = wxDefaultPosition
42 ,const wxSize& rSize = wxDefaultSize
43 ,int n = 0
44 ,const wxString asChoices[] = NULL
45 ,long lStyle = 0
934dac2f 46 ,const wxValidator& rValidator = wxDefaultValidator
934dac2f 47 ,const wxString& rsName = wxListBoxNameStr)
dcd307ee 48 {
934dac2f
DW
49 Create( pParent
50 ,vId
51 ,rPos
52 ,rSize
53 ,n
54 ,asChoices
55 ,lStyle
934dac2f 56 ,rValidator
934dac2f
DW
57 ,rsName
58 );
dcd307ee 59 }
584ad2a3
MB
60 wxListBox( wxWindow* pParent
61 ,wxWindowID vId
62 ,const wxPoint& rPos
63 ,const wxSize& rSize
64 ,const wxArrayString& asChoices
65 ,long lStyle = 0
66 ,const wxValidator& rValidator = wxDefaultValidator
67 ,const wxString& rsName = wxListBoxNameStr)
68 {
69 Create( pParent
70 ,vId
71 ,rPos
72 ,rSize
73 ,asChoices
74 ,lStyle
75 ,rValidator
76 ,rsName
77 );
78 }
dcd307ee 79
934dac2f
DW
80 bool Create( wxWindow* pParent
81 ,wxWindowID vId
82 ,const wxPoint& rPos = wxDefaultPosition
83 ,const wxSize& rSize = wxDefaultSize
84 ,int n = 0
85 ,const wxString asChoices[] = NULL
86 ,long lStyle = 0
934dac2f 87 ,const wxValidator& rValidator = wxDefaultValidator
934dac2f
DW
88 ,const wxString& rsName = wxListBoxNameStr
89 );
584ad2a3
MB
90 bool Create( wxWindow* pParent
91 ,wxWindowID vId
92 ,const wxPoint& rPos
93 ,const wxSize& rSize
94 ,const wxArrayString& asChoices
95 ,long lStyle = 0
96 ,const wxValidator& rValidator = wxDefaultValidator
97 ,const wxString& rsName = wxListBoxNameStr
98 );
dcd307ee
DW
99
100 virtual ~wxListBox();
101
934dac2f
DW
102 //
103 // Implement base class pure virtuals
104 //
a236aa20
VZ
105 virtual void DoClear(void);
106 virtual void DoDeleteOneItem(unsigned int n);
934dac2f 107
aa61d352
VZ
108 virtual unsigned int GetCount() const;
109 virtual wxString GetString(unsigned int n) const;
110 virtual void SetString(unsigned int n, const wxString& rsString);
934dac2f
DW
111
112 virtual bool IsSelected(int n) const;
8228b893 113 virtual void DoSetSelection(int n, bool bSelect);
934dac2f
DW
114 virtual int GetSelection(void) const;
115 virtual int GetSelections(wxArrayInt& raSelections) const;
116
934dac2f
DW
117 virtual void DoSetFirstItem(int n);
118
aa61d352
VZ
119 virtual void DoSetItemClientData(unsigned int n, void* pClientData);
120 virtual void* DoGetItemClientData(unsigned int n) const;
dcd307ee 121
934dac2f 122 //
dcd307ee 123 // wxCheckListBox support
934dac2f 124 //
fb9010ed 125#if wxUSE_OWNER_DRAWN
f5ea767e 126 long OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
934dac2f 127 bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
fb9010ed 128
934dac2f
DW
129 virtual wxOwnerDrawn* CreateItem(size_t n);
130 wxOwnerDrawn* GetItem(size_t n) const { return m_aItems[n]; }
131 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
fb9010ed
DW
132#endif // wxUSE_OWNER_DRAWN
133
934dac2f
DW
134 bool OS2Command( WXUINT uParam
135 ,WXWORD wId
136 );
137 virtual void SetupColours(void);
fb9010ed
DW
138
139protected:
dcd307ee 140
934dac2f
DW
141 bool HasMultipleSelection(void) const;
142 virtual wxSize DoGetBestSize(void) const;
143
aa61d352
VZ
144 unsigned int m_nNumItems;
145 int m_nSelected;
fb9010ed
DW
146
147#if wxUSE_OWNER_DRAWN
934dac2f
DW
148 //
149 // Control items
150 //
151 wxListBoxItemsArray m_aItems;
fb9010ed 152#endif
dcd307ee 153
a236aa20
VZ
154 //
155 // Implement base wxItemContainer virtuals
156 //
157 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
158 unsigned int pos,
159 void **clientData,
160 wxClientDataType type);
161
dcd307ee 162 DECLARE_DYNAMIC_CLASS(wxListBox)
934dac2f 163}; // end of wxListBox
0e320a79 164
c0089c96 165#endif // _WX_LISTBOX_H_