CHANGED: #1471 CInterfaceElement no longer depends on CGroupContainer.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-06-06 22:31:47 +02:00
parent 8437a0319d
commit 3c73de81a3
5 changed files with 14 additions and 17 deletions

View file

@ -1340,9 +1340,9 @@ static ucstring getFreeTellerName(CInterfaceElement *pCaller)
if (!pCaller) return ucstring();
CChatGroupWindow *cgw = PeopleInterraction.getChatGroupWindow();
if (!cgw) return ucstring();
CGroupContainer *freeTeller = pCaller->getParentContainer();
CInterfaceGroup *freeTeller = pCaller->getParentContainer();
if (!freeTeller) return ucstring();
return cgw->getFreeTellerName(freeTeller->getId());
return cgw->getFreeTellerName( freeTeller->getId() );
}
// ***************************************************************************************
@ -1394,10 +1394,10 @@ public:
}
if (pCaller)
{
CGroupContainer *win = prevCaller->getParentContainer();
CInterfaceGroup *win = prevCaller->getParentContainer();
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);
// disable the map_back button for islands (islands can't be seen on the world map)
CGroupContainer *gc = getParentContainer();
CInterfaceGroup *gc = getParentContainer();
if (gc)
{
CCtrlBase *mapBack = gc->getCtrl("map_back");

View file

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

View file

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

View file

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