Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / interfaces_manager / radio_controller.cpp
blob476a2dea67b47481807799f4bc6dde0942bebe09
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program 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 Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "stdpch.h"
22 //////////////
23 // Includes //
24 //////////////
25 // Misc.
26 // Net.
27 // 3D Interface.
28 #include "nel/3d/u_driver.h"
29 // Client.
30 #include "radio_controller.h"
33 //-----------------------------------------------
34 // CRadioController :
35 // Constructor.
36 //-----------------------------------------------
37 CRadioController::CRadioController(uint id)
38 : CControl(id)
40 // _Selected = -1;
41 }// CRadioController //
44 //-----------------------------------------------
45 // ~CRadioController :
46 // Destructor.
47 //-----------------------------------------------
48 CRadioController::~CRadioController()
50 _Buttons.clear();
51 }// ~CRadioController //
53 //-----------------------------------------------
54 // add :
55 // Add a button to the group.
56 // Return true or false if the button do not have been inserted.
57 //-----------------------------------------------
58 bool CRadioController::add(CRadioButton *button)
60 // Test if the pointer is allocated.
61 if(button)
63 nlassert(button);
65 _Buttons.push_back(button);
66 button->setController( this );
68 return true;
70 else
72 return false;
74 }// add //
76 //-----------------------------------------------
77 // select :
78 // Select a button.
79 //-----------------------------------------------
80 void CRadioController::select(uint s)
82 //nlassert( s < _Buttons.size() );
83 if (s >= _Buttons.size() )
85 nlwarning("<CRadioController::select> : trying to select a button out of range");
86 return;
89 _Buttons[s]->select();
90 }// select //
93 //-----------------------------------------------
94 // click :
95 // Manage the click of the mouse for the Buttons.
96 //-----------------------------------------------
97 void CRadioController::click(float x, float y, bool &taken)
100 TVectButtons::iterator it;
101 const TVectButtons::iterator itEnd = _Buttons.end();
103 for (it = _Buttons.begin() ; it != itEnd ; ++it)
105 (*it)->radioClick(x, y, taken );
107 }// click //
111 //-----------------------------------------------
112 // unselectAll :
113 //-----------------------------------------------
114 void CRadioController::unselectAll()
116 TVectButtons::iterator it;
117 const TVectButtons::iterator itEnd = _Buttons.end();
119 for (it = _Buttons.begin() ; it != itEnd ; ++it)
121 (*it)->unSelect();
123 }// unselectAll //