]> git.saurik.com Git - wxWidgets.git/blob - src/mac/radiobox.cpp
mac adaptions
[wxWidgets.git] / src / mac / radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: radiobox.cpp
3 // Purpose: wxRadioBox
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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 int wxRadioBox::FindString(const wxString& s) const
71 {
72 // TODO
73 return -1;
74 }
75
76 void wxRadioBox::SetSelection(int n)
77 {
78 if ((n < 0) || (n >= m_noItems))
79 return;
80 // TODO
81
82 m_selectedButton = n;
83 }
84
85 // Get single selection, for single choice list items
86 int wxRadioBox::GetSelection() const
87 {
88 return m_selectedButton;
89 }
90
91 // Find string for position
92 wxString wxRadioBox::GetString(int n) const
93 {
94 // TODO
95 return wxString("");
96 }
97
98 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
99 {
100 wxControl::DoSetSize( x , y , width , height , sizeFlags ) ;
101 }
102
103 void wxRadioBox::GetSize(int *width, int *height) const
104 {
105 wxControl::GetSize( width , height ) ;
106 }
107
108 void wxRadioBox::GetPosition(int *x, int *y) const
109 {
110 wxControl::GetPosition( x , y ) ;
111 }
112
113 wxString wxRadioBox::GetLabel( int item ) const
114 {
115 // TODO
116 return wxString("");
117 }
118
119 void wxRadioBox::SetLabel(int item , const wxString& label)
120 {
121 // TODO
122 }
123
124 void wxRadioBox::SetFocus()
125 {
126 // TODO
127 }
128
129 bool wxRadioBox::Show(bool show)
130 {
131 return wxControl::Show( show ) ;
132 }
133
134 // Enable a specific button
135 void wxRadioBox::Enable(int item, bool enable)
136 {
137 }
138
139 // Enable all controls
140 bool wxRadioBox::Enable(bool enable)
141 {
142 return wxControl::Enable(enable);
143 }
144
145 // Show a specific button
146 void wxRadioBox::Show(int item, bool show)
147 {
148 // TODO
149 }
150
151 // For single selection items only
152 wxString wxRadioBox::GetStringSelection () const
153 {
154 int sel = GetSelection ();
155 if (sel > -1)
156 return this->GetString (sel);
157 else
158 return wxString("");
159 }
160
161 bool wxRadioBox::SetStringSelection (const wxString& s)
162 {
163 int sel = FindString (s);
164 if (sel > -1)
165 {
166 SetSelection (sel);
167 return TRUE;
168 }
169 else
170 return FALSE;
171 }
172
173 void wxRadioBox::Command (wxCommandEvent & event)
174 {
175 SetSelection (event.m_commandInt);
176 ProcessCommand (event);
177 }
178
179