1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "choice.h"
19 #include "wx/control.h"
21 #include "wx/dynarray.h"
23 WXDLLEXPORT_DATA(extern const wxChar
*) wxChoiceNameStr
;
25 WX_DEFINE_ARRAY( char * , wxChoiceDataArray
) ;
28 class WXDLLEXPORT wxChoice
: public wxChoiceBase
30 DECLARE_DYNAMIC_CLASS(wxChoice
)
34 : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL
)
39 wxChoice(wxWindow
*parent
, wxWindowID id
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
,
42 int n
= 0, const wxString choices
[] = NULL
,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxChoiceNameStr
)
47 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
50 bool Create(wxWindow
*parent
, wxWindowID id
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 int n
= 0, const wxString choices
[] = NULL
,
55 const wxValidator
& validator
= wxDefaultValidator
,
56 const wxString
& name
= wxChoiceNameStr
);
58 // implement base class pure virtuals
59 virtual int DoAppend(const wxString
& item
);
60 virtual int DoInsert(const wxString
& item
, int pos
);
61 virtual void Delete(int n
);
64 virtual int GetCount() const ;
65 virtual int GetSelection() const ;
66 virtual void SetSelection(int n
);
68 virtual int FindString(const wxString
& s
) const;
69 virtual wxString
GetString(int n
) const ;
70 virtual void SetString( int , const wxString
& s
) ;
71 void MacHandleControlClick( WXWidget control
, wxInt16 controlpart
) ;
74 virtual void Append(const wxString& item);
75 // Added min Append and GetClientData
76 virtual void Append(const wxString& item, void *client_data);
77 virtual void *GetClientData(int index) const;
78 virtual inline void Select( int n ) { SetSelection( n ); }
79 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
80 virtual wxString GetStringSelection() const ;
81 virtual bool SetStringSelection(const wxString& sel);
84 virtual void Command(wxCommandEvent& event);
85 void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
87 virtual inline int GetColumns() const { return 1 ; };
90 virtual wxSize
DoGetBestSize() const ;
91 virtual void DoSetItemClientData( int n
, void* clientData
);
92 virtual void* DoGetItemClientData( int n
) const;
93 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
94 virtual wxClientData
* DoGetItemClientObject( int n
) const;
96 // free all memory we have (used by Clear() and dtor)
97 // prevent collision with some BSD definitions of macro Free()
100 wxArrayString m_strings
;
101 wxChoiceDataArray m_datas
;
102 WXHMENU m_macPopUpMenuHandle
;