]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/motif/choice.h |
9b6dbb09 JS |
3 | // Purpose: wxChoice class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
853dcc57 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
ec75d791 | 15 | #include "wx/clntdata.h" |
ec75d791 | 16 | |
3bdb8629 MB |
17 | #ifndef wxWIDGET_ARRAY_DEFINED |
18 | #define wxWIDGET_ARRAY_DEFINED | |
19 | ||
20 | #include "wx/dynarray.h" | |
4b4f6e0f | 21 | WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray); |
3bdb8629 | 22 | #endif |
ec75d791 | 23 | |
9b6dbb09 | 24 | // Choice item |
53a2db12 | 25 | class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase |
9b6dbb09 | 26 | { |
bfc6fde4 | 27 | DECLARE_DYNAMIC_CLASS(wxChoice) |
ec75d791 | 28 | |
bfc6fde4 VZ |
29 | public: |
30 | wxChoice(); | |
d3c7fc99 | 31 | virtual ~wxChoice(); |
853dcc57 | 32 | |
bfc6fde4 | 33 | wxChoice(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
34 | const wxPoint& pos = wxDefaultPosition, |
35 | const wxSize& size = wxDefaultSize, | |
36 | int n = 0, const wxString choices[] = NULL, | |
37 | long style = 0, | |
38 | const wxValidator& validator = wxDefaultValidator, | |
39 | const wxString& name = wxChoiceNameStr) | |
bfc6fde4 | 40 | { |
ec75d791 | 41 | Init(); |
bfc6fde4 VZ |
42 | Create(parent, id, pos, size, n, choices, style, validator, name); |
43 | } | |
853dcc57 | 44 | |
584ad2a3 MB |
45 | wxChoice(wxWindow *parent, wxWindowID id, |
46 | const wxPoint& pos, | |
47 | const wxSize& size, | |
48 | const wxArrayString& choices, | |
49 | long style = 0, | |
50 | const wxValidator& validator = wxDefaultValidator, | |
51 | const wxString& name = wxChoiceNameStr) | |
52 | { | |
53 | Init(); | |
54 | Create(parent, id, pos, size, choices, style, validator, name); | |
55 | } | |
56 | ||
bfc6fde4 | 57 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
58 | const wxPoint& pos = wxDefaultPosition, |
59 | const wxSize& size = wxDefaultSize, | |
60 | int n = 0, const wxString choices[] = NULL, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
584ad2a3 MB |
63 | const wxString& name = wxChoiceNameStr); |
64 | ||
65 | bool Create(wxWindow *parent, wxWindowID id, | |
66 | const wxPoint& pos, | |
67 | const wxSize& size, | |
68 | const wxArrayString& choices, | |
69 | long style = 0, | |
70 | const wxValidator& validator = wxDefaultValidator, | |
83df96d6 | 71 | const wxString& name = wxChoiceNameStr); |
ec75d791 MB |
72 | |
73 | // implementation of wxControlWithItems | |
aa61d352 | 74 | virtual unsigned int GetCount() const; |
ec75d791 | 75 | virtual int GetSelection() const; |
a236aa20 VZ |
76 | virtual void DoDeleteOneItem(unsigned int n); |
77 | virtual void DoClear(); | |
aa61d352 VZ |
78 | virtual void SetString(unsigned int n, const wxString& s); |
79 | virtual wxString GetString(unsigned int n) const; | |
ec75d791 MB |
80 | |
81 | // implementation of wxChoiceBase | |
bfc6fde4 | 82 | virtual void SetSelection(int n); |
bfc6fde4 VZ |
83 | virtual void SetColumns(int n = 1 ); |
84 | virtual int GetColumns() const ; | |
853dcc57 WS |
85 | |
86 | // Original API | |
ec75d791 | 87 | virtual void Command(wxCommandEvent& event); |
853dcc57 | 88 | |
bfc6fde4 | 89 | void SetFocus(); |
853dcc57 | 90 | |
bfc6fde4 | 91 | // Implementation |
96be256b | 92 | virtual void ChangeFont(bool keepOriginalSize = true); |
bfc6fde4 VZ |
93 | virtual void ChangeBackgroundColour(); |
94 | virtual void ChangeForegroundColour(); | |
95 | WXWidget GetTopWidget() const { return m_formWidget; } | |
96 | WXWidget GetMainWidget() const { return m_buttonWidget; } | |
ec75d791 MB |
97 | |
98 | virtual wxSize DoGetBestSize() const; | |
99 | ||
100 | // implementation, for wxChoiceCallback | |
101 | const wxWidgetArray& GetWidgets() const { return m_widgetArray; } | |
102 | const wxStringList& GetStrings() const { return m_stringList; } | |
9b6dbb09 | 103 | protected: |
ec75d791 MB |
104 | // minimum size for the text ctrl |
105 | wxSize GetItemsSize() const; | |
106 | // common part of all contructors | |
107 | void Init(); | |
108 | ||
aa61d352 | 109 | unsigned int m_noStrings; |
bfc6fde4 VZ |
110 | WXWidget m_menuWidget; |
111 | WXWidget m_buttonWidget; | |
ec75d791 | 112 | wxWidgetArray m_widgetArray; |
bfc6fde4 VZ |
113 | WXWidget m_formWidget; |
114 | wxStringList m_stringList; | |
853dcc57 | 115 | |
bfc6fde4 | 116 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
117 | int width, int height, |
118 | int sizeFlags = wxSIZE_AUTO); | |
a236aa20 VZ |
119 | |
120 | // implementation of wxControlWithItems | |
121 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
122 | unsigned int pos, | |
123 | void **clientData, wxClientDataType type); | |
9b6dbb09 JS |
124 | }; |
125 | ||
a236aa20 | 126 | #endif // _WX_CHOICE_H_ |