1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/choice.h
3 // Purpose: wxChoice class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/control.h"
17 #include "wx/dynarray.h"
18 #include "wx/arrstr.h"
20 WX_DEFINE_ARRAY( char * , wxChoiceDataArray
) ;
23 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
25 DECLARE_DYNAMIC_CLASS(wxChoice
)
29 : m_strings(), m_datas()
34 wxChoice(wxWindow
*parent
, wxWindowID id
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
37 int n
= 0, const wxString choices
[] = NULL
,
39 const wxValidator
& validator
= wxDefaultValidator
,
40 const wxString
& name
= wxChoiceNameStr
)
42 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
44 wxChoice(wxWindow
*parent
, wxWindowID id
,
47 const wxArrayString
& choices
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxChoiceNameStr
)
52 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
55 bool Create(wxWindow
*parent
, wxWindowID id
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 int n
= 0, const wxString choices
[] = NULL
,
60 const wxValidator
& validator
= wxDefaultValidator
,
61 const wxString
& name
= wxChoiceNameStr
);
62 bool Create(wxWindow
*parent
, wxWindowID id
,
65 const wxArrayString
& choices
,
67 const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
& name
= wxChoiceNameStr
);
70 virtual unsigned int GetCount() const ;
71 virtual int GetSelection() const ;
72 virtual void SetSelection(int n
);
74 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
75 virtual wxString
GetString(unsigned int n
) const ;
76 virtual void SetString(unsigned int pos
, const wxString
& s
);
77 // osx specific event handling common for all osx-ports
79 virtual bool OSXHandleClicked( double timestampsec
);
82 virtual void DoDeleteOneItem(unsigned int n
);
83 virtual void DoClear();
85 virtual wxSize
DoGetBestSize() const ;
86 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
88 void **clientData
, wxClientDataType type
);
90 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
91 virtual void* DoGetItemClientData(unsigned int n
) const;
93 wxArrayString m_strings
;
94 wxChoiceDataArray m_datas
;
98 // This should be called when the number of items in the control changes.
99 void DoAfterItemCountChange();