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