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 WXDLLIMPEXP_CORE 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 GetSelection() const;
76 virtual void DoDeleteOneItem(unsigned int n
);
77 virtual void DoClear();
78 virtual void SetString(unsigned int n
, const wxString
& s
);
79 virtual wxString
GetString(unsigned int n
) const;
81 // implementation of wxChoiceBase
82 virtual void SetSelection(int n
);
83 virtual void SetColumns(int n
= 1 );
84 virtual int GetColumns() const ;
87 virtual void Command(wxCommandEvent
& event
);
92 virtual void ChangeFont(bool keepOriginalSize
= true);
93 virtual void ChangeBackgroundColour();
94 virtual void ChangeForegroundColour();
95 WXWidget
GetTopWidget() const { return m_formWidget
; }
96 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
98 virtual wxSize
DoGetBestSize() const;
100 // implementation, for wxChoiceCallback
101 const wxWidgetArray
& GetWidgets() const { return m_widgetArray
; }
102 const wxStringList
& GetStrings() const { return m_stringList
; }
104 // minimum size for the text ctrl
105 wxSize
GetItemsSize() const;
106 // common part of all contructors
109 unsigned int m_noStrings
;
110 WXWidget m_menuWidget
;
111 WXWidget m_buttonWidget
;
112 wxWidgetArray m_widgetArray
;
113 WXWidget m_formWidget
;
114 wxStringList m_stringList
;
116 virtual void DoSetSize(int x
, int y
,
117 int width
, int height
,
118 int sizeFlags
= wxSIZE_AUTO
);
120 // implementation of wxControlWithItems
121 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
123 void **clientData
, wxClientDataType type
);
126 #endif // _WX_CHOICE_H_