Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CRadioButton.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2009 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19 CCheckBox
20 */
21 
22 #include "precompiled.h"
23 #include "GUI.h"
24 #include "CRadioButton.h"
25 
26 
28 {
29  // Important
32 
33  switch (Message.type)
34  {
35  case GUIM_PRESSED:
36  {
37  for (vector_pObjects::iterator it = GetParent()->ChildrenItBegin(); it != GetParent()->ChildrenItEnd(); ++it)
38  {
39  // Notice, if you use other objects within the parent object that has got
40  // the setting "checked", it too will change. Hence NO OTHER OBJECTS THAN
41  // RADIO BUTTONS SHOULD BE WITHIN IT!
42  GUI<bool>::SetSetting((*it), "checked", false);
43  }
44 
45  GUI<bool>::SetSetting(this, "checked", true);
46  break;
47  }
48 
49  default:
50  break;
51  }
52 }
IGUIObject * GetParent() const
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it...
Definition: IGUIObject.cpp:323
vector_pObjects::iterator ChildrenItEnd()
Definition: IGUIObject.h:226
virtual void HandleMessage(SGUIMessage &Message)
static PSRETURN SetSetting(IGUIObject *pObject, const CStr &Setting, const T &Value, const bool &SkipMessage=false)
Sets a value by name using a real datatype as input.
Definition: GUIutil.cpp:366
vector_pObjects::iterator ChildrenItBegin()
Definition: IGUIObject.h:225
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:106
EGUIMessageType type
Describes what the message regards.
Definition: GUIbase.h:122
virtual void HandleMessage(SGUIMessage &Message)
virtual void HandleMessage(SGUIMessage &Message)