]>
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
3399051e | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
9b6dbb09 JS |
16 | #pragma interface "choice.h" |
17 | #endif | |
18 | ||
ec75d791 MB |
19 | #include "wx/clntdata.h" |
20 | #include "wx/dynarray.h" | |
21 | ||
22 | WX_DEFINE_ARRAY(WXWidget, wxWidgetArray); | |
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 | |
bfc6fde4 | 45 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
46 | const wxPoint& pos = wxDefaultPosition, |
47 | const wxSize& size = wxDefaultSize, | |
48 | int n = 0, const wxString choices[] = NULL, | |
49 | long style = 0, | |
50 | const wxValidator& validator = wxDefaultValidator, | |
51 | const wxString& name = wxChoiceNameStr); | |
ec75d791 MB |
52 | |
53 | // implementation of wxControlWithItems | |
6adaedf0 JS |
54 | virtual int GetCount() const; |
55 | virtual int DoAppend(const wxString& item); | |
243dbf1a | 56 | virtual int DoInsert(const wxString& item, int pos); |
6adaedf0 JS |
57 | virtual void DoSetItemClientData(int n, void* clientData); |
58 | virtual void* DoGetItemClientData(int n) const; | |
59 | virtual void DoSetItemClientObject(int n, wxClientData* clientData); | |
60 | virtual wxClientData* DoGetItemClientObject(int n) const; | |
ec75d791 | 61 | virtual int GetSelection() const; |
bfc6fde4 | 62 | virtual void Delete(int n); |
ec75d791 | 63 | virtual int FindString(const wxString& s) const; |
bfc6fde4 | 64 | virtual void Clear(); |
ec75d791 MB |
65 | virtual void SetString(int n, const wxString& s); |
66 | virtual wxString GetString(int n) const; | |
67 | ||
68 | // implementation of wxChoiceBase | |
bfc6fde4 | 69 | virtual void SetSelection(int n); |
bfc6fde4 VZ |
70 | virtual void SetColumns(int n = 1 ); |
71 | virtual int GetColumns() const ; | |
83df96d6 | 72 | |
ec75d791 MB |
73 | // Original API |
74 | virtual void Command(wxCommandEvent& event); | |
75 | ||
bfc6fde4 | 76 | void SetFocus(); |
83df96d6 | 77 | |
bfc6fde4 VZ |
78 | // Implementation |
79 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
80 | virtual void ChangeBackgroundColour(); | |
81 | virtual void ChangeForegroundColour(); | |
82 | WXWidget GetTopWidget() const { return m_formWidget; } | |
83 | WXWidget GetMainWidget() const { return m_buttonWidget; } | |
ec75d791 MB |
84 | |
85 | virtual wxSize DoGetBestSize() const; | |
86 | ||
87 | // implementation, for wxChoiceCallback | |
88 | const wxWidgetArray& GetWidgets() const { return m_widgetArray; } | |
89 | const wxStringList& GetStrings() const { return m_stringList; } | |
9b6dbb09 | 90 | protected: |
ec75d791 MB |
91 | // minimum size for the text ctrl |
92 | wxSize GetItemsSize() const; | |
93 | // common part of all contructors | |
94 | void Init(); | |
95 | ||
fd304d98 | 96 | size_t m_noStrings; |
bfc6fde4 VZ |
97 | WXWidget m_menuWidget; |
98 | WXWidget m_buttonWidget; | |
ec75d791 | 99 | wxWidgetArray m_widgetArray; |
bfc6fde4 VZ |
100 | WXWidget m_formWidget; |
101 | wxStringList m_stringList; | |
ec75d791 | 102 | wxClientDataDictionary m_clientDataDict; |
83df96d6 | 103 | |
bfc6fde4 | 104 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
105 | int width, int height, |
106 | int sizeFlags = wxSIZE_AUTO); | |
9b6dbb09 JS |
107 | }; |
108 | ||
109 | #endif | |
83df96d6 | 110 | // _WX_CHOICE_H_ |