]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/listbox.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / os2 / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/listbox.h
3 // Purpose: wxListBox class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/09/99
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_LISTBOX_H_
12 #define _WX_LISTBOX_H_
13
14 // ----------------------------------------------------------------------------
15 // simple types
16 // ----------------------------------------------------------------------------
17
18 #if wxUSE_OWNER_DRAWN
19 class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
20
21 // define the array of list box items
22 #include "wx/dynarray.h"
23
24 WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray);
25 #endif // wxUSE_OWNER_DRAWN
26
27 // forward decl for GetSelections()
28 class wxArrayInt;
29
30 // ----------------------------------------------------------------------------
31 // List box control
32 // ----------------------------------------------------------------------------
33
34 class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
35 {
36 public:
37 // ctors and such
38 wxListBox();
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
46 ,const wxValidator& rValidator = wxDefaultValidator
47 ,const wxString& rsName = wxListBoxNameStr)
48 {
49 Create( pParent
50 ,vId
51 ,rPos
52 ,rSize
53 ,n
54 ,asChoices
55 ,lStyle
56 ,rValidator
57 ,rsName
58 );
59 }
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 }
79
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
87 ,const wxValidator& rValidator = wxDefaultValidator
88 ,const wxString& rsName = wxListBoxNameStr
89 );
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 );
99
100 virtual ~wxListBox();
101
102 //
103 // Implement base class pure virtuals
104 //
105 virtual void DoClear(void);
106 virtual void DoDeleteOneItem(unsigned int n);
107
108 virtual unsigned int GetCount() const;
109 virtual wxString GetString(unsigned int n) const;
110 virtual void SetString(unsigned int n, const wxString& rsString);
111
112 virtual bool IsSelected(int n) const;
113 virtual void DoSetSelection(int n, bool bSelect);
114 virtual int GetSelection(void) const;
115 virtual int GetSelections(wxArrayInt& raSelections) const;
116
117 virtual void DoSetFirstItem(int n);
118
119 virtual void DoSetItemClientData(unsigned int n, void* pClientData);
120 virtual void* DoGetItemClientData(unsigned int n) const;
121
122 //
123 // wxCheckListBox support
124 //
125 #if wxUSE_OWNER_DRAWN
126 long OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
127 bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
128
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); }
132 #endif // wxUSE_OWNER_DRAWN
133
134 bool OS2Command( WXUINT uParam
135 ,WXWORD wId
136 );
137 virtual void SetupColours(void);
138
139 protected:
140
141 bool HasMultipleSelection(void) const;
142 virtual wxSize DoGetBestSize(void) const;
143
144 unsigned int m_nNumItems;
145 int m_nSelected;
146
147 #if wxUSE_OWNER_DRAWN
148 //
149 // Control items
150 //
151 wxListBoxItemsArray m_aItems;
152 #endif
153
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
162 DECLARE_DYNAMIC_CLASS(wxListBox)
163 }; // end of wxListBox
164
165 #endif // _WX_LISTBOX_H_