Planeshift
|
00001 /* 00002 * pawsradio.h - Author: Andrew Craig 00003 * 00004 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 #ifndef PAWS_RADIOBUTTON_HEADER 00020 #define PAWS_RADIOBUTTON_HEADER 00021 00022 00023 #include "pawsbutton.h" 00024 00025 class pawsTextBox; 00026 00032 00033 enum psRadioPos 00034 { 00035 POS_LEFT, 00036 POS_RIGHT, 00037 POS_ABOVE, 00038 POS_UNDERNEATH 00039 }; 00081 class pawsRadioButton: public pawsButton 00082 { 00083 public: 00084 pawsRadioButton(); 00085 pawsRadioButton(const pawsRadioButton &origin); 00086 virtual ~pawsRadioButton(); 00087 00088 bool Setup(iDocumentNode* node); 00089 void SetState(bool state); 00090 bool GetState(); 00091 bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget); 00092 00093 pawsRadioButton* Create(const char* txt, psRadioPos pos , bool state = true); 00094 00095 pawsTextBox* GetTextBox() 00096 { 00097 return text; 00098 } 00099 00100 void SetRadioOffImage(const char &image) 00101 { 00102 radioOff=image; 00103 }; 00104 void SetRadioOnImage(const char &image) 00105 { 00106 radioOn=image; 00107 }; 00108 void SetRadioSize(int s) 00109 { 00110 size=s; 00111 }; 00112 00113 private: 00114 pawsButton* radioButton; 00115 pawsTextBox* text; 00116 00117 csString radioOff; 00118 csString radioOn; 00119 int size; 00120 00121 }; 00122 CREATE_PAWS_FACTORY(pawsRadioButton); 00123 00124 00125 00126 //--------------------------------------------------------------------------- 00127 00131 class pawsRadioButtonGroup : public pawsWidget 00132 { 00133 public: 00134 pawsRadioButtonGroup(); 00135 pawsRadioButtonGroup(const pawsRadioButtonGroup &origin): pawsWidget(origin), radioOn(origin.radioOn), radioOff(origin.radioOff), size(origin.size) 00136 { 00137 } 00138 virtual ~pawsRadioButtonGroup(); 00139 00140 bool Setup(iDocumentNode* node); 00141 00142 bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget); 00143 bool SetActive(const char* widgetName); 00144 csString GetActive(); 00145 int GetActiveID(); 00146 void TurnAllOff(); 00147 00148 csString GetRadioOnImage() 00149 { 00150 return radioOn; 00151 }; 00152 csString GetRadioOffImage() 00153 { 00154 return radioOff; 00155 }; 00156 int GetRadioSize() 00157 { 00158 return size; 00159 }; 00160 00161 private: 00162 00163 csString radioOn; 00164 csString radioOff; 00165 int size; 00166 }; 00167 CREATE_PAWS_FACTORY(pawsRadioButtonGroup); 00168 00171 #endif