Motif files added.
[wxWidgets.git] / src / motif / radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.cpp
3 // Purpose: wxRadioBox
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 #ifdef __GNUG__
13 #pragma implementation "radiobox.h"
14 #endif
15
16 #include "wx/radiobox.h"
17
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
20 #endif
21
22 // Radio box item
23 wxRadioBox::wxRadioBox()
24 {
25 m_selectedButton = -1;
26 m_noItems = 0;
27 m_noRowsOrCols = 0;
28 m_majorDim = 0 ;
29 }
30
31 bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
32 const wxPoint& pos, const wxSize& size,
33 int n, const wxString choices[],
34 int majorDim, long style,
35 const wxValidator& val, const wxString& name)
36 {
37 m_selectedButton = -1;
38 m_noItems = n;
39
40 SetName(name);
41 SetValidator(val);
42
43 parent->AddChild(this);
44
45 m_windowStyle = (long&)style;
46
47 if (id == -1)
48 m_windowId = NewControlId();
49 else
50 m_windowId = id;
51
52 m_noRowsOrCols = majorDim;
53
54 if (majorDim==0)
55 m_majorDim = n ;
56 else
57 m_majorDim = majorDim ;
58
59
60 // TODO create radiobox
61 return FALSE;
62 }
63
64
65 wxRadioBox::~wxRadioBox()
66 {
67 // TODO
68 }
69
70 wxString wxRadioBox::GetLabel(int item) const
71 {
72 // TODO
73 return wxString("");
74 }
75
76 void wxRadioBox::SetLabel(int item, const wxString& label)
77 {
78 // TODO
79 }
80
81 int wxRadioBox::FindString(const wxString& s) const
82 {
83 // TODO
84 return -1;
85 }
86
87 void wxRadioBox::SetSelection(int n)
88 {
89 if ((n < 0) || (n >= m_noItems))
90 return;
91 // TODO
92
93 m_selectedButton = n;
94 }
95
96 // Get single selection, for single choice list items
97 int wxRadioBox::GetSelection() const
98 {
99 return m_selectedButton;
100 }
101
102 // Find string for position
103 wxString wxRadioBox::GetString(int n) const
104 {
105 // TODO
106 return wxString("");
107 }
108
109 void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
110 {
111 // TODO
112 }
113
114 void wxRadioBox::GetSize(int *width, int *height) const
115 {
116 // TODO
117 }
118
119 void wxRadioBox::GetPosition(int *x, int *y) const
120 {
121 // TODO
122 }
123
124 wxString wxRadioBox::GetLabel() const
125 {
126 // TODO
127 return wxString("");
128 }
129
130 void wxRadioBox::SetLabel(const wxString& label)
131 {
132 // TODO
133 }
134
135 void wxRadioBox::SetFocus()
136 {
137 // TODO
138 }
139
140 bool wxRadioBox::Show(bool show)
141 {
142 // TODO
143 return FALSE;
144 }
145
146 // Enable a specific button
147 void wxRadioBox::Enable(int item, bool enable)
148 {
149 // TODO
150 }
151
152 // Enable all controls
153 void wxRadioBox::Enable(bool enable)
154 {
155 wxControl::Enable(enable);
156
157 // TODO
158 }
159
160 // Show a specific button
161 void wxRadioBox::Show(int item, bool show)
162 {
163 // TODO
164 }
165
166 // For single selection items only
167 wxString wxRadioBox::GetStringSelection () const
168 {
169 int sel = GetSelection ();
170 if (sel > -1)
171 return this->GetString (sel);
172 else
173 return wxString("");
174 }
175
176 bool wxRadioBox::SetStringSelection (const wxString& s)
177 {
178 int sel = FindString (s);
179 if (sel > -1)
180 {
181 SetSelection (sel);
182 return TRUE;
183 }
184 else
185 return FALSE;
186 }
187
188 void wxRadioBox::Command (wxCommandEvent & event)
189 {
190 SetSelection (event.m_commandInt);
191 ProcessCommand (event);
192 }
193
194