]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.h | |
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 | |
65571936 | 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 |
c33c81c3 | 25 | class WXDLLEXPORT wxChoice: public wxChoiceBase |
9b6dbb09 | 26 | { |
bfc6fde4 | 27 | DECLARE_DYNAMIC_CLASS(wxChoice) |
ec75d791 | 28 | |
bfc6fde4 VZ |
29 | public: |
30 | wxChoice(); | |
31 | ~wxChoice(); | |
83df96d6 | 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 | } | |
83df96d6 | 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 | |
6adaedf0 JS |
74 | virtual int GetCount() const; |
75 | virtual int DoAppend(const wxString& item); | |
243dbf1a | 76 | virtual int DoInsert(const wxString& item, int pos); |
6adaedf0 JS |
77 | virtual void DoSetItemClientData(int n, void* clientData); |
78 | virtual void* DoGetItemClientData(int n) const; | |
79 | virtual void DoSetItemClientObject(int n, wxClientData* clientData); | |
80 | virtual wxClientData* DoGetItemClientObject(int n) const; | |
ec75d791 | 81 | virtual int GetSelection() const; |
bfc6fde4 | 82 | virtual void Delete(int n); |
ec75d791 | 83 | virtual int FindString(const wxString& s) const; |
bfc6fde4 | 84 | virtual void Clear(); |
ec75d791 MB |
85 | virtual void SetString(int n, const wxString& s); |
86 | virtual wxString GetString(int n) const; | |
87 | ||
88 | // implementation of wxChoiceBase | |
bfc6fde4 | 89 | virtual void SetSelection(int n); |
bfc6fde4 VZ |
90 | virtual void SetColumns(int n = 1 ); |
91 | virtual int GetColumns() const ; | |
83df96d6 | 92 | |
ec75d791 MB |
93 | // Original API |
94 | virtual void Command(wxCommandEvent& event); | |
95 | ||
bfc6fde4 | 96 | void SetFocus(); |
83df96d6 | 97 | |
bfc6fde4 | 98 | // Implementation |
96be256b | 99 | virtual void ChangeFont(bool keepOriginalSize = true); |
bfc6fde4 VZ |
100 | virtual void ChangeBackgroundColour(); |
101 | virtual void ChangeForegroundColour(); | |
102 | WXWidget GetTopWidget() const { return m_formWidget; } | |
103 | WXWidget GetMainWidget() const { return m_buttonWidget; } | |
ec75d791 MB |
104 | |
105 | virtual wxSize DoGetBestSize() const; | |
106 | ||
107 | // implementation, for wxChoiceCallback | |
108 | const wxWidgetArray& GetWidgets() const { return m_widgetArray; } | |
109 | const wxStringList& GetStrings() const { return m_stringList; } | |
9b6dbb09 | 110 | protected: |
ec75d791 MB |
111 | // minimum size for the text ctrl |
112 | wxSize GetItemsSize() const; | |
113 | // common part of all contructors | |
114 | void Init(); | |
115 | ||
fd304d98 | 116 | size_t m_noStrings; |
bfc6fde4 VZ |
117 | WXWidget m_menuWidget; |
118 | WXWidget m_buttonWidget; | |
ec75d791 | 119 | wxWidgetArray m_widgetArray; |
bfc6fde4 VZ |
120 | WXWidget m_formWidget; |
121 | wxStringList m_stringList; | |
ec75d791 | 122 | wxClientDataDictionary m_clientDataDict; |
83df96d6 | 123 | |
bfc6fde4 | 124 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
125 | int width, int height, |
126 | int sizeFlags = wxSIZE_AUTO); | |
9b6dbb09 JS |
127 | }; |
128 | ||
129 | #endif | |
83df96d6 | 130 | // _WX_CHOICE_H_ |