Merge branch '138-toggle-free-look-with-hotkey' into 'main/atys-live'
[ryzomcore.git] / nel / src / gui / view_base.cpp
blobc4270fc7b44cf32a452729593e564a7dc029f6c6
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013-2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 //
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 "stdpch.h"
22 #include "nel/gui/view_base.h"
23 #include "nel/gui/interface_group.h"
24 #include "nel/gui/widget_manager.h"
26 #ifdef DEBUG_NEW
27 #define new DEBUG_NEW
28 #endif
30 namespace NLGUI
33 CViewBase::~CViewBase()
35 CWidgetManager::getInstance()->removeRefOnView (this);
38 // ***************************************************************************
39 void CViewBase::dumpSize(uint depth /*=0*/) const
41 std::string result;
42 result.resize(depth * 4, ' ');
43 std::string::size_type pos = _Id.find_last_of(':');
44 std::string shortID = pos == std::string::npos ? _Id : _Id.substr(pos);
45 result += NLMISC::toString("id=%s, w=%d, h=%d, x=%d, y=%d, wreal=%d, hreal=%d, xreal=%d, yreal=%d", shortID.c_str(), (int) _W, (int) _H, (int) _X, (int) _Y, (int) _WReal, (int) _HReal, (int) _XReal, (int) _YReal);
46 nlinfo(result.c_str());
49 // ***************************************************************************
50 void CViewBase::visit(CInterfaceElementVisitor *visitor)
52 nlassert(visitor);
53 visitor->visitView(this);
54 CInterfaceElement::visit(visitor);
58 bool CViewBase::handleEvent( const NLGUI::CEventDescriptor &evnt )
60 if( evnt.getType() == NLGUI::CEventDescriptor::mouse )
62 const NLGUI::CEventDescriptorMouse &eventDesc = ( const NLGUI::CEventDescriptorMouse& )evnt;
63 if( eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown )
65 if( editorMode )
67 CWidgetManager::getInstance()->selectWidget( getId() );
68 return true;
72 return false;