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
;
22 class WXDLLEXPORT wxChoice
: public wxChoiceBase
24 DECLARE_DYNAMIC_CLASS(wxChoice
)
30 wxChoice(wxWindow
*parent
, wxWindowID id
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
33 int n
= 0, const wxString choices
[] = NULL
,
35 const wxValidator
& validator
= wxDefaultValidator
,
36 const wxString
& name
= wxChoiceNameStr
)
38 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
41 bool Create(wxWindow
*parent
, wxWindowID id
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
44 int n
= 0, const wxString choices
[] = NULL
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxChoiceNameStr
);
49 // Virtual functions required by wxControlWithItems.
50 // They are not all implemented yet :-(
51 virtual int GetCount() const;
52 virtual int DoAppend(const wxString
& item
);
53 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
54 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
55 virtual void DoSetFirstItem(int n
);
56 virtual void DoSetItemClientData(int n
, void* clientData
);
57 virtual void* DoGetItemClientData(int n
) const;
58 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
);
59 virtual wxClientData
* DoGetItemClientObject(int n
) const;
60 virtual void Select(int n
);
61 virtual void SetString(int n
, const wxString
& s
);
64 // virtual void Append(const wxString& item);
65 virtual void Delete(int n
);
67 virtual int GetSelection() const ;
68 virtual void SetSelection(int n
);
69 virtual int FindString(const wxString
& s
) const;
70 virtual wxString
GetString(int n
) const ;
72 virtual wxString
GetStringSelection() const ;
73 virtual bool SetStringSelection(const wxString
& sel
);
75 virtual int Number() const { return m_noStrings
; }
76 virtual void Command(wxCommandEvent
& event
);
78 virtual void SetColumns(int n
= 1 );
79 virtual int GetColumns() const ;
84 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
85 virtual void ChangeBackgroundColour();
86 virtual void ChangeForegroundColour();
87 WXWidget
GetTopWidget() const { return m_formWidget
; }
88 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
92 WXWidget m_menuWidget
;
93 WXWidget m_buttonWidget
;
94 WXWidget
* m_widgetList
;
95 WXWidget m_formWidget
;
96 wxStringList m_stringList
;
97 wxList m_clientList
; // contains the client data for the items
99 virtual void DoSetSize(int x
, int y
,
100 int width
, int height
,
101 int sizeFlags
= wxSIZE_AUTO
);