]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.cpp | |
01b2eeec KB |
3 | // Purpose: wxChoice |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
7c78e7c7 RR |
12 | #ifdef __GNUG__ |
13 | #pragma implementation "choice.h" | |
14 | #endif | |
15 | ||
01b2eeec | 16 | // For compilers that support precompilation, includes "wx.h". |
7c78e7c7 RR |
17 | #include "wx/choice.h" |
18 | ||
01b2eeec KB |
19 | #if !USE_SHARED_LIBRARY |
20 | IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) | |
21 | #endif | |
7c78e7c7 | 22 | |
01b2eeec KB |
23 | bool wxChoice::Create(wxWindow *parent, wxWindowID id, |
24 | const wxPoint& pos, | |
25 | const wxSize& size, | |
26 | int n, const wxString choices[], | |
27 | long style, | |
28 | const wxValidator& validator, | |
29 | const wxString& name) | |
30 | { | |
31 | SetName(name); | |
32 | SetValidator(validator); | |
33 | m_noStrings = n; | |
34 | m_windowStyle = style; | |
7c78e7c7 | 35 | |
01b2eeec | 36 | if (parent) parent->AddChild(this); |
7c78e7c7 | 37 | |
01b2eeec KB |
38 | if ( id == -1 ) |
39 | m_windowId = (int)NewControlId(); | |
40 | else | |
41 | m_windowId = id; | |
7c78e7c7 | 42 | |
01b2eeec KB |
43 | // TODO: create choice control |
44 | return FALSE; | |
45 | } | |
7c78e7c7 | 46 | |
01b2eeec | 47 | void wxChoice::Append(const wxString& item) |
7c78e7c7 | 48 | { |
01b2eeec KB |
49 | // TODO |
50 | m_noStrings ++; | |
51 | } | |
7c78e7c7 | 52 | |
01b2eeec | 53 | void wxChoice::Delete(int n) |
7c78e7c7 | 54 | { |
01b2eeec KB |
55 | // TODO |
56 | m_noStrings --; | |
57 | } | |
7c78e7c7 | 58 | |
01b2eeec | 59 | void wxChoice::Clear() |
7c78e7c7 | 60 | { |
01b2eeec KB |
61 | // TODO |
62 | m_noStrings = 0; | |
63 | } | |
7c78e7c7 | 64 | |
01b2eeec | 65 | int wxChoice::GetSelection() const |
7c78e7c7 | 66 | { |
01b2eeec KB |
67 | // TODO |
68 | return 0; | |
69 | } | |
7c78e7c7 | 70 | |
01b2eeec | 71 | void wxChoice::SetSelection(int n) |
7c78e7c7 | 72 | { |
01b2eeec KB |
73 | // TODO |
74 | } | |
7c78e7c7 | 75 | |
01b2eeec | 76 | int wxChoice::FindString(const wxString& s) const |
7c78e7c7 | 77 | { |
01b2eeec KB |
78 | // TODO |
79 | return 0; | |
80 | } | |
7c78e7c7 | 81 | |
01b2eeec | 82 | wxString wxChoice::GetString(int n) const |
7c78e7c7 | 83 | { |
01b2eeec KB |
84 | // TODO |
85 | return wxString(""); | |
86 | } | |
7c78e7c7 | 87 | |
01b2eeec | 88 | void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) |
7c78e7c7 | 89 | { |
01b2eeec KB |
90 | // TODO |
91 | } | |
7c78e7c7 | 92 | |
01b2eeec | 93 | wxString wxChoice::GetStringSelection () const |
7c78e7c7 | 94 | { |
01b2eeec KB |
95 | int sel = GetSelection (); |
96 | if (sel > -1) | |
97 | return wxString(this->GetString (sel)); | |
98 | else | |
99 | return wxString(""); | |
100 | } | |
101 | ||
102 | bool wxChoice::SetStringSelection (const wxString& s) | |
103 | { | |
104 | int sel = FindString (s); | |
105 | if (sel > -1) | |
106 | { | |
107 | SetSelection (sel); | |
108 | return TRUE; | |
109 | } | |
110 | else | |
111 | return FALSE; | |
112 | } | |
113 | ||
114 | void wxChoice::Command(wxCommandEvent & event) | |
7c78e7c7 | 115 | { |
01b2eeec KB |
116 | SetSelection (event.GetInt()); |
117 | ProcessCommand (event); | |
118 | } | |
7c78e7c7 | 119 |