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