]>
Commit | Line | Data |
---|---|---|
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 |
0e320a79 | 7 | // RCS-ID: $Id$ |
fb9010ed | 8 | // Copyright: (c) David Webster |
65571936 | 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 | 19 | #if wxUSE_OWNER_DRAWN |
7e1e6965 | 20 | class WXDLLEXPORT wxOwnerDrawn; |
fb9010ed | 21 | |
7e1e6965 WS |
22 | // define the array of list box items |
23 | #include <wx/dynarray.h> | |
fb9010ed | 24 | |
7e1e6965 | 25 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); |
dcd307ee | 26 | #endif // wxUSE_OWNER_DRAWN |
fb9010ed | 27 | |
0e320a79 | 28 | // forward decl for GetSelections() |
dcd307ee | 29 | class wxArrayInt; |
0e320a79 | 30 | |
dcd307ee DW |
31 | // ---------------------------------------------------------------------------- |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
0e320a79 | 34 | |
dcd307ee | 35 | class WXDLLEXPORT wxListBox : public wxListBoxBase |
0e320a79 | 36 | { |
dcd307ee DW |
37 | public: |
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 | |
934dac2f | 47 | ,const wxValidator& rValidator = wxDefaultValidator |
934dac2f | 48 | ,const wxString& rsName = wxListBoxNameStr) |
dcd307ee | 49 | { |
934dac2f DW |
50 | Create( pParent |
51 | ,vId | |
52 | ,rPos | |
53 | ,rSize | |
54 | ,n | |
55 | ,asChoices | |
56 | ,lStyle | |
934dac2f | 57 | ,rValidator |
934dac2f DW |
58 | ,rsName |
59 | ); | |
dcd307ee | 60 | } |
584ad2a3 MB |
61 | wxListBox( wxWindow* pParent |
62 | ,wxWindowID vId | |
63 | ,const wxPoint& rPos | |
64 | ,const wxSize& rSize | |
65 | ,const wxArrayString& asChoices | |
66 | ,long lStyle = 0 | |
67 | ,const wxValidator& rValidator = wxDefaultValidator | |
68 | ,const wxString& rsName = wxListBoxNameStr) | |
69 | { | |
70 | Create( pParent | |
71 | ,vId | |
72 | ,rPos | |
73 | ,rSize | |
74 | ,asChoices | |
75 | ,lStyle | |
76 | ,rValidator | |
77 | ,rsName | |
78 | ); | |
79 | } | |
dcd307ee | 80 | |
934dac2f DW |
81 | bool Create( wxWindow* pParent |
82 | ,wxWindowID vId | |
83 | ,const wxPoint& rPos = wxDefaultPosition | |
84 | ,const wxSize& rSize = wxDefaultSize | |
85 | ,int n = 0 | |
86 | ,const wxString asChoices[] = NULL | |
87 | ,long lStyle = 0 | |
934dac2f | 88 | ,const wxValidator& rValidator = wxDefaultValidator |
934dac2f DW |
89 | ,const wxString& rsName = wxListBoxNameStr |
90 | ); | |
584ad2a3 MB |
91 | bool Create( wxWindow* pParent |
92 | ,wxWindowID vId | |
93 | ,const wxPoint& rPos | |
94 | ,const wxSize& rSize | |
95 | ,const wxArrayString& asChoices | |
96 | ,long lStyle = 0 | |
97 | ,const wxValidator& rValidator = wxDefaultValidator | |
98 | ,const wxString& rsName = wxListBoxNameStr | |
99 | ); | |
dcd307ee DW |
100 | |
101 | virtual ~wxListBox(); | |
102 | ||
934dac2f DW |
103 | // |
104 | // Implement base class pure virtuals | |
105 | // | |
106 | virtual void Clear(void); | |
107 | virtual void Delete(int n); | |
108 | ||
109 | virtual int GetCount(void) const; | |
110 | virtual wxString GetString(int n) const; | |
853dcc57 | 111 | virtual void SetString(int n, const wxString& rsString); |
934dac2f DW |
112 | |
113 | virtual bool IsSelected(int n) const; | |
c6179a84 VZ |
114 | virtual void DoSetSelection( int n |
115 | ,bool bSelect | |
934dac2f DW |
116 | ); |
117 | virtual int GetSelection(void) const; | |
118 | virtual int GetSelections(wxArrayInt& raSelections) const; | |
119 | ||
120 | virtual int DoAppend(const wxString& rsItem); | |
121 | virtual void DoInsertItems( const wxArrayString& raItems | |
122 | ,int rPos | |
123 | ); | |
124 | virtual void DoSetItems( const wxArrayString& raItems | |
125 | ,void ** ppClientData | |
126 | ); | |
127 | ||
128 | virtual void DoSetFirstItem(int n); | |
129 | ||
130 | virtual void DoSetItemClientData( int n | |
131 | ,void* pClientData | |
132 | ); | |
133 | virtual void* DoGetItemClientData(int n) const; | |
134 | virtual void DoSetItemClientObject( int n | |
135 | ,wxClientData* pClientData | |
136 | ); | |
dcd307ee DW |
137 | virtual wxClientData* DoGetItemClientObject(int n) const; |
138 | ||
934dac2f | 139 | // |
dcd307ee | 140 | // wxCheckListBox support |
934dac2f | 141 | // |
fb9010ed | 142 | #if wxUSE_OWNER_DRAWN |
f5ea767e | 143 | long OS2OnMeasure(WXMEASUREITEMSTRUCT *item); |
934dac2f | 144 | bool OS2OnDraw(WXDRAWITEMSTRUCT *item); |
fb9010ed | 145 | |
934dac2f DW |
146 | virtual wxOwnerDrawn* CreateItem(size_t n); |
147 | wxOwnerDrawn* GetItem(size_t n) const { return m_aItems[n]; } | |
148 | int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } | |
fb9010ed DW |
149 | #endif // wxUSE_OWNER_DRAWN |
150 | ||
934dac2f DW |
151 | bool OS2Command( WXUINT uParam |
152 | ,WXWORD wId | |
153 | ); | |
154 | virtual void SetupColours(void); | |
fb9010ed DW |
155 | |
156 | protected: | |
dcd307ee | 157 | |
934dac2f DW |
158 | bool HasMultipleSelection(void) const; |
159 | virtual wxSize DoGetBestSize(void) const; | |
160 | ||
161 | int m_nNumItems; | |
162 | int m_nSelected; | |
fb9010ed | 163 | |
fb9010ed DW |
164 | |
165 | #if wxUSE_OWNER_DRAWN | |
934dac2f DW |
166 | // |
167 | // Control items | |
168 | // | |
169 | wxListBoxItemsArray m_aItems; | |
fb9010ed | 170 | #endif |
dcd307ee | 171 | |
fb9010ed | 172 | private: |
dcd307ee | 173 | DECLARE_DYNAMIC_CLASS(wxListBox) |
934dac2f | 174 | }; // end of wxListBox |
0e320a79 DW |
175 | |
176 | #endif | |
177 | // _WX_LISTBOX_H_ |