1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "choice.h"
19 #include "wx/control.h"
21 #include "wx/dynarray.h"
23 WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr
;
25 WX_DEFINE_ARRAY( char * , wxChoiceDataArray
) ;
28 class WXDLLEXPORT wxChoice
: public wxChoiceBase
30 DECLARE_DYNAMIC_CLASS(wxChoice
)
36 wxChoice(wxWindow
*parent
, wxWindowID id
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
39 int n
= 0, const wxString choices
[] = NULL
,
41 const wxValidator
& validator
= wxDefaultValidator
,
42 const wxString
& name
= wxChoiceNameStr
)
44 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
47 bool Create(wxWindow
*parent
, wxWindowID id
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 int n
= 0, const wxString choices
[] = NULL
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
& name
= wxChoiceNameStr
);
55 // implement base class pure virtuals
56 virtual int DoAppend(const wxString
& item
);
57 virtual void Delete(int n
);
60 virtual int GetCount() const ;
61 virtual int GetSelection() const ;
62 virtual void SetSelection(int n
);
64 virtual int FindString(const wxString
& s
) const;
65 virtual wxString
GetString(int n
) const ;
66 virtual void SetString( int , const wxString
& s
) ;
67 void MacHandleControlClick( ControlHandle control
, SInt16 controlpart
) ;
70 virtual void Append(const wxString& item);
71 // Added min Append and GetClientData
72 virtual void Append(const wxString& item, void *client_data);
73 virtual void *GetClientData(int index) const;
74 virtual inline void Select( int n ) { SetSelection( n ); }
75 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
76 virtual wxString GetStringSelection() const ;
77 virtual bool SetStringSelection(const wxString& sel);
80 virtual void Command(wxCommandEvent& event);
81 void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
83 virtual inline int GetColumns() const { return 1 ; };
86 virtual wxSize
DoGetBestSize() const ;
87 virtual void DoSetItemClientData( int n
, void* clientData
);
88 virtual void* DoGetItemClientData( int n
) const;
89 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
90 virtual wxClientData
* DoGetItemClientObject( int n
) const;
92 // free all memory we have (used by Clear() and dtor)
95 wxArrayString m_strings
;
96 wxChoiceDataArray m_datas
;
97 MenuHandle m_macPopUpMenuHandle
;