mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
CHANGED: #1471 CInterfaceGroup no longer depends on CCtrlScroll. Instead if depends on a new CCtrlScrollBase class.
--HG-- branch : gui-refactoring
This commit is contained in:
parent
3c73de81a3
commit
2e9779a591
7 changed files with 140 additions and 18 deletions
|
@ -6,6 +6,8 @@
|
|||
class CCtrlDraggable : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlDraggable )
|
||||
|
||||
CCtrlDraggable( const TCtorParam ¶m );
|
||||
virtual ~CCtrlDraggable(){};
|
||||
|
||||
|
@ -21,6 +23,8 @@ public:
|
|||
_LastDraggedSheet = NULL;
|
||||
}
|
||||
|
||||
// Necessary because of reflection, no other purpose
|
||||
void draw(){}
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlDraggable, CCtrlBase)
|
||||
REFLECT_BOOL("dragable", isDraggable, setDraggable);
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/*
|
||||
#include "stdpch.h"*/
|
||||
#include "interface_manager.h"
|
||||
#include "widget_manager.h"
|
||||
#include "ctrl_scroll.h"
|
||||
|
@ -33,7 +31,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CCtrlScroll, std::string, "scroll");
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
CCtrlScroll::CCtrlScroll(const TCtorParam ¶m)
|
||||
: CCtrlBase(param)
|
||||
: CCtrlScrollBase(param)
|
||||
{
|
||||
_Vertical = true;
|
||||
_Aligned = 1;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#define RZ_CTRL_SCROLL_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "ctrl_base.h"
|
||||
#include "ctrl_scroll_base.h"
|
||||
|
||||
/**
|
||||
* Class handling scollbar function
|
||||
|
@ -28,11 +28,11 @@
|
|||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CCtrlScroll : public CCtrlBase, public NLMISC::ICDBNode::IPropertyObserver
|
||||
class CCtrlScroll : public CCtrlScrollBase, public NLMISC::ICDBNode::IPropertyObserver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DECLARE_UI_CLASS( CCtrlScroll )
|
||||
CCtrlScroll(const TCtorParam ¶m);
|
||||
~CCtrlScroll();
|
||||
|
||||
|
@ -43,9 +43,7 @@ public:
|
|||
virtual void draw();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
|
||||
void setTarget (CInterfaceGroup *pIG);
|
||||
CInterfaceGroup *getTarget () { return _Target; }
|
||||
// Return the delta value the track has moved
|
||||
sint32 moveTrackX (sint32 dx);
|
||||
sint32 moveTrackY (sint32 dy);
|
||||
|
@ -97,7 +95,7 @@ public:
|
|||
void setMax(sint32 max) {_Max = max;}
|
||||
sint32 getMax() const {return _Max;}
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlScroll, CCtrlBase)
|
||||
REFLECT_EXPORT_START(CCtrlScroll, CCtrlScrollBase)
|
||||
REFLECT_LUA_METHOD("setTarget", luaSetTarget)
|
||||
REFLECT_LUA_METHOD("ensureVisible", luaEnsureVisible);
|
||||
REFLECT_SINT32("value", getValue, setValue);
|
||||
|
@ -159,8 +157,6 @@ protected:
|
|||
sint32 _LastTargetMaxWReal;
|
||||
sint32 _LastTargetOfsX;
|
||||
|
||||
CInterfaceGroup *_Target; // If NULL the scroller is a value scroller
|
||||
|
||||
bool _Vertical : 1; // true if vertical track bar
|
||||
bool _IsDBLink : 1;
|
||||
bool _ObserverOn : 1;
|
||||
|
|
66
code/ryzom/client/src/interface_v3/ctrl_scroll_base.cpp
Normal file
66
code/ryzom/client/src/interface_v3/ctrl_scroll_base.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
// 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 "ctrl_scroll_base.h"
|
||||
|
||||
CCtrlScrollBase::CCtrlScrollBase( const TCtorParam ¶m ) :
|
||||
CCtrlBase( param )
|
||||
{
|
||||
_Target = NULL;
|
||||
}
|
||||
|
||||
CCtrlScrollBase::~CCtrlScrollBase()
|
||||
{
|
||||
}
|
||||
|
||||
void CCtrlScrollBase::setTarget( CInterfaceGroup *pIG )
|
||||
{
|
||||
// Necessary because it's supposed to be an abstract class,
|
||||
// however reflection requires the class to be instantiated.
|
||||
nlassert( false );
|
||||
}
|
||||
|
||||
sint32 CCtrlScrollBase::moveTrackX( sint32 dx )
|
||||
{
|
||||
// Necessary because it's supposed to be an abstract class,
|
||||
// however reflection requires the class to be instantiated.
|
||||
nlassert( false );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 CCtrlScrollBase::moveTrackY( sint32 dy )
|
||||
{
|
||||
// Necessary because it's supposed to be an abstract class,
|
||||
// however reflection requires the class to be instantiated.
|
||||
nlassert( false );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCtrlScrollBase::moveTargetX( sint32 dx )
|
||||
{
|
||||
// Necessary because it's supposed to be an abstract class,
|
||||
// however reflection requires the class to be instantiated.
|
||||
nlassert( false );
|
||||
}
|
||||
|
||||
void CCtrlScrollBase::moveTargetY( sint32 dy )
|
||||
{
|
||||
// Necessary because it's supposed to be an abstract class,
|
||||
// however reflection requires the class to be instantiated.
|
||||
nlassert( false );
|
||||
}
|
55
code/ryzom/client/src/interface_v3/ctrl_scroll_base.h
Normal file
55
code/ryzom/client/src/interface_v3/ctrl_scroll_base.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
// 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 CTRL_SCROLL_BASE_H
|
||||
#define CTRL_SCROLL_BASE_H
|
||||
|
||||
#include "ctrl_base.h"
|
||||
|
||||
class CInterfaceGroup;
|
||||
|
||||
class CCtrlScrollBase : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlScrollBase )
|
||||
|
||||
CCtrlScrollBase( const TCtorParam ¶m );
|
||||
virtual ~CCtrlScrollBase();
|
||||
|
||||
virtual void setTarget( CInterfaceGroup *pIG );
|
||||
CInterfaceGroup* getTarget(){ return _Target; }
|
||||
virtual sint32 moveTrackX( sint32 dx );
|
||||
virtual sint32 moveTrackY( sint32 dy );
|
||||
|
||||
/** Move the Target Ofs with a Delta, and recompute TrackPos from this Ofs.
|
||||
* Useful for finer controled group scrolling when the list is very big (with mouseWheel or scroll buttons)
|
||||
*/
|
||||
virtual void moveTargetX( sint32 dx );
|
||||
virtual void moveTargetY( sint32 dy );
|
||||
|
||||
|
||||
// Necessary because of reflection, no other purpose
|
||||
void draw(){}
|
||||
|
||||
protected:
|
||||
CInterfaceGroup *_Target; // If NULL the scroller is a value scroller
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
#include "interface_link.h"
|
||||
#include "widget_manager.h"
|
||||
|
||||
#include "ctrl_scroll.h"
|
||||
#include "ctrl_scroll_base.h"
|
||||
#include "group_editbox.h"
|
||||
#include "group_scrolltext.h"
|
||||
#include "lua_ihm_ryzom.h"
|
||||
|
@ -203,7 +203,7 @@ bool CInterfaceGroup::moveSBTrackY (CInterfaceGroup *target, sint32 dy)
|
|||
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
|
||||
{
|
||||
CCtrlBase *pCB = *itc;
|
||||
CCtrlScroll *pSB = dynamic_cast<CCtrlScroll*>(pCB);
|
||||
CCtrlScrollBase *pSB = dynamic_cast<CCtrlScrollBase*>(pCB);
|
||||
if (pSB != NULL)
|
||||
{
|
||||
if (pSB->getTarget() == target)
|
||||
|
@ -224,7 +224,7 @@ bool CInterfaceGroup::moveSBTargetY(CInterfaceGroup *target,sint32 dy)
|
|||
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
|
||||
{
|
||||
CCtrlBase *pCB = *itc;
|
||||
CCtrlScroll *pSB = dynamic_cast<CCtrlScroll*>(pCB);
|
||||
CCtrlScrollBase *pSB = dynamic_cast<CCtrlScrollBase*>(pCB);
|
||||
if (pSB != NULL)
|
||||
{
|
||||
if (pSB->getTarget() == target)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "ctrl_button.h"
|
||||
#include "ctrl_text_button.h"
|
||||
#include "ctrl_col_pick.h"
|
||||
#include "ctrl_draggable.h"
|
||||
#include "dbctrl_sheet.h"
|
||||
#include "dbgroup_list_sheet.h"
|
||||
#include "group_editbox.h"
|
||||
|
@ -42,9 +43,9 @@
|
|||
#include "dbview_bar.h"
|
||||
#include "dbview_bar3.h"
|
||||
#include "group_list.h"
|
||||
#include "ctrl_scroll_base.h"
|
||||
#include "ctrl_scroll.h"
|
||||
#include "dbgroup_combo_box.h"
|
||||
#include "ctrl_scroll.h"
|
||||
#include "group_tab.h"
|
||||
#include "group_html.h"
|
||||
#include "group_header.h"
|
||||
|
@ -75,7 +76,8 @@ void registerInterfaceElements()
|
|||
REGISTER_REFLECTABLE_CLASS(CCtrlButton, CCtrlBaseButton);
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlTextButton, CCtrlBaseButton);
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlColPick, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CDBCtrlSheet, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlDraggable, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CDBCtrlSheet, CCtrlDraggable);
|
||||
REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup);
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupModal, CGroupFrame);
|
||||
|
@ -84,8 +86,9 @@ void registerInterfaceElements()
|
|||
REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup);
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupEditBox, CInterfaceGroup);
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupTree, CInterfaceGroup);
|
||||
REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup)
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlScroll, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup);
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlScrollBase, CCtrlBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CCtrlScroll, CCtrlScrollBase);
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupMenu, CGroupModal)
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupSubMenu, CGroupFrame)
|
||||
REGISTER_REFLECTABLE_CLASS(CGroupTab, CInterfaceGroup)
|
||||
|
|
Loading…
Reference in a new issue