1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
28 #include "nel/3d/u_driver.h"
30 #include "radio_controller.h"
33 //-----------------------------------------------
36 //-----------------------------------------------
37 CRadioController::CRadioController(uint id
)
41 }// CRadioController //
44 //-----------------------------------------------
45 // ~CRadioController :
47 //-----------------------------------------------
48 CRadioController::~CRadioController()
51 }// ~CRadioController //
53 //-----------------------------------------------
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.
65 _Buttons
.push_back(button
);
66 button
->setController( this );
76 //-----------------------------------------------
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");
89 _Buttons
[s
]->select();
93 //-----------------------------------------------
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
);
111 //-----------------------------------------------
113 //-----------------------------------------------
114 void CRadioController::unselectAll()
116 TVectButtons::iterator it
;
117 const TVectButtons::iterator itEnd
= _Buttons
.end();
119 for (it
= _Buttons
.begin() ; it
!= itEnd
; ++it
)