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