1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/choice.h
3 // Purpose: wxChoice class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/clntdata.h"
17 #ifndef wxWIDGET_ARRAY_DEFINED
18 #define wxWIDGET_ARRAY_DEFINED
20 #include "wx/dynarray.h"
21 WX_DEFINE_ARRAY_PTR(WXWidget
, wxWidgetArray
);
25 class WXDLLEXPORT wxChoice
: public wxChoiceBase
27 DECLARE_DYNAMIC_CLASS(wxChoice
)
33 wxChoice(wxWindow
*parent
, wxWindowID id
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
36 int n
= 0, const wxString choices
[] = NULL
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxChoiceNameStr
)
42 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
45 wxChoice(wxWindow
*parent
, wxWindowID id
,
48 const wxArrayString
& choices
,
50 const wxValidator
& validator
= wxDefaultValidator
,
51 const wxString
& name
= wxChoiceNameStr
)
54 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
57 bool Create(wxWindow
*parent
, wxWindowID id
,
58 const wxPoint
& pos
= wxDefaultPosition
,
59 const wxSize
& size
= wxDefaultSize
,
60 int n
= 0, const wxString choices
[] = NULL
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxChoiceNameStr
);
65 bool Create(wxWindow
*parent
, wxWindowID id
,
68 const wxArrayString
& choices
,
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxChoiceNameStr
);
73 // implementation of wxControlWithItems
74 virtual unsigned int GetCount() const;
75 virtual int DoAppend(const wxString
& item
);
76 virtual int DoInsert(const wxString
& item
, unsigned int pos
);
77 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
78 virtual void* DoGetItemClientData(unsigned int n
) const;
79 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
80 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
81 virtual int GetSelection() const;
82 virtual void Delete(unsigned int n
);
84 virtual void SetString(unsigned int n
, const wxString
& s
);
85 virtual wxString
GetString(unsigned int n
) const;
87 // implementation of wxChoiceBase
88 virtual void SetSelection(int n
);
89 virtual void SetColumns(int n
= 1 );
90 virtual int GetColumns() const ;
93 virtual void Command(wxCommandEvent
& event
);
98 virtual void ChangeFont(bool keepOriginalSize
= true);
99 virtual void ChangeBackgroundColour();
100 virtual void ChangeForegroundColour();
101 WXWidget
GetTopWidget() const { return m_formWidget
; }
102 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
104 virtual wxSize
DoGetBestSize() const;
106 // implementation, for wxChoiceCallback
107 const wxWidgetArray
& GetWidgets() const { return m_widgetArray
; }
108 const wxStringList
& GetStrings() const { return m_stringList
; }
110 // minimum size for the text ctrl
111 wxSize
GetItemsSize() const;
112 // common part of all contructors
115 unsigned int m_noStrings
;
116 WXWidget m_menuWidget
;
117 WXWidget m_buttonWidget
;
118 wxWidgetArray m_widgetArray
;
119 WXWidget m_formWidget
;
120 wxStringList m_stringList
;
121 wxClientDataDictionary m_clientDataDict
;
123 virtual void DoSetSize(int x
, int y
,
124 int width
, int height
,
125 int sizeFlags
= wxSIZE_AUTO
);