1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "choice.h"
19 #include "wx/control.h"
21 #include "wx/dynarray.h"
22 #include "wx/arrstr.h"
24 WXDLLEXPORT_DATA(extern const wxChar
*) wxChoiceNameStr
;
26 WX_DEFINE_ARRAY( char * , wxChoiceDataArray
) ;
29 class WXDLLEXPORT wxChoice
: public wxChoiceBase
31 DECLARE_DYNAMIC_CLASS(wxChoice
)
35 : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL
)
40 wxChoice(wxWindow
*parent
, wxWindowID id
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
43 int n
= 0, const wxString choices
[] = NULL
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
)
48 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
50 wxChoice(wxWindow
*parent
, wxWindowID id
,
53 const wxArrayString
& choices
,
55 const wxValidator
& validator
= wxDefaultValidator
,
56 const wxString
& name
= wxChoiceNameStr
)
58 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
61 bool Create(wxWindow
*parent
, wxWindowID id
,
62 const wxPoint
& pos
= wxDefaultPosition
,
63 const wxSize
& size
= wxDefaultSize
,
64 int n
= 0, const wxString choices
[] = NULL
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxChoiceNameStr
);
68 bool Create(wxWindow
*parent
, wxWindowID id
,
71 const wxArrayString
& choices
,
73 const wxValidator
& validator
= wxDefaultValidator
,
74 const wxString
& name
= wxChoiceNameStr
);
76 // implement base class pure virtuals
77 virtual int DoAppend(const wxString
& item
);
78 virtual int DoInsert(const wxString
& item
, int pos
);
79 virtual void Delete(int n
);
82 virtual int GetCount() const ;
83 virtual int GetSelection() const ;
84 virtual void SetSelection(int n
);
86 virtual int FindString(const wxString
& s
) const;
87 virtual wxString
GetString(int n
) const ;
88 virtual void SetString( int , const wxString
& s
) ;
89 virtual wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
92 virtual wxSize
DoGetBestSize() const ;
94 public: // for wxComboBox only
95 virtual void DoSetItemClientData( int n
, void* clientData
);
96 virtual void* DoGetItemClientData( int n
) const;
97 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
98 virtual wxClientData
* DoGetItemClientObject( int n
) const;
101 // free all memory we have (used by Clear() and dtor)
102 // prevent collision with some BSD definitions of macro Free()
105 wxArrayString m_strings
;
106 wxChoiceDataArray m_datas
;
107 WXHMENU m_macPopUpMenuHandle
;