CHANGED: #1471 CWidgetManager no longer depends on CGroupContainer, instead of depends on a new class CGroupContainerBase.

This commit is contained in:
dfighter1985 2012-06-08 03:45:43 +02:00
parent be382b36be
commit 1faca7efad
10 changed files with 109 additions and 18 deletions

View file

@ -27,6 +27,7 @@
// *************************************************************************** // ***************************************************************************
class CCtrlBaseButton; class CCtrlBaseButton;
class CCtrlScroll; class CCtrlScroll;
class CGroupContainer;
// *************************************************************************** // ***************************************************************************
/** /**

View file

@ -33,6 +33,7 @@ class CCtrlButton;
class CCtrlScroll; class CCtrlScroll;
class CHandlerListSheetTradeSelect; class CHandlerListSheetTradeSelect;
class CHandlerListSheetTradeRightClick; class CHandlerListSheetTradeRightClick;
class CGroupContainer;
// *************************************************************************** // ***************************************************************************
/** /**

View file

@ -1195,7 +1195,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CGroupContainer, std::string, "container");
// *************************************************************************** // ***************************************************************************
CGroupContainer::CGroupContainer(const TCtorParam &param) CGroupContainer::CGroupContainer(const TCtorParam &param)
: CInterfaceGroup(param) : CGroupContainerBase(param)
{ {
// faster than a virual call // faster than a virual call
_IsGroupContainer = true; _IsGroupContainer = true;

View file

@ -20,12 +20,14 @@
#define RZ_GROUP_CONTAINER_H #define RZ_GROUP_CONTAINER_H
#include "interface_group.h" #include "interface_group.h"
#include "group_container_base.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
namespace NLGUI namespace NLGUI
{ {
class CEventDescriptorLocalised; class CEventDescriptorLocalised;
} }
class CInterfaceList; class CInterfaceList;
class CCtrlButton; class CCtrlButton;
class CCtrlScroll; class CCtrlScroll;
@ -152,7 +154,7 @@ private:
* \author Nevrax France * \author Nevrax France
* \date 2002 * \date 2002
*/ */
class CGroupContainer : public CInterfaceGroup class CGroupContainer : public CGroupContainerBase
{ {
public: public:
enum { NumResizers = 8 }; enum { NumResizers = 8 };
@ -267,7 +269,7 @@ public:
int luaBlink(CLuaState &ls); int luaBlink(CLuaState &ls);
int luaSetHeaderColor(CLuaState &ls); int luaSetHeaderColor(CLuaState &ls);
REFLECT_EXPORT_START(CGroupContainer, CInterfaceGroup) REFLECT_EXPORT_START(CGroupContainer, CGroupContainerBase)
REFLECT_LUA_METHOD("blink", luaBlink); REFLECT_LUA_METHOD("blink", luaBlink);
REFLECT_LUA_METHOD("setHeaderColor", luaSetHeaderColor); REFLECT_LUA_METHOD("setHeaderColor", luaSetHeaderColor);
REFLECT_STRING("title", getTitle, setTitle); REFLECT_STRING("title", getTitle, setTitle);

View file

@ -0,0 +1,43 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include "group_container_base.h"
CGroupContainerBase::CGroupContainerBase( const CViewBase::TCtorParam &param ) :
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 );
}

View file

@ -0,0 +1,42 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#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 &param );
virtual ~CGroupContainerBase();
virtual void removeAllContainers();
virtual void setLocked( bool locked );
REFLECT_EXPORT_START( CGroupContainerBase, CInterfaceGroup )
REFLECT_EXPORT_END
protected:
private:
};
#endif

View file

@ -33,7 +33,6 @@ class CInterfaceElement;
class CInterfaceGroup; class CInterfaceGroup;
class CViewBase; class CViewBase;
class CCtrlBase; class CCtrlBase;
class CGroupContainer;
class IActionHandler; class IActionHandler;
/** /**

View file

@ -28,6 +28,7 @@
#include "ctrl_base.h" #include "ctrl_base.h"
#include "interface_group.h" #include "interface_group.h"
#include "group_frame.h" #include "group_frame.h"
#include "group_container_base.h"
#include "group_container.h" #include "group_container.h"
#include "group_list.h" #include "group_list.h"
#include "dbgroup_select_number.h" #include "dbgroup_select_number.h"
@ -82,7 +83,8 @@ void registerInterfaceElements()
REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase); REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase);
REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup);
REGISTER_REFLECTABLE_CLASS(CGroupModal, CGroupFrame); 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(CDBGroupSelectNumber, CInterfaceGroup);
REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup);
REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup);

View file

@ -14,19 +14,18 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#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/db_manager.h"
#include "nel/gui/view_renderer.h" #include "nel/gui/view_renderer.h"
#include "widget_manager.h"
#include "view_pointer_base.h" #include "view_pointer_base.h"
#include "group_editbox_base.h"
#include "ctrl_draggable.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" #include "interface_options.h"
CWidgetManager* CWidgetManager::instance = NULL; CWidgetManager* CWidgetManager::instance = NULL;
std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal"; std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal";
IParser* CWidgetManager::parser = NULL; IParser* CWidgetManager::parser = NULL;
@ -155,7 +154,7 @@ void CWidgetManager::SMasterGroup::setBackWindow(CInterfaceGroup *pIG)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CWidgetManager::SMasterGroup::deactiveAllContainers() void CWidgetManager::SMasterGroup::deactiveAllContainers()
{ {
std::vector<CGroupContainer*> gcs; std::vector<CGroupContainerBase*> gcs;
// Make first a list of all window (Warning: all group container are not window!) // Make first a list of all window (Warning: all group container are not window!)
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i) for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
@ -163,7 +162,7 @@ void CWidgetManager::SMasterGroup::deactiveAllContainers()
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin(); std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
while (it != PrioritizedWindows[i].end()) while (it != PrioritizedWindows[i].end())
{ {
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(*it); CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
if (pGC != NULL) if (pGC != NULL)
gcs.push_back(pGC); gcs.push_back(pGC);
it++; it++;
@ -186,7 +185,7 @@ void CWidgetManager::SMasterGroup::centerAllContainers()
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin(); std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
while (it != PrioritizedWindows[i].end()) while (it != PrioritizedWindows[i].end())
{ {
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(*it); CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
if ((pGC != NULL) && (pGC->getParent() != NULL)) if ((pGC != NULL) && (pGC->getParent() != NULL))
{ {
sint32 wParent = pGC->getParent()->getW(false); sint32 wParent = pGC->getParent()->getW(false);
@ -210,7 +209,7 @@ void CWidgetManager::SMasterGroup::unlockAllContainers()
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin(); std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
while (it != PrioritizedWindows[i].end()) while (it != PrioritizedWindows[i].end())
{ {
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(*it); CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
if (pGC != NULL) if (pGC != NULL)
pGC->setLocked(false); pGC->setLocked(false);
@ -338,7 +337,7 @@ void unlinkAllContainers (CInterfaceGroup *pIG)
for(uint i = 0; i < rG.size(); ++i) for(uint i = 0; i < rG.size(); ++i)
unlinkAllContainers (rG[i]); unlinkAllContainers (rG[i]);
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIG); CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(pIG);
if (pGC != NULL) if (pGC != NULL)
pGC->removeAllContainers(); pGC->removeAllContainers();
} }

View file

@ -26,6 +26,8 @@
// //
class CInterfaceManager; class CInterfaceManager;
class CGroupContainer;
namespace NLGUI namespace NLGUI
{ {
class CEventDescriptor; class CEventDescriptor;