From 3a9955178412cb0595d49869882fa13df92d46d5 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 8 Jun 2012 03:45:43 +0200 Subject: [PATCH] CHANGED: #1471 CWidgetManager no longer depends on CGroupContainer, instead of depends on a new class CGroupContainerBase. --- .../src/interface_v3/dbgroup_list_sheet.h | 1 + .../interface_v3/dbgroup_list_sheet_text.h | 1 + .../src/interface_v3/group_container.cpp | 2 +- .../client/src/interface_v3/group_container.h | 8 ++-- .../src/interface_v3/group_container_base.cpp | 43 +++++++++++++++++++ .../src/interface_v3/group_container_base.h | 42 ++++++++++++++++++ .../src/interface_v3/interface_element.h | 1 - .../register_interface_elements.cpp | 4 +- .../src/interface_v3/widget_manager.cpp | 23 +++++----- code/ryzom/client/src/r2/tool.h | 2 + 10 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 code/ryzom/client/src/interface_v3/group_container_base.cpp create mode 100644 code/ryzom/client/src/interface_v3/group_container_base.h diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h index 2af0ef02a..171152cfc 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.h @@ -27,6 +27,7 @@ // *************************************************************************** class CCtrlBaseButton; class CCtrlScroll; +class CGroupContainer; // *************************************************************************** /** diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h index bf6d6be67..ef1a00f9d 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.h @@ -33,6 +33,7 @@ class CCtrlButton; class CCtrlScroll; class CHandlerListSheetTradeSelect; class CHandlerListSheetTradeRightClick; +class CGroupContainer; // *************************************************************************** /** diff --git a/code/ryzom/client/src/interface_v3/group_container.cpp b/code/ryzom/client/src/interface_v3/group_container.cpp index f091df1e6..da843ae0c 100644 --- a/code/ryzom/client/src/interface_v3/group_container.cpp +++ b/code/ryzom/client/src/interface_v3/group_container.cpp @@ -1195,7 +1195,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CGroupContainer, std::string, "container"); // *************************************************************************** CGroupContainer::CGroupContainer(const TCtorParam ¶m) -: CInterfaceGroup(param) +: CGroupContainerBase(param) { // faster than a virual call _IsGroupContainer = true; diff --git a/code/ryzom/client/src/interface_v3/group_container.h b/code/ryzom/client/src/interface_v3/group_container.h index 94b00f9f3..48be495de 100644 --- a/code/ryzom/client/src/interface_v3/group_container.h +++ b/code/ryzom/client/src/interface_v3/group_container.h @@ -20,12 +20,14 @@ #define RZ_GROUP_CONTAINER_H #include "interface_group.h" +#include "group_container_base.h" #include "nel/misc/smart_ptr.h" namespace NLGUI { -class CEventDescriptorLocalised; + class CEventDescriptorLocalised; } + class CInterfaceList; class CCtrlButton; class CCtrlScroll; @@ -152,7 +154,7 @@ private: * \author Nevrax France * \date 2002 */ -class CGroupContainer : public CInterfaceGroup +class CGroupContainer : public CGroupContainerBase { public: enum { NumResizers = 8 }; @@ -267,7 +269,7 @@ public: int luaBlink(CLuaState &ls); int luaSetHeaderColor(CLuaState &ls); - REFLECT_EXPORT_START(CGroupContainer, CInterfaceGroup) + REFLECT_EXPORT_START(CGroupContainer, CGroupContainerBase) REFLECT_LUA_METHOD("blink", luaBlink); REFLECT_LUA_METHOD("setHeaderColor", luaSetHeaderColor); REFLECT_STRING("title", getTitle, setTitle); diff --git a/code/ryzom/client/src/interface_v3/group_container_base.cpp b/code/ryzom/client/src/interface_v3/group_container_base.cpp new file mode 100644 index 000000000..71deb661f --- /dev/null +++ b/code/ryzom/client/src/interface_v3/group_container_base.cpp @@ -0,0 +1,43 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "group_container_base.h" + +CGroupContainerBase::CGroupContainerBase( const CViewBase::TCtorParam ¶m ) : +CInterfaceGroup( param ) +{ +} + +CGroupContainerBase::~CGroupContainerBase() +{ +} + +void CGroupContainerBase::removeAllContainers() +{ + // Necessary because it's supposed to be an abstract class, + // however reflection requires the class to be instantiated. + nlassert( false ); +} + +void CGroupContainerBase::setLocked( bool locked ) +{ + // Necessary because it's supposed to be an abstract class, + // however reflection requires the class to be instantiated. + nlassert( false ); +} + + diff --git a/code/ryzom/client/src/interface_v3/group_container_base.h b/code/ryzom/client/src/interface_v3/group_container_base.h new file mode 100644 index 000000000..316e83cf9 --- /dev/null +++ b/code/ryzom/client/src/interface_v3/group_container_base.h @@ -0,0 +1,42 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef GROUP_CONTAINER_BASE_H +#define GROUP_CONTAINER_BASE_H + +#include "interface_group.h" + +class CGroupContainerBase : public CInterfaceGroup +{ +public: + DECLARE_UI_CLASS( CGroupContainerBase ) + CGroupContainerBase( const TCtorParam ¶m ); + virtual ~CGroupContainerBase(); + + virtual void removeAllContainers(); + virtual void setLocked( bool locked ); + + REFLECT_EXPORT_START( CGroupContainerBase, CInterfaceGroup ) + REFLECT_EXPORT_END + +protected: + +private: + +}; + +#endif diff --git a/code/ryzom/client/src/interface_v3/interface_element.h b/code/ryzom/client/src/interface_v3/interface_element.h index 49c584462..7c7706ba7 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.h +++ b/code/ryzom/client/src/interface_v3/interface_element.h @@ -33,7 +33,6 @@ class CInterfaceElement; class CInterfaceGroup; class CViewBase; class CCtrlBase; -class CGroupContainer; class IActionHandler; /** diff --git a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp index df6c77974..227540244 100644 --- a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp +++ b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp @@ -28,6 +28,7 @@ #include "ctrl_base.h" #include "interface_group.h" #include "group_frame.h" +#include "group_container_base.h" #include "group_container.h" #include "group_list.h" #include "dbgroup_select_number.h" @@ -82,7 +83,8 @@ void registerInterfaceElements() REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase); REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(CGroupModal, CGroupFrame); - REGISTER_REFLECTABLE_CLASS(CGroupContainer, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupContainerBase, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupContainer, CGroupContainerBase); REGISTER_REFLECTABLE_CLASS(CDBGroupSelectNumber, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup); diff --git a/code/ryzom/client/src/interface_v3/widget_manager.cpp b/code/ryzom/client/src/interface_v3/widget_manager.cpp index 47b1166ff..c3ec5bc4e 100644 --- a/code/ryzom/client/src/interface_v3/widget_manager.cpp +++ b/code/ryzom/client/src/interface_v3/widget_manager.cpp @@ -14,19 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "widget_manager.h" -#include "interface_group.h" -#include "group_modal.h" - -#include "group_container.h" - #include "nel/gui/db_manager.h" #include "nel/gui/view_renderer.h" +#include "widget_manager.h" #include "view_pointer_base.h" -#include "group_editbox_base.h" #include "ctrl_draggable.h" +#include "interface_group.h" +#include "group_container_base.h" +#include "group_modal.h" +#include "group_editbox_base.h" #include "interface_options.h" + CWidgetManager* CWidgetManager::instance = NULL; std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal"; IParser* CWidgetManager::parser = NULL; @@ -155,7 +154,7 @@ void CWidgetManager::SMasterGroup::setBackWindow(CInterfaceGroup *pIG) // ---------------------------------------------------------------------------- void CWidgetManager::SMasterGroup::deactiveAllContainers() { - std::vector gcs; + std::vector gcs; // Make first a list of all window (Warning: all group container are not window!) for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i) @@ -163,7 +162,7 @@ void CWidgetManager::SMasterGroup::deactiveAllContainers() std::list::iterator it = PrioritizedWindows[i].begin(); while (it != PrioritizedWindows[i].end()) { - CGroupContainer *pGC = dynamic_cast(*it); + CGroupContainerBase *pGC = dynamic_cast(*it); if (pGC != NULL) gcs.push_back(pGC); it++; @@ -186,7 +185,7 @@ void CWidgetManager::SMasterGroup::centerAllContainers() std::list::iterator it = PrioritizedWindows[i].begin(); while (it != PrioritizedWindows[i].end()) { - CGroupContainer *pGC = dynamic_cast(*it); + CGroupContainerBase *pGC = dynamic_cast(*it); if ((pGC != NULL) && (pGC->getParent() != NULL)) { sint32 wParent = pGC->getParent()->getW(false); @@ -210,7 +209,7 @@ void CWidgetManager::SMasterGroup::unlockAllContainers() std::list::iterator it = PrioritizedWindows[i].begin(); while (it != PrioritizedWindows[i].end()) { - CGroupContainer *pGC = dynamic_cast(*it); + CGroupContainerBase *pGC = dynamic_cast(*it); if (pGC != NULL) pGC->setLocked(false); @@ -338,7 +337,7 @@ void unlinkAllContainers (CInterfaceGroup *pIG) for(uint i = 0; i < rG.size(); ++i) unlinkAllContainers (rG[i]); - CGroupContainer *pGC = dynamic_cast(pIG); + CGroupContainerBase *pGC = dynamic_cast(pIG); if (pGC != NULL) pGC->removeAllContainers(); } diff --git a/code/ryzom/client/src/r2/tool.h b/code/ryzom/client/src/r2/tool.h index e10e5002e..1152687bb 100644 --- a/code/ryzom/client/src/r2/tool.h +++ b/code/ryzom/client/src/r2/tool.h @@ -26,6 +26,8 @@ // class CInterfaceManager; +class CGroupContainer; + namespace NLGUI { class CEventDescriptor;