1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/choice.h
3 // Purpose: wxChoice class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/clntdata.h"
16 #ifndef wxWIDGET_ARRAY_DEFINED
17 #define wxWIDGET_ARRAY_DEFINED
19 #include "wx/dynarray.h"
20 WX_DEFINE_ARRAY_PTR(WXWidget
, wxWidgetArray
);
24 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
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
)
41 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
44 wxChoice(wxWindow
*parent
, wxWindowID id
,
47 const wxArrayString
& choices
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxChoiceNameStr
)
53 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
56 bool Create(wxWindow
*parent
, wxWindowID id
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
59 int n
= 0, const wxString choices
[] = NULL
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxChoiceNameStr
);
64 bool Create(wxWindow
*parent
, wxWindowID id
,
67 const wxArrayString
& choices
,
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxChoiceNameStr
);
72 // implementation of wxControlWithItems
73 virtual unsigned int GetCount() const;
74 virtual int GetSelection() const;
75 virtual void DoDeleteOneItem(unsigned int n
);
76 virtual void DoClear();
77 virtual void SetString(unsigned int n
, const wxString
& s
);
78 virtual wxString
GetString(unsigned int n
) const;
80 // implementation of wxChoiceBase
81 virtual void SetSelection(int n
);
82 virtual void SetColumns(int n
= 1 );
83 virtual int GetColumns() const ;
86 virtual void Command(wxCommandEvent
& event
);
91 virtual void ChangeFont(bool keepOriginalSize
= true);
92 virtual void ChangeBackgroundColour();
93 virtual void ChangeForegroundColour();
94 WXWidget
GetTopWidget() const { return m_formWidget
; }
95 WXWidget
GetMainWidget() const { return m_buttonWidget
; }
97 virtual wxSize
DoGetBestSize() const;
99 // implementation, for wxChoiceCallback
100 const wxWidgetArray
& GetWidgets() const { return m_widgetArray
; }
101 const wxArrayString
& GetStrings() const { return m_stringArray
; }
103 // minimum size for the text ctrl
104 wxSize
GetItemsSize() const;
105 // common part of all contructors
108 WXWidget m_menuWidget
;
109 WXWidget m_buttonWidget
;
110 wxWidgetArray m_widgetArray
;
111 WXWidget m_formWidget
;
112 wxArrayString m_stringArray
;
114 virtual void DoSetSize(int x
, int y
,
115 int width
, int height
,
116 int sizeFlags
= wxSIZE_AUTO
);
118 // implementation of wxControlWithItems
119 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
121 void **clientData
, wxClientDataType type
);
124 #endif // _WX_CHOICE_H_