Planeshift
pawsradio.h
Go to the documentation of this file.
1 /*
2  * pawsradio.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef PAWS_RADIOBUTTON_HEADER
20 #define PAWS_RADIOBUTTON_HEADER
21 
22 
23 #include "pawsbutton.h"
24 
25 class pawsTextBox;
26 
32 enum psRadioPos
34 {
39 };
82 {
83 public:
85  pawsRadioButton(const pawsRadioButton &origin);
86  virtual ~pawsRadioButton();
87 
88  bool Setup(iDocumentNode* node);
89  void SetState(bool state);
90  bool GetState();
91  bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
92 
93  pawsRadioButton* Create(const char* txt, psRadioPos pos , bool state = true);
94 
96  {
97  return text;
98  }
99 
100  void SetRadioOffImage(const char &image)
101  {
102  radioOff=image;
103  };
104  void SetRadioOnImage(const char &image)
105  {
106  radioOn=image;
107  };
108  void SetRadioSize(int s)
109  {
110  size=s;
111  };
112 
113 private:
114  pawsButton* radioButton;
115  pawsTextBox* text;
116 
117  csString radioOff;
118  csString radioOn;
119  int size;
120 
121 };
123 
124 
125 
126 //---------------------------------------------------------------------------
127 
132 {
133 public:
135  pawsRadioButtonGroup(const pawsRadioButtonGroup &origin): pawsWidget(origin), radioOn(origin.radioOn), radioOff(origin.radioOff), size(origin.size)
136  {
137  }
138  virtual ~pawsRadioButtonGroup();
139 
140  bool Setup(iDocumentNode* node);
141 
142  bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
143  bool SetActive(const char* widgetName);
144  csString GetActive();
145  int GetActiveID();
146  void TurnAllOff();
147 
148  csString GetRadioOnImage()
149  {
150  return radioOn;
151  };
152  csString GetRadioOffImage()
153  {
154  return radioOff;
155  };
157  {
158  return size;
159  };
160 
161 private:
162 
163  csString radioOn;
164  csString radioOff;
165  int size;
166 };
168 
171 #endif
void SetRadioOnImage(const char &image)
Definition: pawsradio.h:104
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
A combination widget that has a radio button and a text label.
Definition: pawsradio.h:81
bool Setup(iDocumentNode *node)
Setup this widget.
virtual ~pawsRadioButton()
pawsRadioButton * Create(const char *txt, psRadioPos pos, bool state=true)
void SetState(bool state)
pawsRadioButtonGroup(const pawsRadioButtonGroup &origin)
Definition: pawsradio.h:135
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
csString GetRadioOnImage()
Definition: pawsradio.h:148
void SetRadioSize(int s)
Definition: pawsradio.h:108
CREATE_PAWS_FACTORY(pawsRadioButton)
void SetRadioOffImage(const char &image)
Definition: pawsradio.h:100
A simple button widget.
Definition: pawsbutton.h:43
psRadioPos
position of radio button
Definition: pawsradio.h:33
pawsTextBox * GetTextBox()
Definition: pawsradio.h:95
A basic text box widget.
Definition: pawstextbox.h:42
csString GetRadioOffImage()
Definition: pawsradio.h:152
This is a set of radio buttons and is used to control them.
Definition: pawsradio.h:131