From 3c73de81a3b92546154752a9f208cecf6f4743f1 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 6 Jun 2012 22:31:47 +0200 Subject: [PATCH] CHANGED: #1471 CInterfaceElement no longer depends on CGroupContainer. --HG-- branch : gui-refactoring --- code/ryzom/client/src/interface_v3/chat_window.cpp | 8 ++++---- code/ryzom/client/src/interface_v3/group_map.cpp | 2 +- code/ryzom/client/src/interface_v3/interface_element.cpp | 9 +++++---- code/ryzom/client/src/interface_v3/interface_element.h | 7 +------ code/ryzom/client/src/r2/tool.cpp | 5 +++-- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 3351e59ff..62548652e 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -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); } } } diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index f6653d8ab..13588c436 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -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"); diff --git a/code/ryzom/client/src/interface_v3/interface_element.cpp b/code/ryzom/client/src/interface_v3/interface_element.cpp index b0145363e..a66b5881b 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.cpp +++ b/code/ryzom/client/src/interface_v3/interface_element.cpp @@ -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(parent); - if (gc) return gc; + CInterfaceGroup *gc = dynamic_cast< CInterfaceGroup* >( parent ); + if( ( gc != NULL ) && gc->isGroupContainer() ) + return gc; + parent = parent->getParent(); } return NULL; diff --git a/code/ryzom/client/src/interface_v3/interface_element.h b/code/ryzom/client/src/interface_v3/interface_element.h index 72663f09a..49c584462 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.h +++ b/code/ryzom/client/src/interface_v3/interface_element.h @@ -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; } diff --git a/code/ryzom/client/src/r2/tool.cpp b/code/ryzom/client/src/r2/tool.cpp index fd42ca4ef..23706d9f2 100644 --- a/code/ryzom/client/src/r2/tool.cpp +++ b/code/ryzom/client/src/r2/tool.cpp @@ -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; }