CHANGED: #1471 extracted some dragging related code from CDBCtrlSheet and created a new class CCtrlDraggable, so that CWidgetManager doesn't have to be coupled with CDBCtrlSheet.

--HG--
branch : gui-refactoring
hg/feature/sse2
dfighter1985 13 years ago
parent ad03911fe3
commit 8b54f34045

@ -909,7 +909,7 @@ class CIsPlayerItem : public IActionHandler
public: public:
virtual void execute (CCtrlBase *pCaller, const string &/* Params */) virtual void execute (CCtrlBase *pCaller, const string &/* Params */)
{ {
CDBCtrlSheet *cs = CDBCtrlSheet::getDraggedSheet(); CDBCtrlSheet *cs = dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() );
if (cs) if (cs)
{ {
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller); CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);

@ -0,0 +1,11 @@
#include "ctrl_draggable.h"
CCtrlDraggable* CCtrlDraggable::_LastDraggedSheet = NULL;
CCtrlDraggable::CCtrlDraggable(const TCtorParam &param) :
CCtrlBase( param )
{
dragged = false;
draggable = false;
}

@ -0,0 +1,38 @@
#ifndef CTRL_DRAGGABLE_H
#define CTRL_DRAGGABLE_H
#include "ctrl_base.h"
class CCtrlDraggable : public CCtrlBase
{
public:
CCtrlDraggable( const TCtorParam &param );
virtual ~CCtrlDraggable(){};
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
bool isDragged() const{ return dragged; }
void setDragged( bool dragged ){ this->dragged = dragged; }
bool isDraggable() const{ return draggable; }
void setDraggable( bool draggable ){ this->draggable = draggable; }
void abortDragging()
{
dragged = false;
_LastDraggedSheet = NULL;
}
REFLECT_EXPORT_START(CCtrlDraggable, CCtrlBase)
REFLECT_BOOL("dragable", isDraggable, setDraggable);
REFLECT_EXPORT_END
protected:
static void setDraggedSheet( CCtrlDraggable *draggable ){ _LastDraggedSheet = draggable; }
private:
static CCtrlDraggable *_LastDraggedSheet;
bool dragged;
bool draggable;
};
#endif

@ -62,7 +62,6 @@ using namespace STRING_MANAGER;
NLMISC::CSmartPtr<CSPhraseComAdpater> CDBCtrlSheet::_PhraseAdapter; NLMISC::CSmartPtr<CSPhraseComAdpater> CDBCtrlSheet::_PhraseAdapter;
CDBCtrlSheet *CDBCtrlSheet::_CurrSelection = NULL; CDBCtrlSheet *CDBCtrlSheet::_CurrSelection = NULL;
CDBCtrlSheet *CDBCtrlSheet::_LastDraggedSheet = NULL;
CDBCtrlSheet *CDBCtrlSheet::_CurrMenuSheet = NULL; CDBCtrlSheet *CDBCtrlSheet::_CurrMenuSheet = NULL;
UMaterial CDBCtrlSheet::_GuildMat; UMaterial CDBCtrlSheet::_GuildMat;
@ -131,7 +130,7 @@ ucstring CControlSheetTooltipInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet,
// *************************************************************************** // ***************************************************************************
int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls) int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
{ {
CLuaIHMRyzom::pushUIOnStack(ls, dynamic_cast<CInterfaceElement *>(_LastDraggedSheet)); CLuaIHMRyzom::pushUIOnStack(ls, dynamic_cast<CInterfaceElement *>( dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) ));
return 1; return 1;
} }
@ -293,7 +292,6 @@ CCtrlSheetInfo::CCtrlSheetInfo()
{ {
_Type = CCtrlSheetInfo::SheetType_Item; _Type = CCtrlSheetInfo::SheetType_Item;
_DispNoSheetBmpId = -1; _DispNoSheetBmpId = -1;
_Dragable = false;
_InterfaceColor= true; _InterfaceColor= true;
_SheetSelectionGroup = -1; _SheetSelectionGroup = -1;
_UseQuality = true; _UseQuality = true;
@ -379,9 +377,6 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
if (prop) if (prop)
_HasTradeSlotType= CInterfaceElement::convertBool(prop); _HasTradeSlotType= CInterfaceElement::convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" );
if (prop) _Dragable = CInterfaceElement::convertBool(prop);
// Read Action handlers // Read Action handlers
CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams);
CAHManager::getInstance()->parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams);
@ -502,8 +497,8 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
NLMISC_REGISTER_OBJECT(CViewBase, CDBCtrlSheet, std::string, "sheet"); NLMISC_REGISTER_OBJECT(CViewBase, CDBCtrlSheet, std::string, "sheet");
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
CDBCtrlSheet::CDBCtrlSheet(const TCtorParam &param) CDBCtrlSheet::CDBCtrlSheet(const TCtorParam &param) :
: CCtrlBase(param) CCtrlDraggable(param)
{ {
_LastSheetId = 0; _LastSheetId = 0;
_DispSlotBmpId= -1; _DispSlotBmpId= -1;
@ -511,7 +506,6 @@ CDBCtrlSheet::CDBCtrlSheet(const TCtorParam &param)
_DispSheetBmpId = -1; _DispSheetBmpId = -1;
_DispOverBmpId = -1; _DispOverBmpId = -1;
_DispOver2BmpId= -1; _DispOver2BmpId= -1;
_Draging = false;
_CanDrop = false; _CanDrop = false;
_Stackable= 1; _Stackable= 1;
_DispQuality= -1; _DispQuality= -1;
@ -575,7 +569,8 @@ CDBCtrlSheet::~CDBCtrlSheet()
// ensure erase static // ensure erase static
if(this==_CurrMenuSheet) _CurrMenuSheet = NULL; if(this==_CurrMenuSheet) _CurrMenuSheet = NULL;
if(this==_LastDraggedSheet) _LastDraggedSheet = NULL; if(this == dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) )
setDraggedSheet( NULL );
if(this==_CurrSelection) _CurrSelection = NULL; if(this==_CurrSelection) _CurrSelection = NULL;
} }
@ -595,6 +590,12 @@ bool CDBCtrlSheet::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
if(!parseCtrlInfo(cur, parentGroup)) if(!parseCtrlInfo(cur, parentGroup))
return false; return false;
prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" );
if( prop != NULL )
setDraggable( CInterfaceElement::convertBool(prop) );
else
setDraggable( false );
if (_Type != SheetType_Macro) if (_Type != SheetType_Macro)
{ {
prop = (char*) xmlGetProp( cur, (xmlChar*)"value" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"value" );
@ -1865,7 +1866,7 @@ void CDBCtrlSheet::draw()
if (CWidgetManager::getInstance()->getCurrentWindowUnder() == CWidgetManager::getInstance()->getWindow(this)) if (CWidgetManager::getInstance()->getCurrentWindowUnder() == CWidgetManager::getInstance()->getWindow(this))
{ {
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft()); CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging()) if ((pCSSrc != NULL) && pCSSrc->isDragged())
{ {
string params = string("src=") + pCSSrc->getId(); string params = string("src=") + pCSSrc->getId();
if (!_AHCanDropParams.empty()) if (!_AHCanDropParams.empty())
@ -1886,7 +1887,7 @@ void CDBCtrlSheet::draw()
} }
} }
drawSheet (_XReal+1, _YReal+1, _Draging); drawSheet (_XReal+1, _YReal+1, isDragged() );
// Draw the selection after the sheet. Important for spells because selection border is same size as spell square // Draw the selection after the sheet. Important for spells because selection border is same size as spell square
if (_CanDrop) if (_CanDrop)
@ -2512,7 +2513,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
if (showSelectionBorder) if (showSelectionBorder)
{ {
if (!_Draging || (_Draging && _DuplicateOnDrag)) if (!isDragged() || (isDragged() && _DuplicateOnDrag))
{ {
// draw selection border if this sheet is selected // draw selection border if this sheet is selected
if (_SheetSelectionGroup != -1) // is this sheet selectable ? if (_SheetSelectionGroup != -1) // is this sheet selectable ?
@ -2604,7 +2605,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
// Handle drag'n'drop // Handle drag'n'drop
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this) if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{ {
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !_Draging) if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !isDragged())
{ {
_DragX = eventDesc.getX(); _DragX = eventDesc.getX();
_DragY = eventDesc.getY(); _DragY = eventDesc.getY();
@ -2616,17 +2617,17 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
// Cannot drag if grayed (LOCKED or LATENT)!. Still can drag a shortcut // Cannot drag if grayed (LOCKED or LATENT)!. Still can drag a shortcut
if (asItemSheet() && asItemSheet()->Stackable > 1 && _UseQuantity) if (asItemSheet() && asItemSheet()->Stackable > 1 && _UseQuantity)
{ {
validClic = _Dragable && !_Draging && (getQuantity() > 0); validClic = isDraggable() && !isDragged() && (getQuantity() > 0);
validClic = validClic && (!getItemWeared()); validClic = validClic && (!getItemWeared());
} }
else else
{ {
validClic = _Dragable && !_Draging && ((!getItemWeared()&&!getGrayed()) || isShortCut()); validClic = isDraggable() && !isDragged() && ((!getItemWeared()&&!getGrayed()) || isShortCut());
} }
} }
if (_Type == SheetType_Macro) if (_Type == SheetType_Macro)
{ {
validClic = _Dragable; validClic = isDraggable();
} }
// posssibly check AH to see if really can draging // posssibly check AH to see if really can draging
@ -2645,8 +2646,8 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
_DeltaDragY= _DragY-(_YReal+1); _DeltaDragY= _DragY-(_YReal+1);
if (_DeltaDragX > _WReal) _DeltaDragX = _WReal; if (_DeltaDragX > _WReal) _DeltaDragX = _WReal;
if (_DeltaDragY > _HReal) _DeltaDragY = _HReal; if (_DeltaDragY > _HReal) _DeltaDragY = _HReal;
_Draging = true; setDragged( true );
_LastDraggedSheet = this; setDraggedSheet( this );
if (_AHOnDrag != NULL) if (_AHOnDrag != NULL)
{ {
@ -2655,7 +2656,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
} }
} }
if (_Draging) if (isDragged())
{ {
// If mouse left up, must end the Drag // If mouse left up, must end the Drag
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup) if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
@ -2827,8 +2828,8 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
} }
// In all case, quit // In all case, quit
_Draging = false; setDragged( false );
_LastDraggedSheet = NULL; setDraggedSheet( NULL );
// In call case, end of drag => consider handled to not call another action // In call case, end of drag => consider handled to not call another action
return true; return true;
} }
@ -2836,7 +2837,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
} }
// If we are dragging, no more event on us // If we are dragging, no more event on us
if(_Draging) if(isDragged())
return false; // true; return false; // true;
// Mouse events that must be done over the control // Mouse events that must be done over the control
@ -2856,7 +2857,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
if(_AHOnLeftClick != NULL) if(_AHOnLeftClick != NULL)
CAHManager::getInstance()->runActionHandler (_AHOnLeftClick, this, _AHLeftClickParams); CAHManager::getInstance()->runActionHandler (_AHOnLeftClick, this, _AHLeftClickParams);
// Run Menu (if item is not being dragged) // Run Menu (if item is not being dragged)
if (!_ListMenuLeft.empty() && _LastDraggedSheet == NULL) if (!_ListMenuLeft.empty() && dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) == NULL)
{ {
if (getSheetId() != 0) if (getSheetId() != 0)
{ {
@ -2891,7 +2892,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
{ {
handled= true; handled= true;
// There must be no dragged sheet // There must be no dragged sheet
if(_LastDraggedSheet == NULL) if( dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) == NULL)
{ {
// if a macro, don't test if Sheet==0 // if a macro, don't test if Sheet==0
if ( isMacro() || getSheetId() != 0) if ( isMacro() || getSheetId() != 0)
@ -2973,7 +2974,6 @@ void CDBCtrlSheet::swapSheet(CDBCtrlSheet *other)
void CDBCtrlSheet::setCurrSelection(CDBCtrlSheet *selected) void CDBCtrlSheet::setCurrSelection(CDBCtrlSheet *selected)
{ {
_CurrSelection = selected; _CurrSelection = selected;
CInterfaceManager *im = CInterfaceManager::getInstance();
NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:SHEET")->setValue64(selected ? selected->getSheetId() : 0); NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:SHEET")->setValue64(selected ? selected->getSheetId() : 0);
NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:QUALITY")->setValue64(selected ? selected->getQuality() : 0); NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:QUALITY")->setValue64(selected ? selected->getQuality() : 0);
NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:SLOT_TYPE")->setValue64(selected ? selected->getBehaviour() : 0); NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_ITEM_SHEET_ID:SLOT_TYPE")->setValue64(selected ? selected->getBehaviour() : 0);
@ -4246,13 +4246,6 @@ ucstring CDBCtrlSheet::getItemActualName() const
} }
} }
// ***************************************************************************
void CDBCtrlSheet::abortDraging()
{
_Draging = false;
_LastDraggedSheet = NULL;
}
// *************************************************************************** // ***************************************************************************
void CDBCtrlSheet::updateArmourColor(sint8 col) void CDBCtrlSheet::updateArmourColor(sint8 col)
{ {

@ -24,7 +24,7 @@
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
// client // client
#include "nel/gui/reflect.h" #include "nel/gui/reflect.h"
#include "ctrl_base.h" #include "ctrl_draggable.h"
#include "nel/gui/interface_expr.h" #include "nel/gui/interface_expr.h"
#include "action_handler.h" #include "action_handler.h"
#include "sphrase_manager.h" #include "sphrase_manager.h"
@ -135,7 +135,6 @@ public:
// //
bool _InterfaceColor : 1; // Color given by the interface ? bool _InterfaceColor : 1; // Color given by the interface ?
bool _Dragable : 1;
bool _UseQuantity : 1; // is the quantity read and displayed ? bool _UseQuantity : 1; // is the quantity read and displayed ?
bool _ReadQuantityFromSheet : 1; // Read quantity from sheet rather than from database bool _ReadQuantityFromSheet : 1; // Read quantity from sheet rather than from database
bool _UseQuality : 1; // is the quality read and displayed ? bool _UseQuality : 1; // is the quality read and displayed ?
@ -174,7 +173,7 @@ public:
* \author Nevrax France * \author Nevrax France
* \date 2002 * \date 2002
*/ */
class CDBCtrlSheet : public CCtrlBase, protected CCtrlSheetInfo class CDBCtrlSheet : public CCtrlDraggable, protected CCtrlSheetInfo
{ {
public: public:
DECLARE_UI_CLASS(CDBCtrlSheet) DECLARE_UI_CLASS(CDBCtrlSheet)
@ -223,15 +222,11 @@ public:
void setCanDrop (bool cd) { _CanDrop = cd; } void setCanDrop (bool cd) { _CanDrop = cd; }
bool getCanDrop () const { return _CanDrop; } bool getCanDrop () const { return _CanDrop; }
bool isDragable() { return _Dragable; }
void setDragable(bool dragable) { _Dragable = dragable; }
bool isDraging() { return _Draging; }
sint32 getDeltaDragX() {return _DeltaDragX;} sint32 getDeltaDragX() {return _DeltaDragX;}
sint32 getDeltaDragY() {return _DeltaDragY;} sint32 getDeltaDragY() {return _DeltaDragY;}
// For "oncandrag" action handlers only, which would want to avoid the drag // For "oncandrag" action handlers only, which would want to avoid the drag
void setTempCanDrag(bool cd) {_TempCanDrag= cd;} void setTempCanDrag(bool cd) {_TempCanDrag= cd;}
// called when a setCapturePointerLeft(NULL) is made for instance // called when a setCapturePointerLeft(NULL) is made for instance
void abortDraging();
CCtrlSheetInfo::TSheetType getType () const; CCtrlSheetInfo::TSheetType getType () const;
void setType (CCtrlSheetInfo::TSheetType type); void setType (CCtrlSheetInfo::TSheetType type);
@ -267,7 +262,7 @@ public:
void setSheet (const std::string &dbBranchId); void setSheet (const std::string &dbBranchId);
void setSheetFast( const std::string &dbParentBranchId, int sheetNum, int slotNum ); void setSheetFast( const std::string &dbParentBranchId, int sheetNum, int slotNum );
REFLECT_EXPORT_START(CDBCtrlSheet, CCtrlBase) REFLECT_EXPORT_START(CDBCtrlSheet, CCtrlDraggable)
REFLECT_STRING("sheet", getSheet, setSheet); REFLECT_STRING("sheet", getSheet, setSheet);
REFLECT_RGBA("color", getSheetColor, setSheetColor); REFLECT_RGBA("color", getSheetColor, setSheetColor);
REFLECT_RGBA("color1", getGuildColor1, setGuildColor1); REFLECT_RGBA("color1", getGuildColor1, setGuildColor1);
@ -275,7 +270,6 @@ public:
REFLECT_SINT32("back", getGuildBack, setGuildBack); REFLECT_SINT32("back", getGuildBack, setGuildBack);
REFLECT_SINT32("symbol", getGuildSymbol, setGuildSymbol); REFLECT_SINT32("symbol", getGuildSymbol, setGuildSymbol);
REFLECT_BOOL("invert_symbol", getInvertGuildSymbol, setInvertGuildSymbol); REFLECT_BOOL("invert_symbol", getInvertGuildSymbol, setInvertGuildSymbol);
REFLECT_BOOL("dragable", isDragable, setDragable);
REFLECT_BOOL("can_drop", getCanDrop, setCanDrop); REFLECT_BOOL("can_drop", getCanDrop, setCanDrop);
REFLECT_STRING ("left_click", getActionOnLeftClick, setActionOnLeftClick); REFLECT_STRING ("left_click", getActionOnLeftClick, setActionOnLeftClick);
REFLECT_STRING ("right_click", getActionOnRightClick, setActionOnRightClick); REFLECT_STRING ("right_click", getActionOnRightClick, setActionOnRightClick);
@ -341,7 +335,7 @@ public:
static uint getInventorySlot( const std::string &dbBranchId ); static uint getInventorySlot( const std::string &dbBranchId );
// Get the last dropped sheet. The pointer is only valid during the call of the event handler // Get the last dropped sheet. The pointer is only valid during the call of the event handler
static CDBCtrlSheet *getDraggedSheet() { return _LastDraggedSheet; } //static CDBCtrlSheet *getDraggedSheet() { return _LastDraggedSheet; }
/* Get the last selected sheet that have been draged or right clicked (should be use by menu to get their caller) /* Get the last selected sheet that have been draged or right clicked (should be use by menu to get their caller)
* It is used by the item actions like destroy, move etc.. * It is used by the item actions like destroy, move etc..
@ -649,7 +643,6 @@ protected:
/// Events /// Events
bool _Draging : 1;
bool _CanDrop : 1; bool _CanDrop : 1;
bool _Over : 1; bool _Over : 1;
@ -753,7 +746,6 @@ private:
mutable TSheetType _ActualType; mutable TSheetType _ActualType;
static CDBCtrlSheet *_CurrSelection; static CDBCtrlSheet *_CurrSelection;
static CDBCtrlSheet *_LastDraggedSheet;
static CDBCtrlSheet *_CurrMenuSheet; static CDBCtrlSheet *_CurrMenuSheet;
private: private:
void updateActualType() const; void updateActualType() const;

@ -722,7 +722,7 @@ void CDBGroupListSheet::draw ()
(CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal))) (CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal)))
{ {
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft()); CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging()) if ((pCSSrc != NULL) && pCSSrc->isDragged())
{ {
string params = string("src=") + pCSSrc->getId(); string params = string("src=") + pCSSrc->getId();
if (!_CtrlInfo._AHCanDropParams.empty()) if (!_CtrlInfo._AHCanDropParams.empty())

@ -632,7 +632,7 @@ void CDBGroupListSheetText::draw ()
(CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal))) (CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal)))
{ {
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft()); CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging()) if ((pCSSrc != NULL) && pCSSrc->isDragged())
{ {
string params = string("src=") + pCSSrc->getId(); string params = string("src=") + pCSSrc->getId();
if (!_CtrlInfo._AHCanDropParams.empty()) if (!_CtrlInfo._AHCanDropParams.empty())
@ -683,7 +683,7 @@ bool CDBGroupListSheetText::handleEvent (const NLGUI::CEventDescriptor &event)
// A button has been captured -> Transform the capture to the corresponding ctrlsheet // A button has been captured -> Transform the capture to the corresponding ctrlsheet
sint pos = getIndexOf(pCB); sint pos = getIndexOf(pCB);
if ((pos >= 0) && if ((pos >= 0) &&
_SheetChildren[pos]->Ctrl->isDragable() && (!_SheetChildren[pos]->Ctrl->getGrayed())) _SheetChildren[pos]->Ctrl->isDraggable() && (!_SheetChildren[pos]->Ctrl->getGrayed()))
{ {
pDraggedSheet = _SheetChildren[pos]->Ctrl; pDraggedSheet = _SheetChildren[pos]->Ctrl;
CWidgetManager::getInstance()->setCapturePointerLeft(pDraggedSheet); CWidgetManager::getInstance()->setCapturePointerLeft(pDraggedSheet);

@ -134,7 +134,7 @@ REGISTER_INTERFACE_USER_FCT("getSelectedItemPrice", getSelectedItemPrice)
///////////////////////////////////////////////// /////////////////////////////////////////////////
static DECLARE_INTERFACE_USER_FCT(getDraggedSheet) static DECLARE_INTERFACE_USER_FCT(getDraggedSheet)
{ {
result.setUserType(new CDBCtrlSheetPtrUserType(CDBCtrlSheet::getDraggedSheet())); result.setUserType(new CDBCtrlSheetPtrUserType( dynamic_cast< CDBCtrlSheet* >( CDBCtrlSheet::getDraggedSheet() ) ));
return true; return true;
} }
REGISTER_INTERFACE_USER_FCT("getDraggedSheet", getDraggedSheet) REGISTER_INTERFACE_USER_FCT("getDraggedSheet", getDraggedSheet)

@ -1941,7 +1941,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
if ( CWidgetManager::getInstance()->getPointer()->show()) if ( CWidgetManager::getInstance()->getPointer()->show())
{ {
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>( CWidgetManager::getInstance()->getCapturePointerLeft() ); CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>( CWidgetManager::getInstance()->getCapturePointerLeft() );
if ((pCS != NULL) && (pCS->isDraging())) if ((pCS != NULL) && (pCS->isDragged()))
{ {
sint x= CWidgetManager::getInstance()->getPointer()->getX() - pCS->getDeltaDragX(); sint x= CWidgetManager::getInstance()->getPointer()->getX() - pCS->getDeltaDragX();
sint y= CWidgetManager::getInstance()->getPointer()->getY() - pCS->getDeltaDragY(); sint y= CWidgetManager::getInstance()->getPointer()->getY() - pCS->getDeltaDragY();

@ -20,7 +20,7 @@
#include "group_in_scene.h" #include "group_in_scene.h"
#include "view_pointer.h" #include "view_pointer.h"
#include "group_editbox.h" #include "group_editbox.h"
#include "dbctrl_sheet.h" #include "ctrl_draggable.h"
CWidgetManager* CWidgetManager::instance = NULL; CWidgetManager* CWidgetManager::instance = NULL;
std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal"; std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal";
@ -1110,10 +1110,9 @@ void CWidgetManager::movePointerAbs(sint32 px, sint32 py)
void CWidgetManager::setCapturePointerLeft(CCtrlBase *c) void CWidgetManager::setCapturePointerLeft(CCtrlBase *c)
{ {
// additionally, abort any dragging // additionally, abort any dragging
if(CDBCtrlSheet::getDraggedSheet()) if( CCtrlDraggable::getDraggedSheet() != NULL )
{ CCtrlDraggable::getDraggedSheet()->abortDragging();
CDBCtrlSheet::getDraggedSheet()->abortDraging();
}
_CapturePointerLeft = c; _CapturePointerLeft = c;
notifyElementCaptured(c); notifyElementCaptured(c);
} }

Loading…
Cancel
Save