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