]>
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 | 19 | IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) |
7c78e7c7 | 20 | |
01b2eeec KB |
21 | bool wxChoice::Create(wxWindow *parent, wxWindowID id, |
22 | const wxPoint& pos, | |
23 | const wxSize& size, | |
24 | int n, const wxString choices[], | |
25 | long style, | |
26 | const wxValidator& validator, | |
27 | const wxString& name) | |
28 | { | |
29 | SetName(name); | |
30 | SetValidator(validator); | |
31 | m_noStrings = n; | |
32 | m_windowStyle = style; | |
7c78e7c7 | 33 | |
01b2eeec | 34 | if (parent) parent->AddChild(this); |
7c78e7c7 | 35 | |
01b2eeec KB |
36 | if ( id == -1 ) |
37 | m_windowId = (int)NewControlId(); | |
38 | else | |
39 | m_windowId = id; | |
7c78e7c7 | 40 | |
01b2eeec KB |
41 | // TODO: create choice control |
42 | return FALSE; | |
43 | } | |
7c78e7c7 | 44 | |
01b2eeec | 45 | void wxChoice::Append(const wxString& item) |
7c78e7c7 | 46 | { |
01b2eeec KB |
47 | // TODO |
48 | m_noStrings ++; | |
49 | } | |
7c78e7c7 | 50 | |
01b2eeec | 51 | void wxChoice::Delete(int n) |
7c78e7c7 | 52 | { |
01b2eeec KB |
53 | // TODO |
54 | m_noStrings --; | |
55 | } | |
7c78e7c7 | 56 | |
01b2eeec | 57 | void wxChoice::Clear() |
7c78e7c7 | 58 | { |
01b2eeec KB |
59 | // TODO |
60 | m_noStrings = 0; | |
61 | } | |
7c78e7c7 | 62 | |
01b2eeec | 63 | int wxChoice::GetSelection() const |
7c78e7c7 | 64 | { |
01b2eeec KB |
65 | // TODO |
66 | return 0; | |
67 | } | |
7c78e7c7 | 68 | |
01b2eeec | 69 | void wxChoice::SetSelection(int n) |
7c78e7c7 | 70 | { |
01b2eeec KB |
71 | // TODO |
72 | } | |
7c78e7c7 | 73 | |
01b2eeec | 74 | int wxChoice::FindString(const wxString& s) const |
7c78e7c7 | 75 | { |
01b2eeec KB |
76 | // TODO |
77 | return 0; | |
78 | } | |
7c78e7c7 | 79 | |
01b2eeec | 80 | wxString wxChoice::GetString(int n) const |
7c78e7c7 | 81 | { |
01b2eeec KB |
82 | // TODO |
83 | return wxString(""); | |
84 | } | |
7c78e7c7 | 85 | |
01b2eeec | 86 | void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) |
7c78e7c7 | 87 | { |
01b2eeec KB |
88 | // TODO |
89 | } | |
7c78e7c7 | 90 | |
01b2eeec | 91 | wxString wxChoice::GetStringSelection () const |
7c78e7c7 | 92 | { |
01b2eeec KB |
93 | int sel = GetSelection (); |
94 | if (sel > -1) | |
95 | return wxString(this->GetString (sel)); | |
96 | else | |
97 | return wxString(""); | |
98 | } | |
99 | ||
100 | bool wxChoice::SetStringSelection (const wxString& s) | |
101 | { | |
102 | int sel = FindString (s); | |
103 | if (sel > -1) | |
104 | { | |
105 | SetSelection (sel); | |
106 | return TRUE; | |
107 | } | |
108 | else | |
109 | return FALSE; | |
110 | } | |
111 | ||
112 | void wxChoice::Command(wxCommandEvent & event) | |
7c78e7c7 | 113 | { |
01b2eeec KB |
114 | SetSelection (event.GetInt()); |
115 | ProcessCommand (event); | |
116 | } | |
7c78e7c7 | 117 |