]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/os2/listbox.h
added GAUGE standard colour and use it in DrawProgressBar() if the colour
[wxWidgets.git] / include / wx / os2 / listbox.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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(wxOwnerDrawn *, wxListBoxItemsArray);
26#endif // wxUSE_OWNER_DRAWN
27
28// forward decl for GetSelections()
29class wxArrayInt;
30
31// ----------------------------------------------------------------------------
32// List box control
33// ----------------------------------------------------------------------------
34
35class WXDLLEXPORT wxListBox : public wxListBoxBase
36{
37public:
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#if wxUSE_VALIDATORS
48 ,const wxValidator& rValidator = wxDefaultValidator
49#endif
50 ,const wxString& rsName = wxListBoxNameStr)
51 {
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 );
64 }
65
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
73#if wxUSE_VALIDATORS
74 ,const wxValidator& rValidator = wxDefaultValidator
75#endif
76 ,const wxString& rsName = wxListBoxNameStr
77 );
78
79 virtual ~wxListBox();
80
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 );
118 virtual wxClientData* DoGetItemClientObject(int n) const;
119
120 //
121 // wxCheckListBox support
122 //
123#if wxUSE_OWNER_DRAWN
124 bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
125 bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
126
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); }
130#endif // wxUSE_OWNER_DRAWN
131
132 bool OS2Command( WXUINT uParam
133 ,WXWORD wId
134 );
135 virtual void SetupColours(void);
136
137protected:
138
139 bool HasMultipleSelection(void) const;
140 virtual wxSize DoGetBestSize(void) const;
141
142 int m_nNumItems;
143 int m_nSelected;
144
145
146#if wxUSE_OWNER_DRAWN
147 //
148 // Control items
149 //
150 wxListBoxItemsArray m_aItems;
151#endif
152
153private:
154#if wxUSE_WX_RESOURCES
155# if wxUSE_OWNER_DRAWN
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 }
167# endif
168#endif
169 DECLARE_DYNAMIC_CLASS(wxListBox)
170}; // end of wxListBox
171
172#endif
173 // _WX_LISTBOX_H_