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 #include "wx/ctrlsub.h"
21 WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr
;
24 class WXDLLEXPORT wxChoice
: public wxControlWithItems
26 DECLARE_DYNAMIC_CLASS(wxChoice
)
32 wxChoice(wxWindow
*parent
, wxWindowID id
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 int n
= 0, const wxString choices
[] = NULL
,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxChoiceNameStr
)
40 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
43 bool Create(wxWindow
*parent
, wxWindowID id
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
46 int n
= 0, const wxString choices
[] = NULL
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxChoiceNameStr
);
51 // Virtual functions required by wxControlWithItems.
52 // They are not all implemented yet :-(
53 virtual int GetCount() const;
54 virtual int DoAppend(const wxString
& item
);
55 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
56 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
57 virtual void DoSetFirstItem(int n
);
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 void Select(int n
);
63 virtual void SetString(int n
, const wxString
& s
);
66 virtual void Append(const wxString
& item
);
67 virtual void Delete(int n
);
69 virtual int GetSelection() const ;
70 virtual void SetSelection(int n
);
71 virtual int FindString(const wxString
& s
) const;
72 virtual wxString
GetString(int n
) const ;
74 virtual wxString
GetStringSelection() const ;
75 virtual bool SetStringSelection(const wxString
& sel
);
77 virtual int Number() const { return m_noStrings
; }
78 virtual void Command(wxCommandEvent
& event
);
80 virtual void SetColumns(int n
= 1 );
81 virtual int GetColumns() const ;
86 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
87 virtual void ChangeBackgroundColour();
88 virtual void ChangeForegroundColour();
89 WXWidget
GetTopWidget() const { return m_formWidget
; }
90 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
94 WXWidget m_menuWidget
;
95 WXWidget m_buttonWidget
;
96 WXWidget
* m_widgetList
;
97 WXWidget m_formWidget
;
98 wxStringList m_stringList
;
100 virtual void DoSetSize(int x
, int y
,
101 int width
, int height
,
102 int sizeFlags
= wxSIZE_AUTO
);