1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/choice.h
3 // Purpose: wxChoice class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/control.h"
16 #include "wx/dynarray.h"
17 #include "wx/arrstr.h"
19 WX_DEFINE_ARRAY( char * , wxChoiceDataArray
) ;
22 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
24 DECLARE_DYNAMIC_CLASS(wxChoice
)
28 : m_strings(), m_datas()
33 wxChoice(wxWindow
*parent
, wxWindowID id
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
36 int n
= 0, const wxString choices
[] = NULL
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxChoiceNameStr
)
41 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
43 wxChoice(wxWindow
*parent
, wxWindowID id
,
46 const wxArrayString
& choices
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxChoiceNameStr
)
51 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
54 bool Create(wxWindow
*parent
, wxWindowID id
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 int n
= 0, const wxString choices
[] = NULL
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxChoiceNameStr
);
61 bool Create(wxWindow
*parent
, wxWindowID id
,
64 const wxArrayString
& choices
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxChoiceNameStr
);
69 virtual unsigned int GetCount() const ;
70 virtual int GetSelection() const ;
71 virtual void SetSelection(int n
);
73 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
74 virtual wxString
GetString(unsigned int n
) const ;
75 virtual void SetString(unsigned int pos
, const wxString
& s
);
76 // osx specific event handling common for all osx-ports
78 virtual bool OSXHandleClicked( double timestampsec
);
81 virtual void DoDeleteOneItem(unsigned int n
);
82 virtual void DoClear();
84 virtual wxSize
DoGetBestSize() const ;
85 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
87 void **clientData
, wxClientDataType type
);
89 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
90 virtual void* DoGetItemClientData(unsigned int n
) const;
92 wxArrayString m_strings
;
93 wxChoiceDataArray m_datas
;
97 // This should be called when the number of items in the control changes.
98 void DoAfterItemCountChange();