1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxChoice class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "choice.h"
19 WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr
;
21 #include "wx/clntdata.h"
22 #include "wx/dynarray.h"
24 WX_DEFINE_ARRAY(WXWidget
, wxWidgetArray
);
27 class WXDLLEXPORT wxChoice
: public wxChoiceBase
29 DECLARE_DYNAMIC_CLASS(wxChoice
)
35 wxChoice(wxWindow
*parent
, wxWindowID id
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
38 int n
= 0, const wxString choices
[] = NULL
,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 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 // implementation of wxControlWithItems
56 virtual int GetCount() const;
57 virtual int DoAppend(const wxString
& item
);
58 virtual void DoSetItemClientData(int n
, void* clientData
);
59 virtual void* DoGetItemClientData(int n
) const;
60 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
);
61 virtual wxClientData
* DoGetItemClientObject(int n
) const;
62 virtual int GetSelection() const;
63 virtual void Delete(int n
);
64 virtual int FindString(const wxString
& s
) const;
66 virtual void SetString(int n
, const wxString
& s
);
67 virtual wxString
GetString(int n
) const;
69 // implementation of wxChoiceBase
70 virtual void SetSelection(int n
);
71 virtual void SetColumns(int n
= 1 );
72 virtual int GetColumns() const ;
75 virtual void Command(wxCommandEvent
& event
);
80 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
81 virtual void ChangeBackgroundColour();
82 virtual void ChangeForegroundColour();
83 WXWidget
GetTopWidget() const { return m_formWidget
; }
84 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
86 virtual wxSize
DoGetBestSize() const;
88 // implementation, for wxChoiceCallback
89 const wxWidgetArray
& GetWidgets() const { return m_widgetArray
; }
90 const wxStringList
& GetStrings() const { return m_stringList
; }
92 // minimum size for the text ctrl
93 wxSize
GetItemsSize() const;
94 // common part of all contructors
98 WXWidget m_menuWidget
;
99 WXWidget m_buttonWidget
;
100 wxWidgetArray m_widgetArray
;
101 WXWidget m_formWidget
;
102 wxStringList m_stringList
;
103 wxClientDataDictionary m_clientDataDict
;
105 virtual void DoSetSize(int x
, int y
,
106 int width
, int height
,
107 int sizeFlags
= wxSIZE_AUTO
);