mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-18 13:21:40 +00:00
CHANGED: #1471 CWidgetManager no longer depends on CViewPointer. Instead it depends on the new class CViewPointerBase.
--HG-- branch : gui-refactoring
This commit is contained in:
parent
3c74576ba9
commit
fbd1d5533c
17 changed files with 207 additions and 172 deletions
|
@ -143,7 +143,7 @@ bool CContextualCursor::context(const std::string &contextName, float dist, cons
|
||||||
CInterfaceManager *IM = CInterfaceManager::getInstance();
|
CInterfaceManager *IM = CInterfaceManager::getInstance();
|
||||||
if(IM)
|
if(IM)
|
||||||
{
|
{
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
if (!functions.isString)
|
if (!functions.isString)
|
||||||
|
|
|
@ -239,7 +239,7 @@ void checkUnderCursor()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor == 0)
|
if(cursor == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ bool InitMouseWithCursor (bool hardware)
|
||||||
{
|
{
|
||||||
Driver->showCursor(true);
|
Driver->showCursor(true);
|
||||||
|
|
||||||
CViewPointer *pointer = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *pointer = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (pointer)
|
if (pointer)
|
||||||
{
|
{
|
||||||
float x = (float)pointer->getX()/(float)Driver->getWindowWidth();
|
float x = (float)pointer->getX()/(float)Driver->getWindowWidth();
|
||||||
|
@ -145,7 +145,7 @@ bool InitMouseWithCursor (bool hardware)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIm = CInterfaceManager::getInstance();
|
CInterfaceManager *pIm = CInterfaceManager::getInstance();
|
||||||
CViewPointer *vp = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *vp = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
Driver->showCursor(false);
|
Driver->showCursor(false);
|
||||||
SetMousePosFirstTime = false;
|
SetMousePosFirstTime = false;
|
||||||
if (vp)
|
if (vp)
|
||||||
|
@ -247,7 +247,7 @@ void SetMouseFreeLook ()
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
CViewPointer *pointer = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *pointer = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (pointer)
|
if (pointer)
|
||||||
pointer->show (false);
|
pointer->show (false);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ void SetMouseCursor (bool updatePos)
|
||||||
if (instance)
|
if (instance)
|
||||||
{
|
{
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (cursor)
|
if (cursor)
|
||||||
{
|
{
|
||||||
sint32 ix, iy;
|
sint32 ix, iy;
|
||||||
|
@ -319,7 +319,7 @@ void SetMouseCursor (bool updatePos)
|
||||||
if (instance)
|
if (instance)
|
||||||
{
|
{
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (cursor)
|
if (cursor)
|
||||||
{
|
{
|
||||||
cursor->setPointerPos(ix, iy);
|
cursor->setPointerPos(ix, iy);
|
||||||
|
@ -342,7 +342,7 @@ void SetMouseCursor (bool updatePos)
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
CViewPointer *pointer = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *pointer = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (pointer)
|
if (pointer)
|
||||||
pointer->show (true);
|
pointer->show (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2194,7 +2194,7 @@ void CGroupContainer::draw ()
|
||||||
|
|
||||||
|
|
||||||
// manage rollover
|
// manage rollover
|
||||||
CViewPointer *mousePointer = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *mousePointer = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if (mousePointer)
|
if (mousePointer)
|
||||||
{
|
{
|
||||||
bool dontFade = false;
|
bool dontFade = false;
|
||||||
|
@ -3641,7 +3641,7 @@ void CGroupContainer::setOpenable(bool openable)
|
||||||
void CGroupContainer::rollOverAlphaUp()
|
void CGroupContainer::rollOverAlphaUp()
|
||||||
{
|
{
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
CViewPointer *vp = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *vp = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
float speed = im->getAlphaRolloverSpeed();
|
float speed = im->getAlphaRolloverSpeed();
|
||||||
if (!isIn(vp->getX(), vp->getY()))
|
if (!isIn(vp->getX(), vp->getY()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -268,7 +268,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
CViewPointer &rIP = *CWidgetManager::getInstance()->getPointer();
|
CViewPointer &rIP = *static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
|
|
||||||
NLGUI::CEventDescriptorMouse eventDesc;
|
NLGUI::CEventDescriptorMouse eventDesc;
|
||||||
|
|
||||||
|
|
|
@ -2481,7 +2481,7 @@ uint CInterfaceManager::getDepth (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentW
|
||||||
bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
{
|
{
|
||||||
bool handled= false;
|
bool handled= false;
|
||||||
CViewPointer *_Pointer = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *_Pointer = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
|
|
||||||
if( event.getType() == NLGUI::CEventDescriptor::system )
|
if( event.getType() == NLGUI::CEventDescriptor::system )
|
||||||
{
|
{
|
||||||
|
|
|
@ -361,7 +361,7 @@ void CViewBitmapCombo::draw()
|
||||||
&& my < py + (sint32) itemh)
|
&& my < py + (sint32) itemh)
|
||||||
{
|
{
|
||||||
overItem = true;
|
overItem = true;
|
||||||
if (CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
|
if ( static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton)
|
||||||
{
|
{
|
||||||
textId = getTexId(_TexsPushedId, texIndex);
|
textId = getTexId(_TexsPushedId, texIndex);
|
||||||
color = getCol(_ColPushed, texIndex);
|
color = getCol(_ColPushed, texIndex);
|
||||||
|
@ -416,7 +416,7 @@ void CViewBitmapCombo::draw()
|
||||||
//
|
//
|
||||||
if (_CD.Unrolled.getBool())
|
if (_CD.Unrolled.getBool())
|
||||||
{
|
{
|
||||||
if (overItem && CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
|
if (overItem && static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton)
|
||||||
{
|
{
|
||||||
textId = getTexId(_TexsId, selectedTexIndex);
|
textId = getTexId(_TexsId, selectedTexIndex);
|
||||||
color = getCol(_Col, selectedTexIndex);
|
color = getCol(_Col, selectedTexIndex);
|
||||||
|
@ -436,7 +436,7 @@ void CViewBitmapCombo::draw()
|
||||||
&& my < py + (sint32) itemh
|
&& my < py + (sint32) itemh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (CWidgetManager::getInstance()->getPointer()->getButtonState() & NLMISC::leftButton)
|
if ( static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() )->getButtonState() & NLMISC::leftButton)
|
||||||
{
|
{
|
||||||
textId = getTexId(_TexsPushedId, selectedTexIndex);
|
textId = getTexId(_TexsPushedId, selectedTexIndex);
|
||||||
color = getCol(_ColPushed, selectedTexIndex);
|
color = getCol(_ColPushed, selectedTexIndex);
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
|
||||||
|
|
||||||
#include "../input.h"
|
#include "../input.h"
|
||||||
//
|
|
||||||
#include "view_pointer.h"
|
#include "view_pointer.h"
|
||||||
#include "interface_manager.h"
|
#include "interface_manager.h"
|
||||||
#include "nel/gui/view_renderer.h"
|
#include "nel/gui/view_renderer.h"
|
||||||
|
@ -45,12 +42,9 @@ NLMISC_REGISTER_OBJECT(CViewBase, CViewPointer, std::string, "pointer");
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
CViewPointer::CViewPointer (const TCtorParam ¶m)
|
CViewPointer::CViewPointer (const TCtorParam ¶m)
|
||||||
: CViewBase(param),
|
: CViewPointerBase(param),
|
||||||
_Buttons(NLMISC::noButton)
|
_Buttons(NLMISC::noButton)
|
||||||
{
|
{
|
||||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
|
||||||
_PointerDown = false;
|
|
||||||
_PointerVisible = true;
|
|
||||||
_TxIdDefault = -2;
|
_TxIdDefault = -2;
|
||||||
_TxIdMoveWindow = -2;
|
_TxIdMoveWindow = -2;
|
||||||
_TxIdResizeBRTL = -2;
|
_TxIdResizeBRTL = -2;
|
||||||
|
@ -608,111 +602,6 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
||||||
|
|
||||||
// +++ SET +++
|
// +++ SET +++
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::setPointerPos (sint32 x, sint32 y)
|
|
||||||
{
|
|
||||||
if (_PointerDown)
|
|
||||||
{
|
|
||||||
if (!_PointerDrag)
|
|
||||||
{
|
|
||||||
if (((_PointerX - _PointerDownX) != 0) ||
|
|
||||||
((_PointerY - _PointerDownY) != 0))
|
|
||||||
{
|
|
||||||
_PointerDrag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_PointerOldX = getX();
|
|
||||||
_PointerOldY = getY();
|
|
||||||
|
|
||||||
_PointerX = x;
|
|
||||||
_PointerY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::setPointerDispPos (sint32 x, sint32 y)
|
|
||||||
{
|
|
||||||
setX (x);
|
|
||||||
setY (y);
|
|
||||||
updateCoords ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::resetPointerPos ()
|
|
||||||
{
|
|
||||||
_PointerOldX = _PointerX;
|
|
||||||
_PointerOldY = _PointerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::setPointerDown (bool pd)
|
|
||||||
{
|
|
||||||
_PointerDown = pd;
|
|
||||||
|
|
||||||
if (_PointerDown == true)
|
|
||||||
{
|
|
||||||
_PointerDownX = _PointerX;
|
|
||||||
_PointerDownY = _PointerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_PointerDown == false)
|
|
||||||
_PointerDrag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::setPointerDownString (const std::string &s)
|
|
||||||
{
|
|
||||||
_PointerDownString = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// +++ GET +++
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::getPointerPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerX;
|
|
||||||
y = _PointerY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::getPointerDispPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = getX();
|
|
||||||
y = getY();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::getPointerOldPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerOldX;
|
|
||||||
y = _PointerOldY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CViewPointer::getPointerDownPos (sint32 &x, sint32 &y)
|
|
||||||
{
|
|
||||||
x = _PointerDownX;
|
|
||||||
y = _PointerDownY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::getPointerDown ()
|
|
||||||
{
|
|
||||||
return _PointerDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::getPointerDrag ()
|
|
||||||
{
|
|
||||||
return _PointerDrag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
std::string CViewPointer::getPointerDownString ()
|
|
||||||
{
|
|
||||||
return _PointerDownString;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
void CViewPointer::setStringMode (bool stringCursor)
|
void CViewPointer::setStringMode (bool stringCursor)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/misc/events.h"
|
#include "nel/misc/events.h"
|
||||||
#include "view_base.h"
|
#include "view_pointer_base.h"
|
||||||
|
|
||||||
class CGroupContainer;
|
class CGroupContainer;
|
||||||
class CCtrlBase;
|
class CCtrlBase;
|
||||||
|
@ -33,35 +33,16 @@ class CCtrlBase;
|
||||||
* \date 2002
|
* \date 2002
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CViewPointer : public CViewBase
|
class CViewPointer : public CViewPointerBase
|
||||||
{
|
{
|
||||||
friend void SetMouseFreeLook ();
|
friend void SetMouseFreeLook ();
|
||||||
friend void SetMouseCursor (bool updateMousePos);
|
friend void SetMouseCursor (bool updateMousePos);
|
||||||
public:
|
public:
|
||||||
|
DECLARE_UI_CLASS( CViewPointerBase )
|
||||||
CViewPointer (const TCtorParam ¶m);
|
CViewPointer (const TCtorParam ¶m);
|
||||||
bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||||
void draw ();
|
void draw ();
|
||||||
|
|
||||||
// Set the pointer position.
|
|
||||||
void setPointerPos (sint32 x, sint32 y);
|
|
||||||
void setPointerDispPos (sint32 x, sint32 y);
|
|
||||||
|
|
||||||
void resetPointerPos ();
|
|
||||||
void setPointerDown (bool pd);
|
|
||||||
void setPointerDownString (const std::string &s);
|
|
||||||
|
|
||||||
void getPointerPos (sint32 &x, sint32 &y);
|
|
||||||
void getPointerDispPos (sint32 &x, sint32 &y);
|
|
||||||
|
|
||||||
void getPointerOldPos (sint32 &x, sint32 &y);
|
|
||||||
void getPointerDownPos (sint32 &x, sint32 &y);
|
|
||||||
bool getPointerDown ();
|
|
||||||
std::string getPointerDownString ();
|
|
||||||
bool getPointerDrag ();
|
|
||||||
|
|
||||||
/// Is the pointer visible ?
|
|
||||||
bool show() const {return _PointerVisible;}
|
|
||||||
|
|
||||||
// Set cursor mode
|
// Set cursor mode
|
||||||
void setStringMode (bool stringCursor);
|
void setStringMode (bool stringCursor);
|
||||||
bool getStringMode() const {return _StringMode;}
|
bool getStringMode() const {return _StringMode;}
|
||||||
|
@ -135,18 +116,6 @@ private:
|
||||||
sint32 _OffsetX;
|
sint32 _OffsetX;
|
||||||
sint32 _OffsetY;
|
sint32 _OffsetY;
|
||||||
|
|
||||||
// (x,y) is from the TopLeft corner of the window
|
|
||||||
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
|
||||||
sint32 _PointerY;
|
|
||||||
sint32 _PointerOldX; // Previous frame pointer position
|
|
||||||
sint32 _PointerOldY;
|
|
||||||
bool _PointerDown; // Is the pointer down ?
|
|
||||||
sint32 _PointerDownX; // Pointer down position
|
|
||||||
sint32 _PointerDownY;
|
|
||||||
std::string _PointerDownString; // What is under the pointer at the down position
|
|
||||||
bool _PointerDrag; // Is the pointer down and we have moved ?
|
|
||||||
bool _PointerVisible; // Is the pointer visible or hidden ?
|
|
||||||
|
|
||||||
NLMISC::TMouseButton _Buttons;
|
NLMISC::TMouseButton _Buttons;
|
||||||
|
|
||||||
CGroupContainer *_LastHightLight;
|
CGroupContainer *_LastHightLight;
|
||||||
|
|
122
code/ryzom/client/src/interface_v3/view_pointer_base.cpp
Normal file
122
code/ryzom/client/src/interface_v3/view_pointer_base.cpp
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
#include "view_pointer_base.h"
|
||||||
|
|
||||||
|
CViewPointerBase::CViewPointerBase( const CViewBase::TCtorParam ¶m ) :
|
||||||
|
CViewBase( param )
|
||||||
|
{
|
||||||
|
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
||||||
|
_PointerDown = false;
|
||||||
|
_PointerVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CViewPointerBase::~CViewPointerBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerPos (sint32 x, sint32 y)
|
||||||
|
{
|
||||||
|
if (_PointerDown)
|
||||||
|
{
|
||||||
|
if (!_PointerDrag)
|
||||||
|
{
|
||||||
|
if (((_PointerX - _PointerDownX) != 0) ||
|
||||||
|
((_PointerY - _PointerDownY) != 0))
|
||||||
|
{
|
||||||
|
_PointerDrag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_PointerOldX = getX();
|
||||||
|
_PointerOldY = getY();
|
||||||
|
|
||||||
|
_PointerX = x;
|
||||||
|
_PointerY = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerDispPos (sint32 x, sint32 y)
|
||||||
|
{
|
||||||
|
setX (x);
|
||||||
|
setY (y);
|
||||||
|
updateCoords ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::resetPointerPos ()
|
||||||
|
{
|
||||||
|
_PointerOldX = _PointerX;
|
||||||
|
_PointerOldY = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerDown (bool pd)
|
||||||
|
{
|
||||||
|
_PointerDown = pd;
|
||||||
|
|
||||||
|
if (_PointerDown == true)
|
||||||
|
{
|
||||||
|
_PointerDownX = _PointerX;
|
||||||
|
_PointerDownY = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_PointerDown == false)
|
||||||
|
_PointerDrag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::setPointerDownString (const std::string &s)
|
||||||
|
{
|
||||||
|
_PointerDownString = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// +++ GET +++
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerX;
|
||||||
|
y = _PointerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerDispPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = getX();
|
||||||
|
y = getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerOldPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerOldX;
|
||||||
|
y = _PointerOldY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CViewPointerBase::getPointerDownPos (sint32 &x, sint32 &y)
|
||||||
|
{
|
||||||
|
x = _PointerDownX;
|
||||||
|
y = _PointerDownY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerBase::getPointerDown ()
|
||||||
|
{
|
||||||
|
return _PointerDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerBase::getPointerDrag ()
|
||||||
|
{
|
||||||
|
return _PointerDrag;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
std::string CViewPointerBase::getPointerDownString ()
|
||||||
|
{
|
||||||
|
return _PointerDownString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
55
code/ryzom/client/src/interface_v3/view_pointer_base.h
Normal file
55
code/ryzom/client/src/interface_v3/view_pointer_base.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#ifndef VIEW_POINTER_BASE_H
|
||||||
|
#define VIEW_POINTER_BASE_H
|
||||||
|
|
||||||
|
#include "view_base.h"
|
||||||
|
|
||||||
|
class CViewPointerBase : public CViewBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CViewPointerBase )
|
||||||
|
|
||||||
|
CViewPointerBase( const TCtorParam ¶m );
|
||||||
|
virtual ~CViewPointerBase();
|
||||||
|
|
||||||
|
// Set the pointer position.
|
||||||
|
void setPointerPos (sint32 x, sint32 y);
|
||||||
|
void setPointerDispPos (sint32 x, sint32 y);
|
||||||
|
|
||||||
|
void resetPointerPos ();
|
||||||
|
void setPointerDown (bool pd);
|
||||||
|
void setPointerDownString (const std::string &s);
|
||||||
|
|
||||||
|
void getPointerPos (sint32 &x, sint32 &y);
|
||||||
|
void getPointerDispPos (sint32 &x, sint32 &y);
|
||||||
|
|
||||||
|
void getPointerOldPos (sint32 &x, sint32 &y);
|
||||||
|
void getPointerDownPos (sint32 &x, sint32 &y);
|
||||||
|
bool getPointerDown ();
|
||||||
|
std::string getPointerDownString ();
|
||||||
|
bool getPointerDrag ();
|
||||||
|
|
||||||
|
/// Is the pointer visible ?
|
||||||
|
bool show() const {return _PointerVisible;}
|
||||||
|
|
||||||
|
void draw(){}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// (x,y) is from the TopLeft corner of the window
|
||||||
|
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
||||||
|
sint32 _PointerY;
|
||||||
|
sint32 _PointerOldX; // Previous frame pointer position
|
||||||
|
sint32 _PointerOldY;
|
||||||
|
bool _PointerDown; // Is the pointer down ?
|
||||||
|
sint32 _PointerDownX; // Pointer down position
|
||||||
|
sint32 _PointerDownY;
|
||||||
|
std::string _PointerDownString; // What is under the pointer at the down position
|
||||||
|
bool _PointerDrag; // Is the pointer down and we have moved ?
|
||||||
|
bool _PointerVisible; // Is the pointer visible or hidden ?
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "interface_group.h"
|
#include "interface_group.h"
|
||||||
#include "group_container.h"
|
#include "group_container.h"
|
||||||
#include "group_in_scene.h"
|
#include "group_in_scene.h"
|
||||||
#include "view_pointer.h"
|
#include "view_pointer_base.h"
|
||||||
|
|
||||||
#include "group_editbox_base.h"
|
#include "group_editbox_base.h"
|
||||||
#include "ctrl_draggable.h"
|
#include "ctrl_draggable.h"
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CInterfaceElement;
|
||||||
class CCtrlBase;
|
class CCtrlBase;
|
||||||
class CViewBase;
|
class CViewBase;
|
||||||
class CInterfaceGroup;
|
class CInterfaceGroup;
|
||||||
class CViewPointer;
|
class CViewPointerBase;
|
||||||
|
|
||||||
class IParser
|
class IParser
|
||||||
{
|
{
|
||||||
|
@ -184,8 +184,8 @@ public:
|
||||||
|
|
||||||
float _DeltaTimeStopingContextHelp;
|
float _DeltaTimeStopingContextHelp;
|
||||||
|
|
||||||
CViewPointer* getPointer(){ return _Pointer; }
|
CViewPointerBase* getPointer(){ return _Pointer; }
|
||||||
void setPointer( CViewPointer *pointer ){ _Pointer = pointer; }
|
void setPointer( CViewPointerBase *pointer ){ _Pointer = pointer; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the window under a spot
|
* get the window under a spot
|
||||||
|
@ -278,7 +278,7 @@ private:
|
||||||
std::vector< SModalWndInfo > _ModalStack;
|
std::vector< SModalWndInfo > _ModalStack;
|
||||||
static std::string _CtrlLaunchingModalId;
|
static std::string _CtrlLaunchingModalId;
|
||||||
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
|
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
|
||||||
CViewPointer *_Pointer;
|
CViewPointerBase *_Pointer;
|
||||||
|
|
||||||
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
|
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
|
||||||
|
|
||||||
|
|
|
@ -1738,7 +1738,7 @@ bool mainLoop()
|
||||||
if(!CViewRenderer::getInstance()->isMinimized())
|
if(!CViewRenderer::getInstance()->isMinimized())
|
||||||
{
|
{
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
// Get the pointer position (in pixel)
|
// Get the pointer position (in pixel)
|
||||||
|
|
|
@ -150,7 +150,7 @@ void CUserControls::aiMode()
|
||||||
IM->enableMouseHandling(false);
|
IM->enableMouseHandling(false);
|
||||||
EventsListener.enableMouseSmoothing(true);
|
EventsListener.enableMouseSmoothing(true);
|
||||||
// Get the cursor instance and hide.
|
// Get the cursor instance and hide.
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
// Freelook mode.
|
// Freelook mode.
|
||||||
|
|
|
@ -507,7 +507,7 @@ void CUserControls::freeLook(bool fullMode)
|
||||||
// disable interface mouse handling.
|
// disable interface mouse handling.
|
||||||
IM->enableMouseHandling(false);
|
IM->enableMouseHandling(false);
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
// Hide the Cursor.
|
// Hide the Cursor.
|
||||||
|
@ -590,7 +590,7 @@ void CUserControls::cameraLook(bool fullMode)
|
||||||
// disable interface mouse handling.
|
// disable interface mouse handling.
|
||||||
IM->enableMouseHandling(false);
|
IM->enableMouseHandling(false);
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
// Hide the Cursor.
|
// Hide the Cursor.
|
||||||
|
|
|
@ -155,7 +155,7 @@ uint32 CTool::getScreenHeight()
|
||||||
void CTool::getMousePos(sint32 &x, sint32 &y)
|
void CTool::getMousePos(sint32 &x, sint32 &y)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CTool_getMousePos)
|
//H_AUTO(R2_CTool_getMousePos)
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor == NULL)
|
if(cursor == NULL)
|
||||||
{
|
{
|
||||||
x = y = -1;
|
x = y = -1;
|
||||||
|
@ -753,7 +753,7 @@ bool CTool::isMouseCaptured()
|
||||||
void CTool::setMouseCursor(const char *cursorTexture)
|
void CTool::setMouseCursor(const char *cursorTexture)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CTool_setMouseCursor)
|
//H_AUTO(R2_CTool_setMouseCursor)
|
||||||
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
{
|
{
|
||||||
cursor->setCursor(cursorTexture);
|
cursor->setCursor(cursorTexture);
|
||||||
|
|
Loading…
Reference in a new issue