CHANGED: #1471 CCtrlBaseButton is now part of the NELGUI Library.
This commit is contained in:
parent
79c83c421a
commit
b90b19358f
24 changed files with 107 additions and 115 deletions
|
@ -108,6 +108,9 @@ namespace NLGUI
|
||||||
void runActionHandler(const std::string &AHName, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
void runActionHandler(const std::string &AHName, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||||
void runActionHandler(IActionHandler *ah, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
void runActionHandler(IActionHandler *ah, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||||
|
|
||||||
|
// Submit a generic event
|
||||||
|
void submitEvent( const std::string &evt );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CAHManager(){}
|
CAHManager(){}
|
||||||
static CAHManager *_GlobalInstance;
|
static CAHManager *_GlobalInstance;
|
||||||
|
|
|
@ -291,7 +291,14 @@ namespace NLGUI
|
||||||
void addOptions( std::string name, CInterfaceOptions *options );
|
void addOptions( std::string name, CInterfaceOptions *options );
|
||||||
void removeOptions( std::string name );
|
void removeOptions( std::string name );
|
||||||
void removeAllOptions();
|
void removeAllOptions();
|
||||||
|
|
||||||
|
// Enable mouse Events to interface. if false, release Captures.
|
||||||
|
void enableMouseHandling( bool handle );
|
||||||
|
bool isMouseHandlingEnabled() const{ return _MouseHandlingEnabled; }
|
||||||
|
|
||||||
|
// Get the User DblClick Delay (according to save...), in milisecond
|
||||||
|
uint getUserDblClickDelay();
|
||||||
|
|
||||||
static IParser *parser;
|
static IParser *parser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -333,6 +340,8 @@ namespace NLGUI
|
||||||
NLMISC::CCDBNodeLeaf *_GProp;
|
NLMISC::CCDBNodeLeaf *_GProp;
|
||||||
NLMISC::CCDBNodeLeaf *_BProp;
|
NLMISC::CCDBNodeLeaf *_BProp;
|
||||||
NLMISC::CCDBNodeLeaf *_AProp;
|
NLMISC::CCDBNodeLeaf *_AProp;
|
||||||
|
|
||||||
|
bool _MouseHandlingEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,8 +275,14 @@ namespace NLGUI
|
||||||
const std::string event = AHName + ":" + Params;
|
const std::string event = AHName + ":" + Params;
|
||||||
pAH->execute(NULL, event);
|
pAH->execute(NULL, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAHManager::submitEvent( const std::string &evt )
|
||||||
|
{
|
||||||
|
// Submit the event to the quick help system
|
||||||
|
runActionHandler( "submit_quick_help", NULL, evt );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
class CAHSet : public IActionHandler
|
class CAHSet : public IActionHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,15 +15,12 @@
|
||||||
// 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 "nel/gui/ctrl_base_button.h"
|
||||||
#include "stdpch.h"
|
|
||||||
|
|
||||||
#include "ctrl_base_button.h"
|
|
||||||
#include "interface_manager.h"
|
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
#include "../time_client.h"
|
#include "nel/gui/interface_group.h"
|
||||||
|
|
||||||
#include "nel/gui/lua_ihm.h"
|
#include "nel/gui/lua_ihm.h"
|
||||||
|
#include "nel/gui/widget_manager.h"
|
||||||
|
#include "nel/gui/db_manager.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -205,9 +202,10 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
if (!_Active || _Frozen)
|
if (!_Active || _Frozen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
sint64 T1 = NLMISC::CTime::getLocalTime();
|
||||||
|
|
||||||
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
||||||
|
|
||||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
|
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
|
||||||
|
@ -227,7 +225,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
{
|
{
|
||||||
if (_AHOnLeftDblClick)
|
if (_AHOnLeftDblClick)
|
||||||
{
|
{
|
||||||
if ((CCtrlBaseButton *) _LastLeftClickButton == this && (T1 - _LastLeftClickDate) < pIM->getUserDblClickDelay())
|
if ((CCtrlBaseButton *) _LastLeftClickButton == this && (T1 - _LastLeftClickDate) < CWidgetManager::getInstance()->getUserDblClickDelay())
|
||||||
{
|
{
|
||||||
CAHManager::getInstance()->runActionHandler (_AHOnLeftDblClick, this, _AHLeftDblClickParams);
|
CAHManager::getInstance()->runActionHandler (_AHOnLeftDblClick, this, _AHLeftDblClickParams);
|
||||||
_LeftDblClickHandled = true;
|
_LeftDblClickHandled = true;
|
||||||
|
@ -308,7 +306,6 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
{
|
{
|
||||||
_LastLeftClickButton = NULL;
|
_LastLeftClickButton = NULL;
|
||||||
bool handled= false;
|
bool handled= false;
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerRight() != this)
|
if (CWidgetManager::getInstance()->getCapturePointerRight() != this)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -338,11 +335,9 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
{
|
{
|
||||||
if (_AHOnClockTick != NULL)
|
if (_AHOnClockTick != NULL)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
CAHManager::getInstance()->runActionHandler(_AHOnClockTick, this, _AHClockTickParams);
|
CAHManager::getInstance()->runActionHandler(_AHOnClockTick, this, _AHClockTickParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
|
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
|
||||||
{
|
{
|
||||||
if (!_LeftLongClickHandled)
|
if (!_LeftLongClickHandled)
|
||||||
|
@ -445,8 +440,7 @@ void CCtrlBaseButton::unselect()
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CCtrlBaseButton::updateOver(bool &lastOver)
|
void CCtrlBaseButton::updateOver(bool &lastOver)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
if (!CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
if (!pIM->isMouseHandlingEnabled())
|
|
||||||
{
|
{
|
||||||
_Over = false;
|
_Over = false;
|
||||||
return;
|
return;
|
||||||
|
@ -500,10 +494,9 @@ void CCtrlBaseButton::runLeftClickAction()
|
||||||
{
|
{
|
||||||
if(_AHOnLeftClick != NULL)
|
if(_AHOnLeftClick != NULL)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
|
|
||||||
//nlinfo("clicked on %s", _Id.c_str());
|
//nlinfo("clicked on %s", _Id.c_str());
|
||||||
pIM->submitEvent ("button_click:"+getId());//TEMP
|
CAHManager::getInstance()->submitEvent( "button_click:" + getId() );
|
||||||
CAHManager::getInstance()->runActionHandler (_AHOnLeftClick, this, _AHLeftClickParams);
|
CAHManager::getInstance()->runActionHandler (_AHOnLeftClick, this, _AHLeftClickParams);
|
||||||
//pIM->submitEvent ("button_click:"+getId());
|
//pIM->submitEvent ("button_click:"+getId());
|
||||||
}
|
}
|
|
@ -25,6 +25,12 @@
|
||||||
#include "nel/gui/group_editbox_base.h"
|
#include "nel/gui/group_editbox_base.h"
|
||||||
#include "nel/gui/interface_options.h"
|
#include "nel/gui/interface_options.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const uint DOUBLE_CLICK_MIN = 50;
|
||||||
|
const uint DOUBLE_CLICK_MAX = 750;
|
||||||
|
}
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1378,6 +1384,43 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
_OptionsMap.clear();
|
_OptionsMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CWidgetManager::enableMouseHandling( bool handle )
|
||||||
|
{
|
||||||
|
_MouseHandlingEnabled = handle;
|
||||||
|
if(!handle)
|
||||||
|
{
|
||||||
|
if(!getPointer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If Left captured, reset
|
||||||
|
if( getCapturePointerLeft() )
|
||||||
|
setCapturePointerLeft( NULL );
|
||||||
|
|
||||||
|
// Same for Right
|
||||||
|
if( getCapturePointerRight() )
|
||||||
|
setCapturePointerRight( NULL );
|
||||||
|
|
||||||
|
// Avoid any problem with modals
|
||||||
|
disableModalWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
uint CWidgetManager::getUserDblClickDelay()
|
||||||
|
{
|
||||||
|
uint nVal = 50;
|
||||||
|
NLMISC::CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED");
|
||||||
|
if( pNL != NULL )
|
||||||
|
nVal = pNL->getValue32();
|
||||||
|
|
||||||
|
uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f);
|
||||||
|
return dbclickDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CWidgetManager::CWidgetManager()
|
CWidgetManager::CWidgetManager()
|
||||||
{
|
{
|
||||||
|
@ -1389,6 +1432,8 @@ namespace NLGUI
|
||||||
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
||||||
_GlobalColorForContent = _GlobalColor;
|
_GlobalColorForContent = _GlobalColor;
|
||||||
_ContentAlpha = 255;
|
_ContentAlpha = 255;
|
||||||
|
|
||||||
|
_MouseHandlingEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWidgetManager::~CWidgetManager()
|
CWidgetManager::~CWidgetManager()
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
#include "actions_client.h"
|
#include "actions_client.h"
|
||||||
#include "attack_list.h"
|
#include "attack_list.h"
|
||||||
#include "interface_v3/player_trade.h"
|
#include "interface_v3/player_trade.h"
|
||||||
#include "interface_v3/ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
#include "weather.h"
|
#include "weather.h"
|
||||||
#include "forage_source_cl.h"
|
#include "forage_source_cl.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "macrocmd_manager.h"
|
#include "macrocmd_manager.h"
|
||||||
#include "inventory_manager.h"
|
#include "inventory_manager.h"
|
||||||
|
|
||||||
#include "ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
#include "../connection.h"
|
#include "../connection.h"
|
||||||
#include "view_bitmap.h"
|
#include "view_bitmap.h"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ using namespace NLMISC;
|
||||||
#include "../entities.h"
|
#include "../entities.h"
|
||||||
#include "interface_manager.h"
|
#include "interface_manager.h"
|
||||||
#include "action_handler_tools.h"
|
#include "action_handler_tools.h"
|
||||||
#include "ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// GLOBAL //
|
// GLOBAL //
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ public:
|
||||||
// **** Cyclic Cast? (dblclick)
|
// **** Cyclic Cast? (dblclick)
|
||||||
bool cyclic;
|
bool cyclic;
|
||||||
// Manage "DblHit"
|
// Manage "DblHit"
|
||||||
uint dbclickDelay = pIM->getUserDblClickDelay();
|
uint dbclickDelay = CWidgetManager::getInstance()->getUserDblClickDelay();
|
||||||
// if success to "dblclick"
|
// if success to "dblclick"
|
||||||
if(LastIndex==(sint)memoryIndex && T1<=LastHitTime+dbclickDelay )
|
if(LastIndex==(sint)memoryIndex && T1<=LastHitTime+dbclickDelay )
|
||||||
cyclic= true;
|
cyclic= true;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "inventory_manager.h"
|
#include "inventory_manager.h"
|
||||||
#include "nel/gui/action_handler.h"
|
#include "nel/gui/action_handler.h"
|
||||||
#include "../client_cfg.h"
|
#include "../client_cfg.h"
|
||||||
#include "ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
#include "group_container.h"
|
#include "group_container.h"
|
||||||
#include "../string_manager_client.h"
|
#include "../string_manager_client.h"
|
||||||
#include "../net_manager.h"
|
#include "../net_manager.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef RZ_CTRL_BUTTON_H
|
#ifndef RZ_CTRL_BUTTON_H
|
||||||
#define RZ_CTRL_BUTTON_H
|
#define RZ_CTRL_BUTTON_H
|
||||||
|
|
||||||
#include "ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
#include "nel/gui/view_renderer.h"
|
#include "nel/gui/view_renderer.h"
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef NL_CTRL_TEXT_BUTTON_H
|
#ifndef NL_CTRL_TEXT_BUTTON_H
|
||||||
#define NL_CTRL_TEXT_BUTTON_H
|
#define NL_CTRL_TEXT_BUTTON_H
|
||||||
|
|
||||||
#include "ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
#include "nel/gui/view_renderer.h"
|
#include "nel/gui/view_renderer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -919,7 +919,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
|
||||||
{
|
{
|
||||||
if (_WaitToOpenClose)
|
if (_WaitToOpenClose)
|
||||||
{
|
{
|
||||||
uint dbclickDelay = pIM->getUserDblClickDelay();
|
uint dbclickDelay = CWidgetManager::getInstance()->getUserDblClickDelay();
|
||||||
if ((T1 - _WaitToOpenCloseDate) > dbclickDelay)
|
if ((T1 - _WaitToOpenCloseDate) > dbclickDelay)
|
||||||
{
|
{
|
||||||
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
|
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
|
||||||
|
@ -3203,7 +3203,7 @@ void CGroupContainer::setActive (bool state)
|
||||||
else
|
else
|
||||||
CWidgetManager::getInstance()->setBackWindow(this);
|
CWidgetManager::getInstance()->setBackWindow(this);
|
||||||
}
|
}
|
||||||
pIM->submitEvent((state?"show:":"hide:")+getId());
|
CAHManager::getInstance()->submitEvent((state?"show:":"hide:")+getId());
|
||||||
|
|
||||||
CInterfaceGroup::setActive(state);
|
CInterfaceGroup::setActive(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,7 +798,7 @@ bool CCtrlTabButton::handleEvent (const NLGUI::CEventDescriptor &event)
|
||||||
if (_Blinking)
|
if (_Blinking)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
uint dbclickDelay = pIM->getUserDblClickDelay();
|
uint dbclickDelay = CWidgetManager::getInstance()->getUserDblClickDelay();
|
||||||
if ((T1 - _BlinkDate) > dbclickDelay)
|
if ((T1 - _BlinkDate) > dbclickDelay)
|
||||||
{
|
{
|
||||||
if (_BlinkState)
|
if (_BlinkState)
|
||||||
|
|
|
@ -566,7 +566,7 @@ void CGroupTree::draw()
|
||||||
// change the over
|
// change the over
|
||||||
bool bDisplayOver = true;
|
bool bDisplayOver = true;
|
||||||
|
|
||||||
if (!pIM->isMouseHandlingEnabled())
|
if (!CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
bDisplayOver = false;
|
bDisplayOver = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// **** Event Mouse
|
// **** Event Mouse
|
||||||
else if(CWidgetManager::getInstance()->getPointer() && _Focus /* && pIM->isMouseHandlingEnabled() */ &&
|
else if(CWidgetManager::getInstance()->getPointer() && _Focus /* && CWidgetManager::getInstance()->isMouseHandlingEnabled() */ &&
|
||||||
( event == EventMouseMoveId ||
|
( event == EventMouseMoveId ||
|
||||||
event == EventMouseDownId ||
|
event == EventMouseDownId ||
|
||||||
event == EventMouseUpId ||
|
event == EventMouseUpId ||
|
||||||
|
@ -282,7 +282,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
||||||
// button down ?
|
// button down ?
|
||||||
static volatile bool doTest = false;
|
static volatile bool doTest = false;
|
||||||
|
|
||||||
if (!doTest || (doTest && pIM->isMouseHandlingEnabled()))
|
if (!doTest || (doTest && CWidgetManager::getInstance()->isMouseHandlingEnabled()))
|
||||||
{
|
{
|
||||||
if (event==EventMouseDownId)
|
if (event==EventMouseDownId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,10 +182,6 @@ CChatDisplayer * ChatDisplayer = NULL;
|
||||||
void initActions();
|
void initActions();
|
||||||
void uninitActions();
|
void uninitActions();
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
static const uint DOUBLE_CLICK_MIN = 50;
|
|
||||||
static const uint DOUBLE_CLICK_MAX = 750;
|
|
||||||
|
|
||||||
///\todo nico: remove this dummy displayer
|
///\todo nico: remove this dummy displayer
|
||||||
NLMISC::CLog g_log;
|
NLMISC::CLog g_log;
|
||||||
|
|
||||||
|
@ -278,7 +274,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
|
||||||
_GlobalRolloverFactorContent = 255;
|
_GlobalRolloverFactorContent = 255;
|
||||||
_GlobalRolloverFactorContainer = 255;
|
_GlobalRolloverFactorContainer = 255;
|
||||||
_MouseOverWindow= false;
|
_MouseOverWindow= false;
|
||||||
_MouseHandlingEnabled= true;
|
|
||||||
_ConfigLoaded = false;
|
_ConfigLoaded = false;
|
||||||
_LogState = false;
|
_LogState = false;
|
||||||
_KeysLoaded = false;
|
_KeysLoaded = false;
|
||||||
|
@ -2610,7 +2605,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
||||||
eventDesc.setX( _Pointer->getX() );
|
eventDesc.setX( _Pointer->getX() );
|
||||||
eventDesc.setY( _Pointer->getY() );
|
eventDesc.setY( _Pointer->getY() );
|
||||||
|
|
||||||
if( _MouseHandlingEnabled )
|
if( CWidgetManager::getInstance()->isMouseHandlingEnabled() )
|
||||||
{
|
{
|
||||||
// First thing to do : Capture handling
|
// First thing to do : Capture handling
|
||||||
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
|
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
|
||||||
|
@ -3493,32 +3488,6 @@ void CInterfaceManager::disableContextHelpForControl(CCtrlBase *pCtrl)
|
||||||
disableContextHelp();
|
disableContextHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceManager::enableMouseHandling(bool handle)
|
|
||||||
{
|
|
||||||
_MouseHandlingEnabled= handle;
|
|
||||||
if(!handle)
|
|
||||||
{
|
|
||||||
if(!CWidgetManager::getInstance()->getPointer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If Left captured, reset
|
|
||||||
if( CWidgetManager::getInstance()->getCapturePointerLeft() )
|
|
||||||
{
|
|
||||||
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Same for Right
|
|
||||||
if( CWidgetManager::getInstance()->getCapturePointerRight() )
|
|
||||||
{
|
|
||||||
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid any problem with modals
|
|
||||||
CWidgetManager::getInstance()->disableModalWindow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CInterfaceManager::displayDebugInfo(const ucstring &str, TSystemInfoMode mode /*=InfoMsg*/)
|
void CInterfaceManager::displayDebugInfo(const ucstring &str, TSystemInfoMode mode /*=InfoMsg*/)
|
||||||
|
@ -4039,26 +4008,6 @@ void CInterfaceManager::restoreAllContainersBackupPosition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
|
|
||||||
uint CInterfaceManager::getUserDblClickDelay()
|
|
||||||
{
|
|
||||||
uint nVal = 50;
|
|
||||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED");
|
|
||||||
if (pNL != NULL)
|
|
||||||
nVal = pNL->getValue32();
|
|
||||||
uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f);
|
|
||||||
return dbclickDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
void CInterfaceManager::submitEvent (const std::string &event)
|
|
||||||
{
|
|
||||||
// Submit the event to the quick help system
|
|
||||||
CAHManager::getInstance()->runActionHandler("submit_quick_help", NULL, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CInterfaceManager::visit(CInterfaceElementVisitor *visitor)
|
void CInterfaceManager::visit(CInterfaceElementVisitor *visitor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -387,10 +387,6 @@ public:
|
||||||
|
|
||||||
bool isMouseOverWindow() const {return _MouseOverWindow;}
|
bool isMouseOverWindow() const {return _MouseOverWindow;}
|
||||||
|
|
||||||
// Enable mouse Events to interface. if false, release Captures.
|
|
||||||
void enableMouseHandling(bool handle);
|
|
||||||
bool isMouseHandlingEnabled() const { return _MouseHandlingEnabled; }
|
|
||||||
|
|
||||||
// Modes
|
// Modes
|
||||||
void setMode(uint8 newMode);
|
void setMode(uint8 newMode);
|
||||||
uint8 getMode() const { return _CurrentMode; }
|
uint8 getMode() const { return _CurrentMode; }
|
||||||
|
@ -414,12 +410,6 @@ public:
|
||||||
void displayUICtrlBBoxs(const std::string &uiFilter);
|
void displayUICtrlBBoxs(const std::string &uiFilter);
|
||||||
void displayUIGroupBBoxs(const std::string &uiFilter);
|
void displayUIGroupBBoxs(const std::string &uiFilter);
|
||||||
|
|
||||||
// Get the User DblClick Delay (according to save...), in milisecond
|
|
||||||
uint getUserDblClickDelay();
|
|
||||||
|
|
||||||
// Submit a generic event
|
|
||||||
void submitEvent (const std::string &event);
|
|
||||||
|
|
||||||
// visit all elements of the interface manager
|
// visit all elements of the interface manager
|
||||||
void visit(CInterfaceElementVisitor *visitor);
|
void visit(CInterfaceElementVisitor *visitor);
|
||||||
|
|
||||||
|
@ -743,9 +733,6 @@ private:
|
||||||
// System Options
|
// System Options
|
||||||
CInterfaceOptionValue _SystemOptions[NumSystemOptions];
|
CInterfaceOptionValue _SystemOptions[NumSystemOptions];
|
||||||
|
|
||||||
bool _MouseHandlingEnabled;
|
|
||||||
|
|
||||||
|
|
||||||
// Modes
|
// Modes
|
||||||
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
||||||
uint8 _CurrentMode;
|
uint8 _CurrentMode;
|
||||||
|
|
|
@ -199,7 +199,7 @@ void CViewPointer::draw ()
|
||||||
_LastHightLight = NULL;
|
_LastHightLight = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL && pIM->isMouseHandlingEnabled())
|
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL && CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
CCtrlMover *pCM = dynamic_cast<CCtrlMover*>( CWidgetManager::getInstance()->getCapturePointerLeft());
|
CCtrlMover *pCM = dynamic_cast<CCtrlMover*>( CWidgetManager::getInstance()->getCapturePointerLeft());
|
||||||
if ((pCM != NULL) && (pCM->canMove() == true))
|
if ((pCM != NULL) && (pCM->canMove() == true))
|
||||||
|
@ -308,7 +308,7 @@ void CViewPointer::draw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the cursor type that are under the pointer
|
// Draw the cursor type that are under the pointer
|
||||||
if (pIM->isMouseHandlingEnabled())
|
if (CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
// Sorts the controls according to their depth, to approximate as best the CapturePointerLeft algo.
|
// Sorts the controls according to their depth, to approximate as best the CapturePointerLeft algo.
|
||||||
// Especially important so that Resizers controls get the precedence over the move control (else could randomly bug like in chat group)
|
// Especially important so that Resizers controls get the precedence over the move control (else could randomly bug like in chat group)
|
||||||
|
@ -363,7 +363,7 @@ void CViewPointer::draw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pIM->isMouseHandlingEnabled())
|
if (CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
if (rICL.empty())
|
if (rICL.empty())
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@ void CViewPointer::draw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_StringMode && pIM->isMouseHandlingEnabled())
|
if (_StringMode && CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
|
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
|
||||||
if (stringCursor)
|
if (stringCursor)
|
||||||
|
|
|
@ -99,7 +99,7 @@ void CUserControls::aiMode()
|
||||||
}
|
}
|
||||||
if( EventsListener.isMouseButtonReleased (leftButton) )
|
if( EventsListener.isMouseButtonReleased (leftButton) )
|
||||||
{
|
{
|
||||||
if(T1 <= _LeftClickEnd+IM->getUserDblClickDelay())
|
if(T1 <= _LeftClickEnd + CWidgetManager::getInstance()->getUserDblClickDelay())
|
||||||
{
|
{
|
||||||
dblClickLeft = true;
|
dblClickLeft = true;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void CUserControls::aiMode()
|
||||||
}
|
}
|
||||||
if( EventsListener.isMouseButtonReleased (rightButton) )
|
if( EventsListener.isMouseButtonReleased (rightButton) )
|
||||||
{
|
{
|
||||||
if(T1 <= _RightClickEnd+IM->getUserDblClickDelay())
|
if(T1 <= _RightClickEnd + CWidgetManager::getInstance()->getUserDblClickDelay())
|
||||||
{
|
{
|
||||||
dblClickRight = true;
|
dblClickRight = true;
|
||||||
}
|
}
|
||||||
|
@ -141,13 +141,13 @@ void CUserControls::aiMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give back the mouse handling to the interface.
|
// Give back the mouse handling to the interface.
|
||||||
IM->enableMouseHandling(true);
|
CWidgetManager::getInstance()->enableMouseHandling(true);
|
||||||
}
|
}
|
||||||
else if (EventsListener.isMouseButtonDown (rightButton))
|
else if (EventsListener.isMouseButtonDown (rightButton))
|
||||||
{
|
{
|
||||||
if((T1-_RightClickStart) > _TimeLongClick)
|
if((T1-_RightClickStart) > _TimeLongClick)
|
||||||
{
|
{
|
||||||
IM->enableMouseHandling(false);
|
CWidgetManager::getInstance()->enableMouseHandling(false);
|
||||||
EventsListener.enableMouseSmoothing(true);
|
EventsListener.enableMouseSmoothing(true);
|
||||||
// Get the cursor instance and hide.
|
// Get the cursor instance and hide.
|
||||||
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
|
|
|
@ -505,7 +505,7 @@ void CUserControls::freeLook(bool fullMode)
|
||||||
|
|
||||||
// FREE LOOK : Hide the cursor
|
// FREE LOOK : Hide the cursor
|
||||||
// disable interface mouse handling.
|
// disable interface mouse handling.
|
||||||
IM->enableMouseHandling(false);
|
CWidgetManager::getInstance()->enableMouseHandling(false);
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
|
@ -588,7 +588,7 @@ void CUserControls::cameraLook(bool fullMode)
|
||||||
|
|
||||||
// CAMERA LOOK : Hide the cursor
|
// CAMERA LOOK : Hide the cursor
|
||||||
// disable interface mouse handling.
|
// disable interface mouse handling.
|
||||||
IM->enableMouseHandling(false);
|
CWidgetManager::getInstance()->enableMouseHandling(false);
|
||||||
// Get the cursor instance
|
// Get the cursor instance
|
||||||
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||||
if(cursor)
|
if(cursor)
|
||||||
|
@ -747,7 +747,7 @@ void CUserControls::commonMove()
|
||||||
}
|
}
|
||||||
if( EventsListener.isMouseButtonReleased (leftButton) )
|
if( EventsListener.isMouseButtonReleased (leftButton) )
|
||||||
{
|
{
|
||||||
if(T1 <= _LeftClickEnd+IM->getUserDblClickDelay())
|
if(T1 <= _LeftClickEnd + CWidgetManager::getInstance()->getUserDblClickDelay())
|
||||||
{
|
{
|
||||||
dblClickLeft = true;
|
dblClickLeft = true;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ void CUserControls::commonMove()
|
||||||
}
|
}
|
||||||
if( EventsListener.isMouseButtonReleased (rightButton) )
|
if( EventsListener.isMouseButtonReleased (rightButton) )
|
||||||
{
|
{
|
||||||
if(T1 <= _RightClickEnd+IM->getUserDblClickDelay())
|
if(T1 <= _RightClickEnd + CWidgetManager::getInstance()->getUserDblClickDelay())
|
||||||
{
|
{
|
||||||
dblClickRight = true;
|
dblClickRight = true;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ void CUserControls::commonMove()
|
||||||
|
|
||||||
|
|
||||||
// Give back the mouse handling to the interface.
|
// Give back the mouse handling to the interface.
|
||||||
IM->enableMouseHandling(true);
|
CWidgetManager::getInstance()->enableMouseHandling(true);
|
||||||
EventsListener.enableMouseSmoothing(false);
|
EventsListener.enableMouseSmoothing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ void CUserControls::commonMove()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give back the mouse handling to the interface.
|
// Give back the mouse handling to the interface.
|
||||||
IM->enableMouseHandling(true);
|
CWidgetManager::getInstance()->enableMouseHandling(true);
|
||||||
EventsListener.enableMouseSmoothing(false);
|
EventsListener.enableMouseSmoothing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1313,7 +1313,7 @@ void CUserControls::stopFreeLook()
|
||||||
// Cursor mode
|
// Cursor mode
|
||||||
SetMouseCursor ();
|
SetMouseCursor ();
|
||||||
// Give back the mouse handling to the interface.
|
// Give back the mouse handling to the interface.
|
||||||
CInterfaceManager::getInstance()->enableMouseHandling(true);
|
CWidgetManager::getInstance()->enableMouseHandling(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ bool CTool::checkDoubleClick()
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CTool_checkDoubleClick)
|
//H_AUTO(R2_CTool_checkDoubleClick)
|
||||||
if (_DoubleClickStartTime == -1) return false;
|
if (_DoubleClickStartTime == -1) return false;
|
||||||
if (T0 - _DoubleClickStartTime >= getUI().getUserDblClickDelay()) return false;
|
if (T0 - _DoubleClickStartTime >= CWidgetManager::getInstance()->getUserDblClickDelay()) return false;
|
||||||
sint32 mx, my;
|
sint32 mx, my;
|
||||||
getMousePos(mx, my);
|
getMousePos(mx, my);
|
||||||
const sint32 moveThrehsold = 2;
|
const sint32 moveThrehsold = 2;
|
||||||
|
@ -725,7 +725,7 @@ void CTool::captureMouse()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserControls.captureMouse();
|
UserControls.captureMouse();
|
||||||
getUI().enableMouseHandling(false);
|
CWidgetManager::getInstance()->enableMouseHandling(false);
|
||||||
}
|
}
|
||||||
getUI().setContextHelpActive(false);
|
getUI().setContextHelpActive(false);
|
||||||
_MouseCaptured = true;
|
_MouseCaptured = true;
|
||||||
|
@ -737,7 +737,7 @@ void CTool::releaseMouse()
|
||||||
//H_AUTO(R2_CTool_releaseMouse)
|
//H_AUTO(R2_CTool_releaseMouse)
|
||||||
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
|
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
|
||||||
UserControls.releaseMouse();
|
UserControls.releaseMouse();
|
||||||
getUI().enableMouseHandling(true);
|
CWidgetManager::getInstance()->enableMouseHandling(true);
|
||||||
getUI().setContextHelpActive(true);
|
getUI().setContextHelpActive(true);
|
||||||
_MouseCaptured = false;
|
_MouseCaptured = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "verbose_clock.h"
|
#include "verbose_clock.h"
|
||||||
#include "entity_sorter.h"
|
#include "entity_sorter.h"
|
||||||
//
|
//
|
||||||
#include "../interface_v3/ctrl_base_button.h"
|
#include "nel/gui/ctrl_base_button.h"
|
||||||
//
|
//
|
||||||
#include "game_share/player_visual_properties.h"
|
#include "game_share/player_visual_properties.h"
|
||||||
#include "game_share/visual_slot_manager.h"
|
#include "game_share/visual_slot_manager.h"
|
||||||
|
|
Loading…
Reference in a new issue