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