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