CHANGED: #1471 CInterfaceElement no longer depends on CGroupContainer.

This commit is contained in:
dfighter1985 2012-06-06 22:31:47 +02:00
parent 2488cf5c15
commit f807707bb6
5 changed files with 14 additions and 17 deletions

View file

@ -1340,9 +1340,9 @@ static ucstring getFreeTellerName(CInterfaceElement *pCaller)
if (!pCaller) return ucstring(); if (!pCaller) return ucstring();
CChatGroupWindow *cgw = PeopleInterraction.getChatGroupWindow(); CChatGroupWindow *cgw = PeopleInterraction.getChatGroupWindow();
if (!cgw) return ucstring(); if (!cgw) return ucstring();
CGroupContainer *freeTeller = pCaller->getParentContainer(); CInterfaceGroup *freeTeller = pCaller->getParentContainer();
if (!freeTeller) return ucstring(); if (!freeTeller) return ucstring();
return cgw->getFreeTellerName(freeTeller->getId()); return cgw->getFreeTellerName( freeTeller->getId() );
} }
// *************************************************************************************** // ***************************************************************************************
@ -1394,10 +1394,10 @@ public:
} }
if (pCaller) if (pCaller)
{ {
CGroupContainer *win = prevCaller->getParentContainer(); CInterfaceGroup *win = prevCaller->getParentContainer();
if (win) if (win)
{ {
win->setActive(false); static_cast< CGroupContainer* >( win )->setActive(false);
} }
} }
} }

View file

@ -2165,7 +2165,7 @@ void CGroupMap::setMap(SMap *map)
_MapMaterial.setTexture(1, NULL); _MapMaterial.setTexture(1, NULL);
// disable the map_back button for islands (islands can't be seen on the world map) // disable the map_back button for islands (islands can't be seen on the world map)
CGroupContainer *gc = getParentContainer(); CInterfaceGroup *gc = getParentContainer();
if (gc) if (gc)
{ {
CCtrlBase *mapBack = gc->getCtrl("map_back"); CCtrlBase *mapBack = gc->getCtrl("map_back");

View file

@ -19,7 +19,6 @@
#include "nel/gui/view_renderer.h" #include "nel/gui/view_renderer.h"
#include "widget_manager.h" #include "widget_manager.h"
#include "nel/gui/db_manager.h" #include "nel/gui/db_manager.h"
#include "group_container.h"
#include "interface_link.h" #include "interface_link.h"
#include "nel/misc/xml_auto_ptr.h" #include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
@ -852,13 +851,15 @@ CInterfaceElement* CInterfaceElement::getMasterGroup() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CGroupContainer *CInterfaceElement::getParentContainer() CInterfaceGroup* CInterfaceElement::getParentContainer()
{ {
CInterfaceElement *parent = this; CInterfaceElement *parent = this;
while (parent) while (parent)
{ {
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(parent); CInterfaceGroup *gc = dynamic_cast< CInterfaceGroup* >( parent );
if (gc) return gc; if( ( gc != NULL ) && gc->isGroupContainer() )
return gc;
parent = parent->getParent(); parent = parent->getParent();
} }
return NULL; return NULL;

View file

@ -28,11 +28,6 @@
using namespace NLGUI; using namespace NLGUI;
// ----------------------------------------------------------------------------
class CInterfaceGroup;
// ----------------------------------------------------------------------------
class CInterfaceLink; class CInterfaceLink;
class CInterfaceElement; class CInterfaceElement;
class CInterfaceGroup; class CInterfaceGroup;
@ -147,7 +142,7 @@ public:
CInterfaceElement* getMasterGroup() const; CInterfaceElement* getMasterGroup() const;
// get a possible group container // get a possible group container
CGroupContainer *getParentContainer(); CInterfaceGroup* getParentContainer();
bool getActive() const { return _Active; } bool getActive() const { return _Active; }

View file

@ -225,8 +225,9 @@ CGroupContainer *CTool::isMouseOnContainer()
if (groupsUnder.empty()) return NULL; if (groupsUnder.empty()) return NULL;
for(uint k = 0; k < groupsUnder.size(); ++k) for(uint k = 0; k < groupsUnder.size(); ++k)
{ {
CGroupContainer *gc = groupsUnder[k]->getParentContainer(); CInterfaceGroup* gc = groupsUnder[k]->getParentContainer();
if (gc) return gc; if (gc)
return static_cast< CGroupContainer* >( gc );
} }
return NULL; return NULL;
} }