1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "nel/gui/root_group.h"
31 CRootGroup::CRootGroup(const TCtorParam
¶m
) :
32 CInterfaceGroup(param
)
36 CRootGroup::~CRootGroup()
40 CInterfaceElement
* CRootGroup::getElement (const std::string
&id
)
45 if (id
.substr(0, _Id
.size()) != _Id
)
48 std::vector
<CViewBase
*>::const_iterator itv
;
49 for (itv
= _Views
.begin(); itv
!= _Views
.end(); itv
++)
51 CViewBase
*pVB
= *itv
;
52 if (pVB
->getId() == id
)
56 std::vector
<CCtrlBase
*>::const_iterator itc
;
57 for (itc
= _Controls
.begin(); itc
!= _Controls
.end(); itc
++)
59 CCtrlBase
* ctrl
= *itc
;
60 if (ctrl
->getId() == id
)
65 std::string sTmp
= id
;
66 sTmp
= sTmp
.substr(_Id
.size()+1,sTmp
.size());
67 std::string::size_type pos
= sTmp
.find(':');
68 if (pos
!= std::string::npos
)
69 sTmp
= sTmp
.substr(0,pos
);
71 std::map
<std::string
,CInterfaceGroup
*>::iterator it
= _Accel
.find(sTmp
);
72 if (it
!= _Accel
.end())
74 CInterfaceGroup
*pIG
= it
->second
;
75 return pIG
->getElement(id
);
80 void CRootGroup::addGroup (CInterfaceGroup
*child
, sint eltOrder
)
82 std::string sTmp
= child
->getId();
83 sTmp
= sTmp
.substr(_Id
.size()+1,sTmp
.size());
84 _Accel
.insert(std::pair
<std::string
,CInterfaceGroup
*>(sTmp
, child
));
85 CInterfaceGroup::addGroup(child
,eltOrder
);
88 bool CRootGroup::delGroup (CInterfaceGroup
*child
, bool dontDelete
)
90 std::string sTmp
= child
->getId();
91 sTmp
= sTmp
.substr(_Id
.size()+1,sTmp
.size());
92 std::map
<std::string
,CInterfaceGroup
*>::iterator it
= _Accel
.find(sTmp
);
93 if (it
!= _Accel
.end())
97 return CInterfaceGroup::delGroup(child
,dontDelete
);