]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/listbox.h | |
3 | // Purpose: wxListBox class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/09/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_LISTBOX_H_ | |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // simple types | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | #if wxUSE_OWNER_DRAWN | |
20 | class WXDLLEXPORT wxOwnerDrawn; | |
21 | ||
22 | // define the array of list box items | |
23 | #include "wx/dynarray.h" | |
24 | ||
25 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); | |
26 | #endif // wxUSE_OWNER_DRAWN | |
27 | ||
28 | // forward decl for GetSelections() | |
29 | class wxArrayInt; | |
30 | ||
31 | // ---------------------------------------------------------------------------- | |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxListBox : public wxListBoxBase | |
36 | { | |
37 | public: | |
38 | // ctors and such | |
39 | wxListBox(); | |
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 | |
47 | ,const wxValidator& rValidator = wxDefaultValidator | |
48 | ,const wxString& rsName = wxListBoxNameStr) | |
49 | { | |
50 | Create( pParent | |
51 | ,vId | |
52 | ,rPos | |
53 | ,rSize | |
54 | ,n | |
55 | ,asChoices | |
56 | ,lStyle | |
57 | ,rValidator | |
58 | ,rsName | |
59 | ); | |
60 | } | |
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 | } | |
80 | ||
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 | |
88 | ,const wxValidator& rValidator = wxDefaultValidator | |
89 | ,const wxString& rsName = wxListBoxNameStr | |
90 | ); | |
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 | ); | |
100 | ||
101 | virtual ~wxListBox(); | |
102 | ||
103 | // | |
104 | // Implement base class pure virtuals | |
105 | // | |
106 | virtual void Clear(void); | |
107 | virtual void Delete(int n); | |
108 | ||
109 | virtual size_t GetCount() const; | |
110 | virtual wxString GetString(int n) const; | |
111 | virtual void SetString(int n, const wxString& rsString); | |
112 | ||
113 | virtual bool IsSelected(int n) const; | |
114 | virtual void DoSetSelection(int n, bool bSelect); | |
115 | virtual int GetSelection(void) const; | |
116 | virtual int GetSelections(wxArrayInt& raSelections) const; | |
117 | ||
118 | virtual int DoAppend(const wxString& rsItem); | |
119 | virtual void DoInsertItems( const wxArrayString& raItems, int rPos ); | |
120 | virtual void DoSetItems( const wxArrayString& raItems | |
121 | ,void ** ppClientData | |
122 | ); | |
123 | ||
124 | virtual void DoSetFirstItem(int n); | |
125 | ||
126 | virtual void DoSetItemClientData( int n | |
127 | ,void* pClientData | |
128 | ); | |
129 | virtual void* DoGetItemClientData(int n) const; | |
130 | virtual void DoSetItemClientObject( int n | |
131 | ,wxClientData* pClientData | |
132 | ); | |
133 | virtual wxClientData* DoGetItemClientObject(int n) const; | |
134 | ||
135 | // | |
136 | // wxCheckListBox support | |
137 | // | |
138 | #if wxUSE_OWNER_DRAWN | |
139 | long OS2OnMeasure(WXMEASUREITEMSTRUCT *item); | |
140 | bool OS2OnDraw(WXDRAWITEMSTRUCT *item); | |
141 | ||
142 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
143 | wxOwnerDrawn* GetItem(size_t n) const { return m_aItems[n]; } | |
144 | int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } | |
145 | #endif // wxUSE_OWNER_DRAWN | |
146 | ||
147 | bool OS2Command( WXUINT uParam | |
148 | ,WXWORD wId | |
149 | ); | |
150 | virtual void SetupColours(void); | |
151 | ||
152 | protected: | |
153 | ||
154 | bool HasMultipleSelection(void) const; | |
155 | virtual wxSize DoGetBestSize(void) const; | |
156 | ||
157 | size_t m_nNumItems; | |
158 | int m_nSelected; | |
159 | ||
160 | #if wxUSE_OWNER_DRAWN | |
161 | // | |
162 | // Control items | |
163 | // | |
164 | wxListBoxItemsArray m_aItems; | |
165 | #endif | |
166 | ||
167 | private: | |
168 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
169 | }; // end of wxListBox | |
170 | ||
171 | #endif // _WX_LISTBOX_H_ |