]>
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 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "choice.h" | |
17 | #endif | |
18 | ||
6adaedf0 | 19 | #include "wx/ctrlsub.h" |
9b6dbb09 JS |
20 | |
21 | WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr; | |
22 | ||
23 | // Choice item | |
6adaedf0 | 24 | class WXDLLEXPORT wxChoice: public wxControlWithItems |
9b6dbb09 | 25 | { |
bfc6fde4 | 26 | DECLARE_DYNAMIC_CLASS(wxChoice) |
83df96d6 | 27 | |
bfc6fde4 VZ |
28 | public: |
29 | wxChoice(); | |
30 | ~wxChoice(); | |
83df96d6 | 31 | |
bfc6fde4 | 32 | wxChoice(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
33 | const wxPoint& pos = wxDefaultPosition, |
34 | const wxSize& size = wxDefaultSize, | |
35 | int n = 0, const wxString choices[] = NULL, | |
36 | long style = 0, | |
37 | const wxValidator& validator = wxDefaultValidator, | |
38 | const wxString& name = wxChoiceNameStr) | |
bfc6fde4 VZ |
39 | { |
40 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
41 | } | |
83df96d6 | 42 | |
bfc6fde4 | 43 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
44 | const wxPoint& pos = wxDefaultPosition, |
45 | const wxSize& size = wxDefaultSize, | |
46 | int n = 0, const wxString choices[] = NULL, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxChoiceNameStr); | |
50 | ||
6adaedf0 JS |
51 | // Virtual functions required by wxControlWithItems. |
52 | // They are not all implemented yet :-( | |
53 | virtual int GetCount() const; | |
54 | virtual int DoAppend(const wxString& item); | |
55 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
56 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
57 | virtual void DoSetFirstItem(int n); | |
58 | virtual void DoSetItemClientData(int n, void* clientData); | |
59 | virtual void* DoGetItemClientData(int n) const; | |
60 | virtual void DoSetItemClientObject(int n, wxClientData* clientData); | |
61 | virtual wxClientData* DoGetItemClientObject(int n) const; | |
62 | virtual void Select(int n); | |
63 | virtual void SetString(int n, const wxString& s); | |
83df96d6 | 64 | |
6adaedf0 | 65 | // Original API |
bfc6fde4 VZ |
66 | virtual void Append(const wxString& item); |
67 | virtual void Delete(int n); | |
68 | virtual void Clear(); | |
69 | virtual int GetSelection() const ; | |
70 | virtual void SetSelection(int n); | |
71 | virtual int FindString(const wxString& s) const; | |
72 | virtual wxString GetString(int n) const ; | |
83df96d6 | 73 | |
bfc6fde4 VZ |
74 | virtual wxString GetStringSelection() const ; |
75 | virtual bool SetStringSelection(const wxString& sel); | |
83df96d6 | 76 | |
bfc6fde4 VZ |
77 | virtual int Number() const { return m_noStrings; } |
78 | virtual void Command(wxCommandEvent& event); | |
83df96d6 | 79 | |
bfc6fde4 VZ |
80 | virtual void SetColumns(int n = 1 ); |
81 | virtual int GetColumns() const ; | |
83df96d6 | 82 | |
bfc6fde4 | 83 | void SetFocus(); |
83df96d6 | 84 | |
bfc6fde4 VZ |
85 | // Implementation |
86 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
87 | virtual void ChangeBackgroundColour(); | |
88 | virtual void ChangeForegroundColour(); | |
89 | WXWidget GetTopWidget() const { return m_formWidget; } | |
90 | WXWidget GetMainWidget() const { return m_buttonWidget; } | |
83df96d6 | 91 | |
9b6dbb09 | 92 | protected: |
bfc6fde4 VZ |
93 | int m_noStrings; |
94 | WXWidget m_menuWidget; | |
95 | WXWidget m_buttonWidget; | |
96 | WXWidget* m_widgetList ; | |
97 | WXWidget m_formWidget; | |
98 | wxStringList m_stringList; | |
f6bcfd97 | 99 | wxList m_clientList; // contains the client data for the items |
83df96d6 | 100 | |
bfc6fde4 | 101 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
102 | int width, int height, |
103 | int sizeFlags = wxSIZE_AUTO); | |
9b6dbb09 JS |
104 | }; |
105 | ||
106 | #endif | |
83df96d6 | 107 | // _WX_CHOICE_H_ |