CHANGED: #1471 Moved lots of code from CInterfaceManager to CWidgetManager ( mostly code that is directly used by the widgets )

This commit is contained in:
dfighter1985 2012-06-03 03:48:31 +02:00
parent 1d8cb63fde
commit 0ad292b5a1
51 changed files with 906 additions and 887 deletions

View file

@ -1211,7 +1211,7 @@ class CHandlerEnterTell : public IActionHandler
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(pGC->getGroup("eb"));
if (eb)
{
im->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
}
}
}
@ -1419,18 +1419,18 @@ class CHandlerSwapChatMode : public IActionHandler
node->setValue32(0);
// also leave Chat Focus (important if comes from command)
if (updateCapture)
pIM->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
}
else
{
// enter chat mode (enter dont quit CB)
node->setValue32(1);
// enter Chat focus if '/c' entered
if (updateCapture && !pIM->getCaptureKeyboard())
if (updateCapture && !CWidgetManager::getInstance()->getCaptureKeyboard())
{
// reset to the old captured keyboard (should be the one that have launched the command)
if(pIM->getOldCaptureKeyboard())
pIM->setCaptureKeyboard(pIM->getOldCaptureKeyboard());
if(CWidgetManager::getInstance()->getOldCaptureKeyboard())
CWidgetManager::getInstance()->setCaptureKeyboard(CWidgetManager::getInstance()->getOldCaptureKeyboard());
}
}
}

View file

@ -5296,7 +5296,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
}
// Run the action handler
CAHManager::getInstance()->runActionHandler (mode->Action, pIM->getOldCaptureKeyboard(), finalArgs);
CAHManager::getInstance()->runActionHandler (mode->Action, CWidgetManager::getInstance()->getOldCaptureKeyboard(), finalArgs);
}
else
{

View file

@ -252,7 +252,7 @@ void checkUnderCursor()
cursor->getPointerPos(x, y);
// Over the interface ?
if (IM->getWindowUnder(x, y) == NULL)
if (CWidgetManager::getInstance()->getWindowUnder(x, y) == NULL)
{
// Is the pointer in the window ?
if(x < 0 || y <0)

View file

@ -1274,11 +1274,11 @@ void initMainLoop()
// Set the default edit box for the enter key
// if (PeopleInterraction.MainChat.Window)
// CInterfaceManager::getInstance()->setCaptureKeyboard(PeopleInterraction.MainChat.Window->getEditBox());
// CWidgetManager::getInstance()->setCaptureKeyboard(PeopleInterraction.MainChat.Window->getEditBox());
if (PeopleInterraction.ChatGroup.Window)
{
CGroupEditBox *eb= dynamic_cast<CGroupEditBox*>(PeopleInterraction.ChatGroup.Window->getEditBox());
CInterfaceManager::getInstance()->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
// For user help, set a default input string.
// NB: must do it after interface loadConfig, else it is reseted
// NB: it is reseted also on first mode switch
@ -1286,8 +1286,8 @@ void initMainLoop()
eb->setDefaultInputString(CI18N::get("uiDefaultChatInput"));
}
else
CInterfaceManager::getInstance()->setCaptureKeyboard(NULL);
CInterfaceManager::getInstance()->setCaptureKeyboard(NULL); // previous set editbox becomes '_OldCaptureKeyboard'
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL); // previous set editbox becomes '_OldCaptureKeyboard'
// Some init after connection ready sent
if(BotChatPageAll && (!ClientCfg.R2EDEnabled))

View file

@ -97,7 +97,7 @@ public:
nlwarning("<CAHSetKeyboardFocus::execute> Can't get target edit box %s, or bad type", target.c_str());
return;
}
pIM->setCaptureKeyboard(geb);
CWidgetManager::getInstance()->setCaptureKeyboard(geb);
string selectAllStr = getParam (Params, "select_all");
bool selectAll = CInterfaceElement::convertBool(selectAllStr.c_str());
if (selectAll)
@ -114,8 +114,7 @@ class CAHResetKeyboardFocus : public IActionHandler
public:
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->resetCaptureKeyboard();
CWidgetManager::getInstance()->resetCaptureKeyboard();
}
};
REGISTER_ACTION_HANDLER (CAHResetKeyboardFocus, "reset_keyboard_focus");
@ -351,7 +350,7 @@ class CAHResetInterface : public IActionHandler
}
}
pIM->checkCoords();
CWidgetManager::getInstance()->checkCoords();
CWidgetManager::getInstance()->getMasterGroup((uint8)nMasterGroup).centerAllContainers();
// Pop in and close all containers

View file

@ -115,7 +115,7 @@ protected:
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM)
{
CCtrlBase *basectrl = pIM->getCaptureKeyboard();
CCtrlBase *basectrl = CWidgetManager::getInstance()->getCaptureKeyboard();
if (basectrl)
_GroupEdit = dynamic_cast<CGroupEditBox*>(basectrl);
}

View file

@ -126,7 +126,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
editBoxLarge->setActive(true);
// Set the Keyboard focus to the editbox (after the enableModalWindow())
pIM->setCaptureKeyboard(editBoxLarge);
CWidgetManager::getInstance()->setCaptureKeyboard(editBoxLarge);
// Select all the text for easier selection
editBoxLarge->setSelectionAll();
}
@ -144,7 +144,7 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
editBoxShort->setActive(true);
// Set the Keyboard focus to the editbox (after the enableModalWindow())
pIM->setCaptureKeyboard(editBoxShort);
CWidgetManager::getInstance()->setCaptureKeyboard(editBoxShort);
// Select all the text for easier selection
editBoxShort->setSelectionAll();
}
@ -239,7 +239,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
editBoxLarge->setActive(true);
// Set the Keyboard focus to the editbox
pIM->setCaptureKeyboard(editBoxLarge);
CWidgetManager::getInstance()->setCaptureKeyboard(editBoxLarge);
// Select all the text for easier selection
editBoxLarge->setSelectionAll();
}
@ -258,7 +258,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
editBoxShort->setActive(true);
// Set the Keyboard focus to the editbox
pIM->setCaptureKeyboard(editBoxShort);
CWidgetManager::getInstance()->setCaptureKeyboard(editBoxShort);
// Select all the text for easier selection
editBoxShort->setSelectionAll();
}
@ -503,7 +503,7 @@ static void displayQuantityPopup(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCt
CWidgetManager::getInstance()->enableModalWindow(pCaller, group);
// Set the Keyboard focus to the editbox (after the enableModalWindow())
pIM->setCaptureKeyboard(editBox);
CWidgetManager::getInstance()->setCaptureKeyboard(editBox);
// Select all the text for easier selection
editBox->setSelectionAll();
}

View file

@ -169,8 +169,8 @@ class CAHUIPopup : public IActionHandler
//
pGC->popup();
//
pIM->setCapturePointerLeft(NULL);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
};
REGISTER_ACTION_HANDLER( CAHUIPopup, "popup" );
@ -204,8 +204,8 @@ class CAHUIPopin : public IActionHandler
pGC->setPopupH(pGC->getH());
//
pGC->popin();
pIM->setCapturePointerLeft(NULL);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
};
REGISTER_ACTION_HANDLER( CAHUIPopin, "popin" );
@ -535,7 +535,7 @@ class CAHTalkUntalk : public IActionHandler
CInterfaceManager *im = CInterfaceManager::getInstance();
CWidgetManager::getInstance()->setTopWindow(cw->getContainer());
cw->enableBlink(1);
im->setCaptureKeyboard(cw->getEditBox());
CWidgetManager::getInstance()->setCaptureKeyboard(cw->getEditBox());
PeopleInterraction.MainChat.Filter.setTargetPlayer(selection->getName());
}
}

View file

@ -708,7 +708,7 @@ void CActionPhraseFaber::startMpSelection(uint itemReqLine, uint mpSlot)
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(quantityModal->getGroup("eb"));
if (eb)
{
pIM->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setInputString(toString(maxQuantity));
eb->setSelectionAll();
}

View file

@ -1067,7 +1067,7 @@ void CBotChatPageTrade::setFocusOnEditBox(CInterfaceGroup *ebi)
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(ebi);
if (eb)
{
pIM->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setSelectionAll();
}
}

View file

@ -315,7 +315,7 @@ bool CChatWindow::rename(const ucstring &newName, bool newNameLocalize)
void CChatWindow::setKeyboardFocus()
{
if (!_EB || !_Chat) return;
CInterfaceManager::getInstance()->setCaptureKeyboard(_EB);
CWidgetManager::getInstance()->setCaptureKeyboard(_EB);
if (!_Chat->isOpenable() || _Chat->isOpenWhenPopup())
{
if (_Chat->isPopable() && !_Chat->isPopuped())

View file

@ -27,8 +27,7 @@ using namespace NLMISC;
// ***************************************************************************
CCtrlBase::~CCtrlBase()
{
CInterfaceManager *manager = CInterfaceManager::getInstance();
manager->removeRefOnCtrl (this);
CWidgetManager::getInstance()->removeRefOnCtrl (this);
}
// ***************************************************************************
@ -43,13 +42,13 @@ bool CCtrlBase::handleEvent(const NLGUI::CEventDescriptor &event)
{
// the mouse capture should be lost when the ctrl is hidden
CInterfaceManager *manager = CInterfaceManager::getInstance();
if (manager->getCapturePointerLeft() == this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
manager->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
}
if (manager->getCapturePointerRight() == this)
if (CWidgetManager::getInstance()->getCapturePointerRight() == this)
{
manager->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
// NB : don't call return here because derived class may be interested
// in handling event more speciffically

View file

@ -212,7 +212,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
if (pIM->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
return false;
_LeftLongClickHandled = true;
}
@ -248,7 +248,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
if (pIM->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
return false;
if (_LeftDblClickHandled) // no effect on mouse up after double click has been handled
@ -284,7 +284,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
}
*/
runLeftClickAction();
if (pIM->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example)
// Run Menu
if (!_ListMenuLeft.empty())
@ -309,7 +309,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
_LastLeftClickButton = NULL;
bool handled= false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getCapturePointerRight() != this)
if (CWidgetManager::getInstance()->getCapturePointerRight() != this)
return false;
// RunAction
@ -318,7 +318,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
handled= true;
CAHManager::getInstance()->runActionHandler (_AHOnRightClick, this, _AHRightClickParams);
}
if (pIM->getCapturePointerRight() == NULL) return true; // if this become NULL, this ctrl has been deleted
if (CWidgetManager::getInstance()->getCapturePointerRight() == NULL) return true; // if this become NULL, this ctrl has been deleted
// Run Menu
if (!_ListMenuRight .empty())
{
@ -343,7 +343,7 @@ bool CCtrlBaseButton::handleEvent (const NLGUI::CEventDescriptor& event)
}
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getCapturePointerLeft() == this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
if (!_LeftLongClickHandled)
{
@ -452,16 +452,16 @@ void CCtrlBaseButton::updateOver(bool &lastOver)
return;
}
if (pIM->getCapturePointerLeft() != NULL)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
{
if (pIM->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
{
_Over = false;
}
return;
}
const vector<CCtrlBase*> &rVB = pIM->getCtrlsUnderPointer ();
const vector<CCtrlBase*> &rVB = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
if (!_Frozen)
{

View file

@ -163,7 +163,7 @@ void CCtrlButton::draw ()
}
else
{
if ((_Over) && (pIM->getCapturePointerLeft() == this))
if ((_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this))
{
nTxId = _TextureIdPushed;
color = getCurrentColorPushed(globalColor);
@ -179,7 +179,7 @@ void CCtrlButton::draw ()
break;
case PushButton:
{
if (_Over && (pIM->getCapturePointerLeft() == this))
if (_Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this))
{
nTxId = _TextureIdPushed;
color = getCurrentColorPushed(globalColor);
@ -215,7 +215,7 @@ void CCtrlButton::draw ()
nTxId,
color );
if ((_OverWhenPushed == false) && (_Pushed == true || (pIM->getCapturePointerLeft() == this)))
if ((_OverWhenPushed == false) && (_Pushed == true || (CWidgetManager::getInstance()->getCapturePointerLeft() == this)))
return;

View file

@ -116,7 +116,7 @@ bool CCtrlColPick::handleEvent (const NLGUI::CEventDescriptor &event)
if (event.getType() == NLGUI::CEventDescriptor::mouse)
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
if ((CInterfaceManager::getInstance()->getCapturePointerLeft() != this) &&
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != this) &&
(!((eventDesc.getX() >= _XReal) &&
(eventDesc.getX() < (_XReal + _WReal))&&
(eventDesc.getY() > _YReal) &&

View file

@ -466,7 +466,7 @@ bool CCtrlScroll::handleEvent (const NLGUI::CEventDescriptor &event)
if (event.getType() == NLGUI::CEventDescriptor::mouse)
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
if ((CInterfaceManager::getInstance()->getCapturePointerLeft() != this) &&
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != this) &&
(!((eventDesc.getX() >= _XReal) &&
(eventDesc.getX() < (_XReal + _WReal))&&
(eventDesc.getY() > _YReal) &&

View file

@ -311,7 +311,7 @@ void CCtrlTextButton::draw ()
}
else
{
if ((_Over) && (pIM->getCapturePointerLeft() == this))
if ((_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this))
{
pTxId = _TextureIdPushed;
color = getCurrentColorPushed(globalColor);
@ -327,7 +327,7 @@ void CCtrlTextButton::draw ()
break;
case PushButton:
{
if (_Over && (pIM->getCapturePointerLeft() == this))
if (_Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this))
{
pTxId = _TextureIdPushed;
color = getCurrentColorPushed(globalColor);
@ -362,7 +362,7 @@ void CCtrlTextButton::draw ()
rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW+txw, y, _BmpRightW, txh, 0, false, pTxId[2], color );
// *** Draw Over
if (_Over && (_OverWhenPushed || !(_Pushed || pIM->getCapturePointerLeft() == this)))
if (_Over && (_OverWhenPushed || !(_Pushed || CWidgetManager::getInstance()->getCapturePointerLeft() == this)))
{
if ((lastOver == false) && (_AHOnOver != NULL))
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);

View file

@ -1836,7 +1836,7 @@ void CDBCtrlSheet::draw()
// Manage over for brick
if( _BrickOverable && (isMacro() || isSBrickOrSPhraseId() || isSPhrase()) )
{
const vector<CCtrlBase*> &rVB = pIM->getCtrlsUnderPointer ();
const vector<CCtrlBase*> &rVB = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
uint32 i;
for (i = 0; i < rVB.size(); ++i)
if (rVB[i] == this)
@ -1856,15 +1856,15 @@ void CDBCtrlSheet::draw()
// Drag'N'Drop : display the selected slot bitmap if this slot accept the currently dragged element
_CanDrop = false;
if (_AHOnCanDrop != NULL)
if ((pIM->getCapturePointerLeft() != NULL) && (pIM->getCapturePointerLeft() != this))
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != NULL) && (CWidgetManager::getInstance()->getCapturePointerLeft() != this))
{
if ((CWidgetManager::getInstance()->getPointer()->getX() >= _XReal) &&
(CWidgetManager::getInstance()->getPointer()->getX() < (_XReal + _WReal))&&
(CWidgetManager::getInstance()->getPointer()->getY() > _YReal) &&
(CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal)))
if (pIM->getCurrentWindowUnder() == CWidgetManager::getInstance()->getWindow(this))
if (CWidgetManager::getInstance()->getCurrentWindowUnder() == CWidgetManager::getInstance()->getWindow(this))
{
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pIM->getCapturePointerLeft());
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging())
{
string params = string("src=") + pCSSrc->getId();
@ -2602,7 +2602,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
// Handle drag'n'drop
if (pIM->getCapturePointerLeft() == this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !_Draging)
{
@ -2662,7 +2662,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
{
bool handled = false;
// get the ctrl under the drop
const vector<CCtrlBase*> &rCUP = pIM->getCtrlsUnderPointer();
const vector<CCtrlBase*> &rCUP = CWidgetManager::getInstance()->getCtrlsUnderPointer();
CDBCtrlSheet *pCSdest = NULL;
for (uint32 i = 0; i < rCUP.size(); ++i)
{
@ -2727,7 +2727,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
else // If slot not found try to drop on a list
{
// get the list under the drop
const vector<CInterfaceGroup*> &rGUP = pIM->getGroupsUnderPointer();
const vector<CInterfaceGroup*> &rGUP = CWidgetManager::getInstance()->getGroupsUnderPointer();
CDBGroupListSheet *pList = NULL;
CDBGroupListSheetText *pTextList = NULL;
for (uint32 i = 0; i < rGUP.size(); ++i)
@ -2849,7 +2849,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
return false;
// RunAction
@ -2877,7 +2877,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
{
bool handled= false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getCapturePointerRight() != this)
if (CWidgetManager::getInstance()->getCapturePointerRight() != this)
return false;
// RunAction

View file

@ -711,17 +711,17 @@ void CDBGroupListSheet::draw ()
_CanDrop = false;
if (_CtrlInfo._AHOnCanDrop != NULL)
if (pIM->getCapturePointerLeft())
if (CWidgetManager::getInstance()->getCapturePointerLeft())
{
CGroupContainer *pGC = getContainer();
if (pIM->getCurrentWindowUnder() == pGC)
if (CWidgetManager::getInstance()->getCurrentWindowUnder() == pGC)
{
if ((CWidgetManager::getInstance()->getPointer()->getX() >= _XReal) &&
(CWidgetManager::getInstance()->getPointer()->getX() < (_XReal + _WReal))&&
(CWidgetManager::getInstance()->getPointer()->getY() > _YReal) &&
(CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal)))
{
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pIM->getCapturePointerLeft());
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging())
{
string params = string("src=") + pCSSrc->getId();

View file

@ -621,17 +621,17 @@ void CDBGroupListSheetText::draw ()
_CanDrop = false;
if (_CtrlInfo._AHOnCanDrop != NULL)
if (pIM->getCapturePointerLeft())
if (CWidgetManager::getInstance()->getCapturePointerLeft())
{
CGroupContainer *pGC = getContainer();
if (pIM->getCurrentWindowUnder() == pGC)
if (CWidgetManager::getInstance()->getCurrentWindowUnder() == pGC)
{
if ((CWidgetManager::getInstance()->getPointer()->getX() >= _XReal) &&
(CWidgetManager::getInstance()->getPointer()->getX() < (_XReal + _WReal))&&
(CWidgetManager::getInstance()->getPointer()->getY() > _YReal) &&
(CWidgetManager::getInstance()->getPointer()->getY() <= (_YReal+ _HReal)))
{
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pIM->getCapturePointerLeft());
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCSSrc != NULL) && pCSSrc->isDraging())
{
string params = string("src=") + pCSSrc->getId();
@ -674,10 +674,10 @@ bool CDBGroupListSheetText::handleEvent (const NLGUI::CEventDescriptor &event)
{
// Drag'n'drop from a ctrl sheet that belongs to this list
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if ((pIM->getCapturePointerLeft() != NULL) && (pIM->getCapturePointerLeft()->getParent() == _List))
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != NULL) && (CWidgetManager::getInstance()->getCapturePointerLeft()->getParent() == _List))
{
CDBCtrlSheet *pDraggedSheet = NULL;
CCtrlButton *pCB = dynamic_cast<CCtrlButton*>(pIM->getCapturePointerLeft());
CCtrlButton *pCB = dynamic_cast<CCtrlButton*>(CWidgetManager::getInstance()->getCapturePointerLeft());
if (pCB != NULL)
{
// A button has been captured -> Transform the capture to the corresponding ctrlsheet
@ -686,7 +686,7 @@ bool CDBGroupListSheetText::handleEvent (const NLGUI::CEventDescriptor &event)
_SheetChildren[pos]->Ctrl->isDragable() && (!_SheetChildren[pos]->Ctrl->getGrayed()))
{
pDraggedSheet = _SheetChildren[pos]->Ctrl;
pIM->setCapturePointerLeft(pDraggedSheet);
CWidgetManager::getInstance()->setCapturePointerLeft(pDraggedSheet);
NLGUI::CEventDescriptorMouse newEv = eventDesc;
// Send this because not send (the captured button has processed the event mouseleftdown)
newEv.setEventTypeExtended(NLGUI::CEventDescriptorMouse::mouseleftdown);
@ -695,7 +695,7 @@ bool CDBGroupListSheetText::handleEvent (const NLGUI::CEventDescriptor &event)
}
else
{
pDraggedSheet = dynamic_cast<CDBCtrlSheet*>(pIM->getCapturePointerLeft());
pDraggedSheet = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCapturePointerLeft());
// auto scroll only if swapable
if(swapable())
{
@ -714,7 +714,7 @@ bool CDBGroupListSheetText::handleEvent (const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
sint posdst = -1,possrc = -1;
const vector<CCtrlBase*> &rV = pIM->getCtrlsUnderPointer();
const vector<CCtrlBase*> &rV = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (uint i = 0; i < rV.size(); ++i)
{
CCtrlButton *pCB = dynamic_cast<CCtrlButton*>(rV[i]);
@ -920,7 +920,7 @@ void CDBGroupListSheetText::setup()
_SheetChildren[i]->init(this, i);
}
pIM->registerClockMsgTarget(this);
CWidgetManager::getInstance()->registerClockMsgTarget(this);
}

View file

@ -175,7 +175,7 @@ bool CCtrlResizer::handleEvent (const NLGUI::CEventDescriptor &event)
if (event.getType() == NLGUI::CEventDescriptor::mouse)
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
if ((CInterfaceManager::getInstance()->getCapturePointerLeft() != this) && !isIn(eventDesc.getX(), eventDesc.getY()))
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != this) && !isIn(eventDesc.getX(), eventDesc.getY()))
return false;
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
@ -586,7 +586,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
// the ctrl must have been captured
if (pIM->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
return false;
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
@ -604,7 +604,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_WaitToOpenClose)
{
_WaitToOpenClose = false;
pIM->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
// _WaitToOpen can only be set if the container is popable
if (gc)
{
@ -642,8 +642,8 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
}
gc->invalidateCoords(2);
//
pIM->setCapturePointerLeft(NULL);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
return true;
}
@ -652,7 +652,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_WaitToOpenClose)
{
_WaitToOpenClose = false;
pIM->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
}
if (_CanOpen || gc->isOpenWhenPopup())
@ -672,7 +672,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (gc->isPopable())
{
_WaitToOpenClose = true;
pIM->registerClockMsgTarget(this);
CWidgetManager::getInstance()->registerClockMsgTarget(this);
_WaitToOpenCloseDate = T1;
}
else
@ -848,14 +848,14 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_ParentScrollingUp)
{
_ParentScrollingUp = false;
pIM->registerClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->registerClockMsgTarget(this); // want to now when time pass
}
if (glSciY > gl->getYReal()) // is there need for scroll ?
{
if (!_ParentScrollingDown)
{
_ParentScrollingDown = true;
pIM->registerClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->registerClockMsgTarget(this); // want to now when time pass
_ScrollTime = 0;
}
}
@ -864,7 +864,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_ParentScrollingDown)
{
_ParentScrollingDown = false;
pIM->unregisterClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->unregisterClockMsgTarget(this); // want to now when time pass
}
}
y = _ParentListBottom;
@ -874,7 +874,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_ParentScrollingDown)
{
_ParentScrollingDown = false;
pIM->registerClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->registerClockMsgTarget(this); // want to now when time pass
}
sint32 topY = y + _Parent->getHReal();
if (topY > _ParentListTop)
@ -885,7 +885,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (!_ParentScrollingUp)
{
_ParentScrollingUp = true;
pIM->registerClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->registerClockMsgTarget(this); // want to now when time pass
_ScrollTime = 0;
}
}
@ -894,7 +894,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
if (_ParentScrollingUp)
{
_ParentScrollingDown = false;
pIM->unregisterClockMsgTarget(this); // want to now when time pass
CWidgetManager::getInstance()->unregisterClockMsgTarget(this); // want to now when time pass
}
}
y = _ParentListTop - _Parent->getHReal();
@ -924,7 +924,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
if (!gc) return false;
_WaitToOpenClose = false;
pIM->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
// do the open action
if (gc->isOpenable() && !gc->isOpenWhenPopup())
{
@ -984,7 +984,7 @@ void CCtrlMover::handleScrolling()
else
{
_ParentScrollingUp = false;
im->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
_InsertionIndex = 0;
}
}
@ -1018,7 +1018,7 @@ void CCtrlMover::handleScrolling()
else
{
_ParentScrollingDown = false;
im->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
_InsertionIndex = gl->getNumChildren();
}
}
@ -1083,8 +1083,8 @@ void CCtrlMover::setPoped(CGroupContainer *gc, sint32 x, sint32 y, CInterfaceMan
cm->_MoveDeltaXReal= gc->getXReal() - gc->getX();
cm->_MoveDeltaYReal= gc->getYReal() - gc->getY();
cm->_Moving= true;
pIM->setCapturePointerLeft(cm);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(cm);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
// ***************************************************************************
@ -1127,8 +1127,8 @@ void CCtrlMover::setMovingInParent(CGroupContainer *gc, sint32 /* x */, sint32 y
_MoveStartY= gc->getY()-eventDesc.getY();
_MoveDeltaYReal= gc->getYReal() - gc->getY();
pIM->setCapturePointerLeft(this);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(this);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
_Moving = false;
_MovingInParentList = true;
@ -1165,7 +1165,7 @@ void CCtrlMover::stopMove(CInterfaceManager *pIM)
{
_ParentScrollingUp = false;
_ParentScrollingDown = false;
pIM->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
_HasMoved = false;
if (_Moving)
{
@ -2200,9 +2200,9 @@ void CGroupContainer::draw ()
bool dontFade = false;
// bool alphaUp = false;
// should not applied if the container is being resized
if (pIM->getCapturePointerLeft() != NULL)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
{
CInterfaceGroup *ig = pIM->getCapturePointerLeft()->getParent();
CInterfaceGroup *ig = CWidgetManager::getInstance()->getCapturePointerLeft()->getParent();
while (ig)
{
if (ig == this)
@ -2218,10 +2218,10 @@ void CGroupContainer::draw ()
bool isOver = false;
if (pIM->getCapturePointerLeft() == NULL)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL)
if (isIn(mousePointer->getX(), mousePointer->getY()))
{
CInterfaceGroup *ig = pIM->getCurrentWindowUnder();
CInterfaceGroup *ig = CWidgetManager::getInstance()->getCurrentWindowUnder();
while (ig)
{
if (ig == this)
@ -3291,8 +3291,8 @@ void CGroupContainer::popupCurrentPos()
CInterfaceManager *im = CInterfaceManager::getInstance();
im->makeWindow(this);
CWidgetManager::getInstance()->setTopWindow(this);
im->clearViewUnders();
im->clearCtrlsUnders();
CWidgetManager::getInstance()->clearViewUnders();
CWidgetManager::getInstance()->clearCtrlsUnders();
// update coords (put coords in world)
setX(getXReal());
@ -3347,8 +3347,8 @@ void CGroupContainer::popin(sint32 insertPos /* = -1 */, bool putBackInFatherCon
_MovingInParentList = false;
CInterfaceManager *im = CInterfaceManager::getInstance();
im->unMakeWindow(this);
im->clearViewUnders();
im->clearCtrlsUnders();
CWidgetManager::getInstance()->clearViewUnders();
CWidgetManager::getInstance()->clearCtrlsUnders();
_Parent = NULL;
_ParentPos = NULL;
std::vector<CGroupContainer *>::iterator it = std::find(_PopedCont.begin(), _PopedCont.end(), this);
@ -3534,8 +3534,8 @@ public:
pIC->popup();
//
CInterfaceManager *im = CInterfaceManager::getInstance();
im->setCapturePointerLeft(NULL);
im->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
};
REGISTER_ACTION_HANDLER (CICPopup, "ic_popup");
@ -3559,8 +3559,8 @@ public:
//
pIC->popin();
CInterfaceManager *im = CInterfaceManager::getInstance();
im->setCapturePointerLeft(NULL);
im->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
};
REGISTER_ACTION_HANDLER (CICPopin, "ic_popin");
@ -3664,9 +3664,9 @@ void CGroupContainer::forceRolloverAlpha()
bool CGroupContainer::hasKeyboardFocus() const
{
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im->getCaptureKeyboard() != NULL)
if (CWidgetManager::getInstance()->getCaptureKeyboard() != NULL)
{
const CGroupEditBox *geb = dynamic_cast<const CGroupEditBox *>(im->getCaptureKeyboard());
const CGroupEditBox *geb = dynamic_cast<const CGroupEditBox *>(CWidgetManager::getInstance()->getCaptureKeyboard());
if (geb)
{
const CInterfaceGroup *gr = geb->getParent();

View file

@ -96,9 +96,9 @@ CGroupEditBox::~CGroupEditBox()
{
if (this == _CurrSelection) _CurrSelection = NULL;
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im->getCaptureKeyboard() == this || im->getOldCaptureKeyboard() == this)
if (CWidgetManager::getInstance()->getCaptureKeyboard() == this || CWidgetManager::getInstance()->getOldCaptureKeyboard() == this)
{
im->resetCaptureKeyboard();
CWidgetManager::getInstance()->resetCaptureKeyboard();
}
}
@ -296,7 +296,7 @@ void CGroupEditBox::draw ()
}
// Display the cursor if needed
if (pIM->getCaptureKeyboard () == this)
if (CWidgetManager::getInstance()->getCaptureKeyboard () == this)
{
_BlinkTime += DT;
if (_BlinkTime > 0.25f)
@ -558,7 +558,7 @@ void CGroupEditBox::handleEventChar(const NLGUI::CEventDescriptorKey &rEDK)
{
case KeyESCAPE:
_CurrentHistoricIndex= -1;
CInterfaceManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
// stop selection
_CurrSelection = NULL;
_CursorAtPreviousLineEnd = false;
@ -589,7 +589,7 @@ void CGroupEditBox::handleEventChar(const NLGUI::CEventDescriptorKey &rEDK)
if (NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:ENTER_DONT_QUIT_CB")->getValue32() == 0)
{
if(_LooseFocusOnEnter)
pIM->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
}
// stop selection
_CurrSelection = NULL;
@ -720,7 +720,7 @@ void CGroupEditBox::handleEventString(const NLGUI::CEventDescriptorKey &rEDK)
bool CGroupEditBox::undo()
{
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im->getCaptureKeyboard() != this) return false;
if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false;
if (!_CanUndo) return false;
_ModifiedInputString = _InputString;
setInputString(_StartInputString);
@ -735,7 +735,7 @@ bool CGroupEditBox::undo()
bool CGroupEditBox::redo()
{
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im->getCaptureKeyboard() != this) return false;
if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false;
if (!_CanRedo) return false;
setInputString(_ModifiedInputString);
_CanUndo = true;
@ -877,9 +877,9 @@ bool CGroupEditBox::handleEvent (const NLGUI::CEventDescriptor& event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightup)
{
if (pIM->getCapturePointerRight() == this)
if (CWidgetManager::getInstance()->getCapturePointerRight() == this)
{
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
if (!_ListMenuRight.empty())
{
if (CDBCtrlSheet::getDraggedSheet() == NULL)
@ -905,7 +905,7 @@ bool CGroupEditBox::handleEvent (const NLGUI::CEventDescriptor& event)
{
_SelectingText = true;
stopParentBlink();
pIM->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCaptureKeyboard (this);
// set the right cursor position
uint newCurPos;
bool cursorAtPreviousLineEnd;
@ -945,7 +945,7 @@ bool CGroupEditBox::handleEvent (const NLGUI::CEventDescriptor& event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown)
{
pIM->setCapturePointerRight(this);
CWidgetManager::getInstance()->setCapturePointerRight(this);
return true;
}
}
@ -960,7 +960,7 @@ bool CGroupEditBox::handleEvent (const NLGUI::CEventDescriptor& event)
NLGUI::CEventDescriptorActiveCalledOnParent &activeEvent = (NLGUI::CEventDescriptorActiveCalledOnParent &) eventDesc;
if (activeEvent.getActive() == false && _ResetFocusOnHide)
{
CInterfaceManager::getInstance()->resetCaptureKeyboard();
CWidgetManager::getInstance()->resetCaptureKeyboard();
// If a selection was shown, reset it
if (_CurrSelection == this) _CurrSelection = NULL;
}
@ -1243,9 +1243,8 @@ void CGroupEditBox::setSelectionAll()
void CGroupEditBox::setActive(bool active)
{
if (!active && _ResetFocusOnHide)
{
CInterfaceManager::getInstance()->resetCaptureKeyboard();
}
CWidgetManager::getInstance()->resetCaptureKeyboard();
CInterfaceGroup::setActive(active);
}
@ -1295,7 +1294,7 @@ void CGroupEditBox::setCommand(const ucstring &command, bool execute)
}
else
{
CInterfaceManager::getInstance()->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCaptureKeyboard (this);
_CursorPos = (sint32)_InputString.length();
}
}
@ -1431,7 +1430,7 @@ void CGroupEditBox::setFocusOnText()
// else set the focus
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCaptureKeyboard (this);
_CurrSelection = this;
_SelectCursorPos= (sint32)_InputString.size();
@ -1457,8 +1456,8 @@ int CGroupEditBox::luaCancelFocusOnText(CLuaState &ls)
CLuaIHM::checkArgCount(ls, funcName, 0);
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getCaptureKeyboard()==this || pIM->getOldCaptureKeyboard()==this)
pIM->resetCaptureKeyboard();
if (CWidgetManager::getInstance()->getCaptureKeyboard()==this || CWidgetManager::getInstance()->getOldCaptureKeyboard()==this)
CWidgetManager::getInstance()->resetCaptureKeyboard();
_CurrSelection = NULL;
_SelectCursorPos= 0;
@ -1494,12 +1493,12 @@ void CGroupEditBox::setFrozen (bool state)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// stop capture and selection
pIM->setCaptureKeyboard (NULL);
CWidgetManager::getInstance()->setCaptureKeyboard (NULL);
if(_CurrSelection==this) _CurrSelection = NULL;
// do not allow to recover focus
if (pIM->getOldCaptureKeyboard() == this)
if (CWidgetManager::getInstance()->getOldCaptureKeyboard() == this)
{
pIM->resetCaptureKeyboard();
CWidgetManager::getInstance()->resetCaptureKeyboard();
}
}
}

View file

@ -241,10 +241,10 @@ public:
void release()
{
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im->getCapturePointerLeft() == this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
_Moving = false;
im->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
}
}
virtual uint getDeltaDepth() const { return 100; }
@ -281,7 +281,7 @@ public:
if (!this->isIn(eventDesc.getX(), eventDesc.getY())) return false;
_TargetGroup = getTargetGroup();
if (!_TargetGroup) return false;
im->setCapturePointerLeft(this);
CWidgetManager::getInstance()->setCapturePointerLeft(this);
_Moving = true;
_OffsetX = _TargetGroup->getW() - eventDesc.getX();
return true;
@ -292,7 +292,7 @@ public:
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousemove)
{
if (_Moving && im->getCapturePointerLeft() == this)
if (_Moving && CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
if (!_TargetGroup)
{

View file

@ -1853,7 +1853,7 @@ CGroupHTML::CGroupHTML(const TCtorParam &param)
_GroupListAdaptor = NULL;
// Register
CInterfaceManager::getInstance()->registerClockMsgTarget(this);
CWidgetManager::getInstance()->registerClockMsgTarget(this);
// HTML parameters
BgColor = CRGBA::Black;
@ -1935,7 +1935,7 @@ CGroupHTML::~CGroupHTML()
bool CGroupHTML::parse(xmlNodePtr cur,CInterfaceGroup *parentGroup)
{
nlassert(CInterfaceManager::getInstance()->isClockMsgTarget(this));
nlassert( CWidgetManager::getInstance()->isClockMsgTarget(this));
if(!CGroupScrollText::parse(cur, parentGroup))
@ -3492,8 +3492,8 @@ void CGroupHTML::removeContent ()
_GroupListAdaptor->clearGroups();
_GroupListAdaptor->clearControls();
_GroupListAdaptor->clearViews();
CInterfaceManager::getInstance()->clearViewUnders();
CInterfaceManager::getInstance()->clearCtrlsUnders();
CWidgetManager::getInstance()->clearViewUnders();
CWidgetManager::getInstance()->clearCtrlsUnders();
_Paragraph = NULL;
// Reset default background color

View file

@ -578,7 +578,7 @@ void CGroupList::draw ()
sint32 x = CWidgetManager::getInstance()->getPointer()->getX();
sint32 y = CWidgetManager::getInstance()->getPointer()->getY();
CInterfaceGroup *pIG = pIM->getWindowUnder(x, y);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x, y);
CInterfaceGroup *pParent = this;
bool bFound = false;
while (pParent != NULL)

View file

@ -126,7 +126,7 @@ static void popupLandMarkNameDialog()
eb->setInputString(ucstring());
}
im->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setSelectionAll();
}
@ -181,7 +181,7 @@ bool CGroupMap::CPolyButton::handleEvent (const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
if (im->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
return false;
// Set the map !!!
@ -198,7 +198,7 @@ bool CGroupMap::CPolyButton::handleEvent (const NLGUI::CEventDescriptor &event)
}
}
im->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
if (bFound)
Map->setMap(Map->getCurMap()->Children[i].Name);
return true;
@ -209,7 +209,7 @@ bool CGroupMap::CPolyButton::handleEvent (const NLGUI::CEventDescriptor &event)
{
if (contains(CVector2f((float)eventDesc.getX(), (float)eventDesc.getY())))
{
im->setCapturePointerLeft(this);
CWidgetManager::getInstance()->setCapturePointerLeft(this);
return true;
}
}
@ -263,7 +263,7 @@ void CGroupMap::CPolyButton::drawPolyButton()
rVR.getScreenOOSize(oow, ooh);
bool bOver = false;
const std::vector<CCtrlBase*> &rCUP = pIM->getCtrlsUnderPointer();
const std::vector<CCtrlBase*> &rCUP = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (uint32 i = 0; i < rCUP.size(); ++i)
if (rCUP[i] == this)
{
@ -1718,7 +1718,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
panEnd = eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && _Panning && _HasMoved;
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !panEnd)
{
//if (im->getCapturePointerLeft() == this)
//if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
// NB : don't test capture of mouse here, because
// some R2 tool may begin outside of this window
// example : clicking in the palette window and doing a drag-and-drop to the
@ -1736,7 +1736,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
{
if (!R2::getEditor().getCurrentTool()->getPreviousToolClickEndFlag())
{
if (im->getCapturePointerLeft() == this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() == this)
{
// unselected unless tool has been changed before last mouse left up (happens when one's finish a route using double click -> should not unselect then)
R2::getEditor().setSelectedInstance(NULL);
@ -1747,7 +1747,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
}
else if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightup)
{
if (im->getCapturePointerRight() == this)
if (CWidgetManager::getInstance()->getCapturePointerRight() == this)
{
if (isIn(eventDesc.getX(), eventDesc.getY()))
{
@ -1792,7 +1792,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
if (im->getCapturePointerLeft() != this)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
{
return false;
}
@ -1803,7 +1803,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown)
{
im->setCapturePointerRight(this);
CWidgetManager::getInstance()->setCapturePointerRight(this);
return true;
}
@ -1811,7 +1811,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
{
if (isIn(eventDesc.getX(), eventDesc.getY()))
{
im->setCapturePointerLeft(this);
CWidgetManager::getInstance()->setCapturePointerLeft(this);
_StartXForPaning = eventDesc.getX();
_StartYForPaning = eventDesc.getY();
_StartWorldOffsetForPaning = _WorldOffset;
@ -1845,7 +1845,7 @@ bool CGroupMap::handleEvent(const NLGUI::CEventDescriptor &event)
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousemove)
{
if (im->getCapturePointerLeft() != this || !_Panning)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this || !_Panning)
return CInterfaceGroup::handleEvent(event);
if (_MapTexW != 0 && _MapTexH != 0)

View file

@ -53,9 +53,9 @@ void CGroupModalGetKey::setActive (bool state)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (state == true)
pIM->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCaptureKeyboard (this);
else
pIM->setCaptureKeyboard (NULL);
CWidgetManager::getInstance()->setCaptureKeyboard (NULL);
CViewText *pVT= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId( VIEW_TEXT_KEY ));
if (pVT != NULL) pVT->setText(string(""));

View file

@ -738,7 +738,7 @@ void CGroupParagraph::checkCoords ()
if (_LastW != (sint) parentWidth)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCtrlBase *pCB = pIM->getCapturePointerLeft();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft();
if (pCB != NULL)
{
CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);
@ -778,7 +778,7 @@ void CGroupParagraph::draw ()
sint32 x = CWidgetManager::getInstance()->getPointer()->getX();
sint32 y = CWidgetManager::getInstance()->getPointer()->getY();
CInterfaceGroup *pIG = pIM->getWindowUnder(x,y);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x,y);
CInterfaceGroup *pParent = this;
bool bFound = false;
while (pParent != NULL)

View file

@ -829,7 +829,7 @@ void CCtrlTabButton::setBlink (bool b)
{
_TextColorNormalBlink = getTextColorNormal();
_TextModulateGlobalColorNormalBlink = getTextModulateGlobalColorNormal();
pIM->registerClockMsgTarget(this);
CWidgetManager::getInstance()->registerClockMsgTarget(this);
}
_Blinking = true;
}
@ -837,7 +837,7 @@ void CCtrlTabButton::setBlink (bool b)
{
if (_Blinking)
{
pIM->unregisterClockMsgTarget(this);
CWidgetManager::getInstance()->unregisterClockMsgTarget(this);
setTextColorNormal(_TextColorNormalBlink);
setTextModulateGlobalColorNormal(_TextModulateGlobalColorNormalBlink);
}

View file

@ -792,7 +792,7 @@ void CGroupTable::checkCoords ()
else
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCtrlBase *pCB = pIM->getCapturePointerLeft();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft();
if (pCB != NULL)
{
CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);

View file

@ -576,7 +576,7 @@ void CGroupTree::draw()
sint32 x = CWidgetManager::getInstance()->getPointer()->getX();
sint32 y = CWidgetManager::getInstance()->getPointer()->getY();
CInterfaceGroup *pIG = pIM->getWindowUnder(x, y);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x, y);
CInterfaceGroup *pParent = this;
bool bFound = false;
while (pParent != NULL)

View file

@ -228,7 +228,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
if(event == EventKeyDownId)
{
CEventKeyDown* downEvent=(CEventKeyDown*)&event;
if (!pIM->getCaptureKeyboard () || !EditActions.keyPushed (*downEvent))
if (!CWidgetManager::getInstance()->getCaptureKeyboard () || !EditActions.keyPushed (*downEvent))
Actions.keyPushed (*downEvent);
}
// Event from the Keyboard (UP KEYS)

View file

@ -571,8 +571,8 @@ bool CInterface3DScene::handleEvent (const NLGUI::CEventDescriptor &event)
if (event.getType() == NLGUI::CEventDescriptor::mouse)
{
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
if ((CInterfaceManager::getInstance()->getCapturePointerLeft() != this) &&
(CInterfaceManager::getInstance()->getCapturePointerRight() != this) &&
if ((CWidgetManager::getInstance()->getCapturePointerLeft() != this) &&
(CWidgetManager::getInstance()->getCapturePointerRight() != this) &&
(!((eventDesc.getX() >= _XReal) &&
(eventDesc.getX() < (_XReal + _WReal))&&
(eventDesc.getY() > _YReal) &&
@ -585,7 +585,7 @@ bool CInterface3DScene::handleEvent (const NLGUI::CEventDescriptor &event)
_MouseLDownX = eventDesc.getX();
_MouseLDownY = eventDesc.getY();
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->setCapturePointerLeft(this); // Because we are not just a control
CWidgetManager::getInstance()->setCapturePointerLeft(this); // Because we are not just a control
return true;
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
@ -599,7 +599,7 @@ bool CInterface3DScene::handleEvent (const NLGUI::CEventDescriptor &event)
_MouseRDownX = eventDesc.getX();
_MouseRDownY = eventDesc.getY();
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->setCapturePointerRight(this); // Because we are not just a control
CWidgetManager::getInstance()->setCapturePointerRight(this); // Because we are not just a control
return true;
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightup)

View file

@ -144,8 +144,7 @@ CInterfaceGroup::~CInterfaceGroup()
// initStart = ryzomGetLocalTime ();
clearControls();
// nlinfo ("%d seconds for clearControls '%s'", (uint32)(ryzomGetLocalTime ()-initStart)/1000, _Id.c_str());
CInterfaceManager *manager = CInterfaceManager::getInstance();
manager->removeRefOnGroup (this);
CWidgetManager::getInstance()->removeRefOnGroup (this);
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
// AJM DEBUG

View file

@ -377,14 +377,8 @@ CInterfaceManager::~CInterfaceManager()
void CInterfaceManager::reset()
{
CViewRenderer::getInstance()->reset();
_CtrlsUnderPointer.clear();
CWidgetManager::getInstance()->setCurContextHelp( NULL );
_ViewsUnderPointer.clear();
_GroupsUnderPointer.clear();
_CaptureKeyboard = NULL;
_OldCaptureKeyboard = NULL;
setCapturePointerLeft(NULL);
setCapturePointerRight(NULL);
CWidgetManager::getInstance()->reset();
_ActiveAnims.clear();
for (uint32 i = 0; i < _IDStringWaiters.size(); ++i)
delete _IDStringWaiters[i];
@ -1330,24 +1324,8 @@ void CInterfaceManager::updateFrameEvents()
}
}
// send clock tick msg to ctrl that are captured
NLGUI::CEventDescriptorSystem clockTick;
clockTick.setEventTypeExtended(NLGUI::CEventDescriptorSystem::clocktick);
if (_CapturePointerLeft)
{
_CapturePointerLeft->handleEvent(clockTick);
}
if (_CapturePointerRight)
{
_CapturePointerRight->handleEvent(clockTick);
}
CWidgetManager::getInstance()->sendClockTickEvent();
// and send clock tick msg to ctrl that are registered
std::vector<CCtrlBase*> clockMsgTarget = _ClockMsgTargets;
for(std::vector<CCtrlBase*>::iterator it = clockMsgTarget.begin(); it != clockMsgTarget.end(); ++it)
{
(*it)->handleEvent(clockTick);
}
IngameDbMngr.flushObserverCalls();
NLGUI::CDBManager::getInstance()->flushObserverCalls();
@ -1374,7 +1352,7 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera)
if (!camera.empty())
CViewRenderer::getInstance()->setWorldSpaceFrustum (camera.getFrustum());
checkCoords();
CWidgetManager::getInstance()->checkCoords();
drawViews(camera);
// The interface manager may change usual Global setup. reset them.
@ -1707,7 +1685,7 @@ bool CInterfaceManager::saveConfig (const string &filename)
quitVisitor.Desktop = k;
setMode(k);
visit(&quitVisitor);
checkCoords();
CWidgetManager::getInstance()->checkCoords();
}
setMode(0);
setMode(_CurrentMode);
@ -1812,106 +1790,6 @@ bool CInterfaceManager::saveConfig (const string &filename)
return true;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::checkCoords()
{
H_AUTO ( RZ_Interface_validateCoords )
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 nMasterGroup;
{
H_AUTO ( RZ_Interface_checkCoords )
// checkCoords all the windows
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
{
list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
list<CInterfaceGroup*>::const_iterator itw;
for (itw = rList.begin(); itw!= rList.end();)
{
CInterfaceGroup *pIG = *itw;
itw++; // since checkCoords invalidate the iterator, be sure we move to the next one before
if (pIG->getActive())
pIG->checkCoords ();
}
}
}
}
}
bool bRecomputeCtrlUnderPtr = false;
{
H_AUTO ( RZ_Interface_updateCoords )
// updateCoords all the needed windows
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
{
list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
list<CInterfaceGroup*>::const_iterator itw;
for (itw = rList.begin(); itw!= rList.end(); itw++)
{
CInterfaceGroup *pIG = *itw;
bool updateCoordCalled= false;
// updateCoords the window only if the master group is his parent and if need it
// do it until updateCoords() no more invalidate coordinates!!
while (pIG->getParent()==rMG.Group && (pIG->getInvalidCoords()>0))
{
bRecomputeCtrlUnderPtr = true;
// Update as many pass wanted (3 time for complex resizing, 1 for scroll for example)
uint numPass= pIG->getInvalidCoords();
// reset before updateCoords
pIG->resetInvalidCoords();
for(uint i=0;i<numPass;i++)
{
pIG->updateCoords ();
}
updateCoordCalled= true;
}
// If the group need to update pos each frame (eg: CGroupInScene),
// and updateCoords not called
if(pIG->getParent()==rMG.Group && !updateCoordCalled && pIG->isNeedFrameUpdatePos())
{
// This Group will compute the delta to apply.
pIG->onFrameUpdateWindowPos(0,0);
}
}
}
}
}
if ( CWidgetManager::getInstance()->getPointer() != NULL)
CWidgetManager::getInstance()->getPointer()->updateCoords();
}
if (bRecomputeCtrlUnderPtr)
{
H_AUTO ( RZ_Interface_RecomputeCtrlUnderPtr )
if ( CWidgetManager::getInstance()->getPointer() != NULL )
{
sint32 mx = CWidgetManager::getInstance()->getPointer()->getX();
sint32 my = CWidgetManager::getInstance()->getPointer()->getY();
getViewsUnder (mx, my, _ViewsUnderPointer);
getCtrlsUnder (mx, my, _CtrlsUnderPointer);
getGroupsUnder (mx, my, _GroupsUnderPointer);
CInterfaceGroup *ptr = getWindowUnder (mx, my);
_WindowUnder = ptr?ptr->getId():"";
}
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::drawViews(NL3D::UCamera camera)
{
@ -1924,14 +1802,14 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
NLGUI::CDBManager::getInstance()->flushObserverCalls();
// If an element has captured the keyboard, make sure it is alway visible (all parent windows active)
if (_CaptureKeyboard != NULL)
if( CWidgetManager::getInstance()->getCaptureKeyboard() != NULL)
{
CCtrlBase *cb = _CaptureKeyboard;
CCtrlBase *cb = CWidgetManager::getInstance()->getCaptureKeyboard();
do
{
if (!cb->getActive())
{
setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
break;
}
cb = cb->getParent();
@ -2062,7 +1940,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
if ( CWidgetManager::getInstance()->getPointer()->show())
{
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>((CCtrlBase*)_CapturePointerLeft);
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>( CWidgetManager::getInstance()->getCapturePointerLeft() );
if ((pCS != NULL) && (pCS->isDraging()))
{
sint x= CWidgetManager::getInstance()->getPointer()->getX() - pCS->getDeltaDragX();
@ -2107,6 +1985,7 @@ CCtrlBase* CInterfaceManager::getNewContextHelpCtrl()
// get the top most ctrl under us
CCtrlBase *best = NULL;
sint8 bestRenderLayer = -128;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (sint i = (sint32)_CtrlsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _CtrlsUnderPointer[i];
@ -2129,6 +2008,7 @@ CCtrlBase* CInterfaceManager::getNewContextHelpCtrl()
{
// if a control was not found, try with the groups
sint8 bestRenderLayer = -128;
const std::vector< CInterfaceGroup* >& _GroupsUnderPointer = CWidgetManager::getInstance()->getGroupsUnderPointer();
for (sint i = (sint32)_GroupsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _GroupsUnderPointer[i];
@ -2608,16 +2488,16 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
const NLGUI::CEventDescriptorSystem &eventDesc = reinterpret_cast< const NLGUI::CEventDescriptorSystem& >( event );
if( eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorSystem::setfocus )
{
if( _CapturePointerLeft != NULL )
if( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL )
{
_CapturePointerLeft->handleEvent( event );
setCapturePointerLeft( NULL );
CWidgetManager::getInstance()->getCapturePointerLeft()->handleEvent( event );
CWidgetManager::getInstance()->setCapturePointerLeft( NULL );
}
if( _CapturePointerRight != NULL )
if( CWidgetManager::getInstance()->getCapturePointerRight() != NULL )
{
_CapturePointerRight->handleEvent( event );
setCapturePointerRight( NULL );
CWidgetManager::getInstance()->getCapturePointerRight()->handleEvent( event );
CWidgetManager::getInstance()->setCapturePointerRight( NULL );
}
}
}
@ -2665,7 +2545,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
}
// else just disable it.
// Special case: leave the escape Key to the CaptureKeyboard .
else if(!_CaptureKeyboard )
else if(! CWidgetManager::getInstance()->getCaptureKeyboard() )
{
if(!win->getAHOnEscape().empty())
CAHManager::getInstance()->runActionHandler(win->getAHOnEscape(), win, win->getAHOnEscapeParams());
@ -2683,9 +2563,9 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if(tw && !tw->getAHOnEnter().empty())
{
// if the captured keyboard is in this Modal window, then must handle him in priority
if(_CaptureKeyboard && _CaptureKeyboard->getRootWindow()==tw)
if( CWidgetManager::getInstance()->getCaptureKeyboard() && CWidgetManager::getInstance()->getCaptureKeyboard()->getRootWindow()==tw)
{
bool result = _CaptureKeyboard->handleEvent(event);
bool result = CWidgetManager::getInstance()->getCaptureKeyboard()->handleEvent(event);
IngameDbMngr.flushObserverCalls();
NLGUI::CDBManager::getInstance()->flushObserverCalls();
return result;
@ -2699,8 +2579,8 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
}
// else the 'return' key bring back to the last edit box (if possible)
CCtrlBase *oldCapture = _OldCaptureKeyboard ? _OldCaptureKeyboard : _DefaultCaptureKeyboard;
if (_CaptureKeyboard == NULL && oldCapture && !handled)
CCtrlBase *oldCapture = CWidgetManager::getInstance()->getOldCaptureKeyboard() ? CWidgetManager::getInstance()->getOldCaptureKeyboard() : CWidgetManager::getInstance()->getDefaultCaptureKeyboard();
if ( CWidgetManager::getInstance()->getCaptureKeyboard() == NULL && oldCapture && !handled)
{
/* If the editbox does not want to recover focus, then abort. This possibility is normaly avoided
through setCaptureKeyboard() which already test getRecoverFocusOnEnter(), but it is still possible
@ -2710,10 +2590,10 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if(!dynamic_cast<CGroupEditBox*>(oldCapture) ||
dynamic_cast<CGroupEditBox*>(oldCapture)->getRecoverFocusOnEnter())
{
_CaptureKeyboard = oldCapture;
notifyElementCaptured(_CaptureKeyboard);
CWidgetManager::getInstance()->setCaptureKeyboard( oldCapture );
CWidgetManager::getInstance()->notifyElementCaptured( CWidgetManager::getInstance()->getCaptureKeyboard() );
// make sure all parent windows are active
CCtrlBase *cb = _CaptureKeyboard;
CCtrlBase *cb = CWidgetManager::getInstance()->getCaptureKeyboard();
CGroupContainer *lastContainer = NULL;
for(;;)
{
@ -2741,9 +2621,9 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
}
// General case: handle it in the Captured keyboard
if (_CaptureKeyboard != NULL && !handled)
if ( CWidgetManager::getInstance()->getCaptureKeyboard() != NULL && !handled)
{
bool result = _CaptureKeyboard->handleEvent(event);
bool result = CWidgetManager::getInstance()->getCaptureKeyboard()->handleEvent(event);
IngameDbMngr.flushObserverCalls();
NLGUI::CDBManager::getInstance()->flushObserverCalls();
return result;
@ -2773,14 +2653,15 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if( _MouseHandlingEnabled )
{
// First thing to do : Capture handling
if (_CapturePointerLeft != NULL)
handled|= _CapturePointerLeft->handleEvent(event);
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
handled|= CWidgetManager::getInstance()->getCapturePointerLeft()->handleEvent(event);
if (_CapturePointerRight != NULL && _CapturePointerRight!=_CapturePointerLeft)
handled|= _CapturePointerRight->handleEvent(event);
if ( CWidgetManager::getInstance()->getCapturePointerRight() != NULL &&
CWidgetManager::getInstance()->getCapturePointerLeft() != CWidgetManager::getInstance()->getCapturePointerRight() )
handled|= CWidgetManager::getInstance()->getCapturePointerRight()->handleEvent(event);
CInterfaceGroup *ptr = getWindowUnder (eventDesc.getX(), eventDesc.getY());
_WindowUnder = ptr?ptr->getId():"";
CInterfaceGroup *ptr = CWidgetManager::getInstance()->getWindowUnder (eventDesc.getX(), eventDesc.getY());
CWidgetManager::getInstance()->setCurrentWindowUnder( ptr );
// Any Mouse event but move disable the ContextHelp
if(eventDesc.getEventTypeExtended() != NLGUI::CEventDescriptorMouse::mousemove)
@ -2789,7 +2670,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
}
// get the group under the mouse
CInterfaceGroup *pNewCurrentWnd = _WindowUnder;
CInterfaceGroup *pNewCurrentWnd = CWidgetManager::getInstance()->getCurrentWindowUnder();
_MouseOverWindow= pNewCurrentWnd!=NULL;
@ -2833,7 +2714,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if( !CWidgetManager::getInstance()->isPreviousModal( pNewCurrentWnd ) )
pNewCurrentWnd = NULL; // can't handle event before we have left all modal windows
}
movePointer (0,0); // Reget controls under pointer
CWidgetManager::getInstance()->movePointer (0,0); // Reget controls under pointer
}
}
}
@ -2862,6 +2743,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
{
// Take the top most control.
uint nMaxDepth = 0;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--)
{
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
@ -2871,24 +2753,24 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if (d > nMaxDepth)
{
nMaxDepth = d;
_CapturePointerLeft = ctrl;
CWidgetManager::getInstance()->setCapturePointerLeft( ctrl );
}
}
}
notifyElementCaptured(_CapturePointerLeft);
CWidgetManager::getInstance()->notifyElementCaptured( CWidgetManager::getInstance()->getCapturePointerLeft() );
if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty())
{
CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, _CapturePointerLeft, clickedOutModalWindow->OnPostClickOutParams);
CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, CWidgetManager::getInstance()->getCapturePointerLeft(), clickedOutModalWindow->OnPostClickOutParams);
}
}
//if found
if (_CapturePointerLeft != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
{
// consider clicking on a control implies handling of the event.
handled= true;
// handle the capture
_CapturePointerLeft->handleEvent(event);
CWidgetManager::getInstance()->getCapturePointerLeft()->handleEvent(event);
}
}
@ -2911,6 +2793,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
// Take the top most control.
{
uint nMaxDepth = 0;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--)
{
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
@ -2920,21 +2803,21 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if (d > nMaxDepth)
{
nMaxDepth = d;
_CapturePointerRight = ctrl;
CWidgetManager::getInstance()->setCapturePointerRight( ctrl );
}
}
}
notifyElementCaptured(_CapturePointerRight);
CWidgetManager::getInstance()->notifyElementCaptured( CWidgetManager::getInstance()->getCapturePointerRight() );
if (clickedOutModalWindow && !clickedOutModalWindow->OnPostClickOut.empty())
{
CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, _CapturePointerRight, clickedOutModalWindow->OnPostClickOutParams);
CAHManager::getInstance()->runActionHandler(clickedOutModalWindow->OnPostClickOut, CWidgetManager::getInstance()->getCapturePointerRight(), clickedOutModalWindow->OnPostClickOutParams);
}
}
//if found
if (_CapturePointerRight != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerRight() != NULL)
{
// handle the capture
handled |= _CapturePointerRight->handleEvent(event);
handled |= CWidgetManager::getInstance()->getCapturePointerRight()->handleEvent(event);
}
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightup)
@ -2942,12 +2825,12 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
if (!handled)
if (pNewCurrentWnd != NULL)
pNewCurrentWnd->handleEvent(event);
if (_CapturePointerRight != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerRight() != NULL)
{
EventsListener.addUIHandledButtonMask(rightButton); // prevent 'click in scene' as mouse was previously captured
// (more a patch that anything, but 'UserControls' test for 'mouse up'
// directly later in the main loop (not through message queue), so it has no way of knowing that the event was handled...
setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
handled= true;
}
}
@ -2976,12 +2859,12 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
// Put here to let a chance to the window to handle if the capture dont
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup)
{
if (_CapturePointerLeft != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
{
EventsListener.addUIHandledButtonMask (leftButton); // prevent 'click in scene' as mouse was previously captured
// (more a patch that anything, but 'UserControls' test for 'mouse up'
// directly later in the main loop (not through message queue), so it has no way of knowing that the event was handled...
setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
//handled= true;
}
}
@ -3043,7 +2926,7 @@ bool CInterfaceManager::handleMouseMoveEvent( const NLGUI::CEventDescriptor &eve
if( ( oldX != newX ) || ( oldY != newY ) )
{
movePointerAbs( newX, newY );
CWidgetManager::getInstance()->movePointerAbs( newX, newY );
NLGUI::CEventDescriptorMouse &ve = const_cast< NLGUI::CEventDescriptorMouse& >( e );
ve.setX( CWidgetManager::getInstance()->getPointer()->getX() );
ve.setY( CWidgetManager::getInstance()->getPointer()->getY() );
@ -3052,61 +2935,6 @@ bool CInterfaceManager::handleMouseMoveEvent( const NLGUI::CEventDescriptor &eve
return true;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::movePointer (sint32 dx, sint32 dy)
{
if (!CWidgetManager::getInstance()->getPointer()) return;
CViewPointer *_Pointer = CWidgetManager::getInstance()->getPointer();
uint32 nScrW, nScrH;
sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy;
CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
_Pointer->getPointerPos (oldpx, oldpy);
olddisppx = oldpx;
olddisppy = oldpy;
newpx = oldpx + dx;
newpy = oldpy + dy;
if (newpx < 0) newpx = 0;
if (newpy < 0) newpy = 0;
if (newpx > (sint32)nScrW) newpx = nScrW;
if (newpy > (sint32)nScrH) newpy = nScrH;
dx = newpx - oldpx;
dy = newpy - oldpy;
disppx = newpx;
disppy = newpy;
_Pointer->setPointerPos (newpx, newpy);
_Pointer->setPointerDispPos (disppx, disppy);
// must get back coordinates because of snapping
sint32 mx = _Pointer->getX();
sint32 my = _Pointer->getY();
getViewsUnder (mx, my, _ViewsUnderPointer);
getCtrlsUnder (mx, my, _CtrlsUnderPointer);
getGroupsUnder (mx, my, _GroupsUnderPointer);
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::movePointerAbs(sint32 px, sint32 py)
{
if (!CWidgetManager::getInstance()->getPointer()) return;
uint32 nScrW, nScrH;
CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
clamp(px, 0, (sint32) nScrW);
clamp(py, 0, (sint32) nScrH);
//
CWidgetManager::getInstance()->getPointer()->setPointerPos (px, py);
CWidgetManager::getInstance()->getPointer()->setPointerDispPos (px, py);
//
getViewsUnder (px, py, _ViewsUnderPointer);
getCtrlsUnder (px, py, _CtrlsUnderPointer);
getGroupsUnder (px, py, _GroupsUnderPointer);
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::getNewWindowCoordToNewScreenSize(sint32 &x, sint32 &y, sint32 w, sint32 h, sint32 newScreenW, sint32 newScreenH) const
{
@ -3312,7 +3140,7 @@ void CInterfaceManager::updateAllLocalisedElements()
}
// update coords one
checkCoords();
CWidgetManager::getInstance()->checkCoords();
// Action by default (container opening
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
@ -3405,235 +3233,12 @@ void CInterfaceManager::processServerIDString()
}
}
// ------------------------------------------------------------------------------------------------
CInterfaceGroup* CInterfaceManager::getWindowUnder (sint32 x, sint32 y)
{
H_AUTO (RZ_Interface_Window_Under )
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->isWindowUnder (x, y))
return pIG;
}
}
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
CInterfaceGroup* CInterfaceManager::getGroupUnder (sint32 x, sint32 y)
{
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
if (pIG->getActive() && pIG->getUseCursor())
{
CInterfaceGroup *pIGunder = pIG->getGroupUnder (x ,y);
if (pIGunder != NULL)
return pIGunder;
}
}
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::getViewsUnder (sint32 x, sint32 y, std::vector<CViewBase*> &vVB)
{
vVB.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->getViewsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vVB))
return ;
}
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::getCtrlsUnder (sint32 x, sint32 y, std::vector<CCtrlBase*> &vICL)
{
vICL.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
{
const list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (!CWidgetManager::getInstance()->hasModal() || CWidgetManager::getInstance()->getModal().ModalWindow == pIG || CWidgetManager::getInstance()->getModal().ModalExitClickOut)
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->getCtrlsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vICL))
return;
}
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::getGroupsUnder (sint32 x, sint32 y, std::vector<CInterfaceGroup *> &vIGL)
{
vIGL.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
{
const list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (!CWidgetManager::getInstance()->hasModal() || CWidgetManager::getInstance()->getModal().ModalWindow == pIG ||
CWidgetManager::getInstance()->getModal().ModalExitClickOut)
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->isIn(x, y))
{
vIGL.push_back(pIG);
pIG->getGroupsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vIGL);
return;
}
}
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
CInterfaceElement* CInterfaceManager::getElementFromDefine (const std::string &defineId)
{
return CWidgetManager::getInstance()->getElementFromId(getDefine(defineId));
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::setCaptureKeyboard(CCtrlBase *c)
{
CGroupEditBox *oldEb= dynamic_cast<CGroupEditBox*>((CCtrlBase*)_CaptureKeyboard);
CGroupEditBox *newEb= dynamic_cast<CGroupEditBox*>(c);
if (_CaptureKeyboard && _CaptureKeyboard != c)
{
_CaptureKeyboard->onKeyboardCaptureLost();
}
// If the old capturedKeyboard is an editBox and allow recoverFocusOnEnter
if ( oldEb && oldEb->getRecoverFocusOnEnter() )
{
_OldCaptureKeyboard = _CaptureKeyboard;
}
if ( newEb )
{
CGroupEditBox::disableSelection();
if (!newEb->getAHOnFocus().empty())
{
CAHManager::getInstance()->runActionHandler(newEb->getAHOnFocus(), newEb, newEb->getAHOnFocusParams());
}
}
_CaptureKeyboard = c;
notifyElementCaptured(c);
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::resetCaptureKeyboard()
{
CCtrlBase *captureKeyboard = _CaptureKeyboard;
_OldCaptureKeyboard = NULL;
_CaptureKeyboard = NULL;
if (captureKeyboard)
{
captureKeyboard->onKeyboardCaptureLost();
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::runProcedure (const string &procName, CCtrlBase *pCaller,
const vector<string> &paramList)
@ -3967,28 +3572,6 @@ void CInterfaceManager::unMakeWindow(CInterfaceGroup *group, bool noWarning)
}
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::notifyElementCaptured(CCtrlBase *c)
{
std::set<CCtrlBase *> seen;
CCtrlBase *curr = c;
while (curr)
{
seen.insert(curr);
curr->elementCaptured(c);
curr = curr->getParent();
}
// also warn the ctrl under the pointer
for (uint i = 0; i < (uint) _CtrlsUnderPointer.size(); ++i)
{
if (!seen.count(_CtrlsUnderPointer[i]))
{
_CtrlsUnderPointer[i]->elementCaptured(c);
}
}
}
// ***************************************************************************
void CInterfaceManager::enableMouseHandling(bool handle)
{
@ -3999,15 +3582,15 @@ void CInterfaceManager::enableMouseHandling(bool handle)
return;
// If Left captured, reset
if( _CapturePointerLeft )
if( CWidgetManager::getInstance()->getCapturePointerLeft() )
{
setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
}
// Same for Right
if( _CapturePointerRight )
if( CWidgetManager::getInstance()->getCapturePointerRight() )
{
setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
}
// Avoid any problem with modals
@ -4126,36 +3709,6 @@ void CInterfaceManager::launchContextMenuInGame (const std::string &nameOfCM)
}
}
// ***************************************************************************
void CInterfaceManager::registerClockMsgTarget(CCtrlBase *vb)
{
if (!vb) return;
if (isClockMsgTarget(vb))
{
nlwarning("<CInterfaceManager::registerClockMsgTarget> Element %s is already registered", vb->getId().c_str());
return;
}
_ClockMsgTargets.push_back(vb);
}
// ***************************************************************************
void CInterfaceManager::unregisterClockMsgTarget(CCtrlBase *vb)
{
if (!vb) return;
std::vector<CCtrlBase*>::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
if (it != _ClockMsgTargets.end())
{
_ClockMsgTargets.erase(it);
}
}
// ***************************************************************************
bool CInterfaceManager::isClockMsgTarget(CCtrlBase *vb) const
{
std::vector<CCtrlBase*>::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
return it != _ClockMsgTargets.end();
}
// ***************************************************************************
void CInterfaceManager::setContentAlpha(uint8 alpha)
{
@ -4243,13 +3796,13 @@ void CInterfaceManager::setMode(uint8 newMode)
}
// check if there's a special behaviour with current captured ctrl that prevent from changing desktop
if (_CapturePointerLeft != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL)
{
if (!_CapturePointerLeft->canChangeVirtualDesktop()) return;
if (!CWidgetManager::getInstance()->getCapturePointerLeft()->canChangeVirtualDesktop()) return;
}
if (_CapturePointerRight != NULL)
if ( CWidgetManager::getInstance()->getCapturePointerRight() != NULL)
{
if (!_CapturePointerRight->canChangeVirtualDesktop()) return;
if (!CWidgetManager::getInstance()->getCapturePointerRight()->canChangeVirtualDesktop()) return;
}
@ -4258,7 +3811,7 @@ void CInterfaceManager::setMode(uint8 newMode)
//CBotChatUI::refreshActiveWindows();
_CurrentMode = newMode;
checkCoords();
CWidgetManager::getInstance()->checkCoords();
}
// ***************************************************************************
@ -4572,66 +4125,6 @@ void CInterfaceManager::restoreAllContainersBackupPosition()
}
// ***************************************************************************
void CInterfaceManager::removeRefOnCtrl (CCtrlBase *ctrlBase)
{
if ( CWidgetManager::getInstance()->getCurContextHelp() == ctrlBase)
CWidgetManager::getInstance()->setCurContextHelp( NULL );
if (getCapturePointerLeft() == ctrlBase)
setCapturePointerLeft(NULL);
if (getCapturePointerRight() == ctrlBase)
setCapturePointerRight (NULL);
if (getCaptureKeyboard() == ctrlBase)
setCaptureKeyboard(NULL);
if (getOldCaptureKeyboard() == ctrlBase)
setOldCaptureKeyboard(NULL);
if (getDefaultCaptureKeyboard() == ctrlBase)
setDefaultCaptureKeyboard(NULL);
uint i;
for (i=0; i<_CtrlsUnderPointer.size(); i++)
{
if (_CtrlsUnderPointer[i] == ctrlBase)
{
_CtrlsUnderPointer.erase (_CtrlsUnderPointer.begin()+i);
i--;
}
}
// Unregister from ClockMsgTargets
unregisterClockMsgTarget (ctrlBase);
}
// ***************************************************************************
void CInterfaceManager::removeRefOnView (CViewBase *viewBase)
{
uint i;
for (i=0; i<_ViewsUnderPointer.size(); i++)
{
if (_ViewsUnderPointer[i] == viewBase)
{
_ViewsUnderPointer.erase (_ViewsUnderPointer.begin()+i);
i--;
}
}
}
// ***************************************************************************
void CInterfaceManager::removeRefOnGroup (CInterfaceGroup *group)
{
uint i;
for (i=0; i<_GroupsUnderPointer.size(); i++)
{
if (_GroupsUnderPointer[i] == group)
{
_GroupsUnderPointer.erase (_GroupsUnderPointer.begin()+i);
i--;
}
}
}
// ***************************************************************************
uint CInterfaceManager::getUserDblClickDelay()
@ -4801,10 +4294,10 @@ NLMISC_COMMAND(loadui, "Load an interface file", "<loadui [all]/interface.xml>")
im->updateAllLocalisedElements();
// reset captures
im->setCapturePointerLeft(NULL);
im->setCapturePointerRight(NULL);
im->setOldCaptureKeyboard(NULL);
im->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setOldCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
return result;
}
@ -5144,25 +4637,6 @@ bool CInterfaceManager::testDragCopyKey()
driver->AsyncListener.isKeyDown(KeyRCONTROL);
}
// ***************************************************************************
void CInterfaceManager::setCapturePointerLeft(CCtrlBase *c)
{
// additionally, abort any dragging
if(CDBCtrlSheet::getDraggedSheet())
{
CDBCtrlSheet::getDraggedSheet()->abortDraging();
}
_CapturePointerLeft = c;
notifyElementCaptured(c);
}
// ***************************************************************************
void CInterfaceManager::setCapturePointerRight(CCtrlBase *c)
{
_CapturePointerRight = c;
notifyElementCaptured(c);
}
// ***************************************************************************
void CInterfaceManager::notifyMailAvailable()
{

View file

@ -232,18 +232,6 @@ public:
void addServerID (const std::string &sTarget, uint32 id, IStringProcess *cb = NULL);
void processServerIDString();
/**
* get the window under a spot
* \param : X coord of the spot
* \param : Y coord of the spot
* \return : pointer to the window
*/
CInterfaceGroup* getWindowUnder (sint32 x, sint32 y);
CInterfaceGroup* getCurrentWindowUnder() { return _WindowUnder; }
CInterfaceGroup* getGroupUnder (sint32 x, sint32 y);
void getViewsUnder (sint32 x, sint32 y, std::vector<CViewBase*> &vVB);
void getCtrlsUnder (sint32 x, sint32 y, std::vector<CCtrlBase*> &vICL);
void getGroupsUnder (sint32 x, sint32 y, std::vector<CInterfaceGroup*> &vIGL);
/**
* get a window from its Id of its group.
* NB: "ctrl_launch_modal" is a special Id which return the last ctrl which has launch a modal. NULL if modal closed.
@ -298,7 +286,6 @@ public:
/**
* Draw views
*/
void checkCoords();
void drawViews (NL3D::UCamera camera);
void drawAutoAdd ();
void drawContextHelp ();
@ -317,49 +304,6 @@ public:
uint8 getGlobalRolloverFactorContent() const { return _GlobalRolloverFactorContent; }
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
// Relative move of pointer
void movePointer (sint32 dx, sint32 dy);
// Set absolute coordinates of pointer
void movePointerAbs(sint32 px, sint32 py);
const std::vector<CViewBase*> &getViewsUnderPointer () { return _ViewsUnderPointer; }
const std::vector<CInterfaceGroup *> &getGroupsUnderPointer () { return _GroupsUnderPointer; }
const std::vector<CCtrlBase*> &getCtrlsUnderPointer () { return _CtrlsUnderPointer; }
//
void clearGroupsUnders() { _GroupsUnderPointer.clear(); }
void clearViewUnders() { _ViewsUnderPointer.clear(); }
void clearCtrlsUnders() { _CtrlsUnderPointer.clear(); }
// Remove all references on a view (called when the ctrl is destroyed)
void removeRefOnView (CViewBase *ctrlBase);
// Remove all references on a ctrl (called when the ctrl is destroyed)
void removeRefOnCtrl (CCtrlBase *ctrlBase);
// Remove all references on a group (called when the group is destroyed)
void removeRefOnGroup (CInterfaceGroup *group);
/**
* Capture
*/
CCtrlBase *getCapturePointerLeft() { return _CapturePointerLeft; }
CCtrlBase *getCapturePointerRight() { return _CapturePointerRight; }
CCtrlBase *getCaptureKeyboard() { return _CaptureKeyboard; }
CCtrlBase *getOldCaptureKeyboard() { return _OldCaptureKeyboard; }
CCtrlBase *getDefaultCaptureKeyboard() { return _DefaultCaptureKeyboard; }
void setCapturePointerLeft(CCtrlBase *c);
void setCapturePointerRight(CCtrlBase *c);
void setOldCaptureKeyboard(CCtrlBase *c) { _OldCaptureKeyboard = c; }
// NB: setCaptureKeyboard(NULL) has not the same effect as resetCaptureKeyboard(). it allows the capture
// to come back to the last captured window (resetCaptureKeyboard() not)
void setCaptureKeyboard(CCtrlBase *c);
void resetCaptureKeyboard();
/** Set the default box to use when no keyboard has been previously captured
* The given dialog should be static
*/
void setDefaultCaptureKeyboard(CCtrlBase *c) { _DefaultCaptureKeyboard = c; }
/// Update all the elements
void updateAllLocalisedElements ();
@ -452,19 +396,12 @@ public:
void unMakeWindow(CInterfaceGroup *group, bool noWarning=false);
// True if the keyboard is captured
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
bool isMouseOverWindow() const {return _MouseOverWindow;}
// Enable mouse Events to interface. if false, release Captures.
void enableMouseHandling(bool handle);
bool isMouseHandlingEnabled() const { return _MouseHandlingEnabled; }
// register a view that wants to be notified at each frame (receive the msg 'clocktick')
void registerClockMsgTarget(CCtrlBase *vb);
void unregisterClockMsgTarget(CCtrlBase *vb);
bool isClockMsgTarget(CCtrlBase *vb) const;
// Modes
void setMode(uint8 newMode);
uint8 getMode() const { return _CurrentMode; }
@ -784,23 +721,8 @@ private:
NLMISC::CCDBNodeLeaf *_DescTextTarget;
// Capture
NLMISC::CRefPtr<CCtrlBase> _CaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _OldCaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _DefaultCaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _CapturePointerLeft;
NLMISC::CRefPtr<CCtrlBase> _CapturePointerRight;
bool _MouseOverWindow;
// view that should be notified from clock msg
std::vector<CCtrlBase*> _ClockMsgTargets;
// What is under pointer
std::vector<CViewBase*> _ViewsUnderPointer;
std::vector<CCtrlBase*> _CtrlsUnderPointer;
std::vector<CInterfaceGroup *> _GroupsUnderPointer;
// Context Help
bool _ContextHelpActive;
//CCtrlBasePtr _CurCtrlContextHelp;
@ -829,13 +751,9 @@ private:
// List of active Anims
std::vector<CInterfaceAnim*> _ActiveAnims;
CInterfaceGroupPtr _WindowUnder;
bool isControlInWindow (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd);
uint getDepth (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd);
void notifyElementCaptured(CCtrlBase *c);
// System Options
CInterfaceOptionValue _SystemOptions[NumSystemOptions];

View file

@ -1050,7 +1050,7 @@ int CLuaIHMRyzom::setCaptureKeyboard(CLuaState &ls)
CLuaIHM::fails(ls, "%s waits a ui control as arg 1", funcName);
}
CInterfaceManager *im = CInterfaceManager::getInstance();
im->setCaptureKeyboard(ctrl);
CWidgetManager::getInstance()->setCaptureKeyboard(ctrl);
return 0;
}
@ -1061,7 +1061,7 @@ int CLuaIHMRyzom::resetCaptureKeyboard(CLuaState &ls)
const char *funcName = "resetCaptureKeyboard";
CLuaIHM::checkArgCount(ls, funcName, 0);
CInterfaceManager *im = CInterfaceManager::getInstance();
im->resetCaptureKeyboard();
CWidgetManager::getInstance()->resetCaptureKeyboard();
return 0;
}
@ -2419,7 +2419,7 @@ int CLuaIHMRyzom::getCurrentWindowUnder(CLuaState &ls)
//H_AUTO(Lua_CLuaIHM_getCurrentWindowUnder)
CLuaStackChecker lsc(&ls, 1);
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceElement *pIE= im->getCurrentWindowUnder();
CInterfaceElement *pIE= CWidgetManager::getInstance()->getCurrentWindowUnder();
if(!pIE)
{
ls.pushNil();

View file

@ -2423,7 +2423,7 @@ public:
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
if (eb)
{
im->setCaptureKeyboard(eb);
CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setInputString(ucstring(""));
}
//

View file

@ -23,8 +23,7 @@
CViewBase::~CViewBase()
{
CInterfaceManager *manager = CInterfaceManager::getInstance();
manager->removeRefOnView (this);
CWidgetManager::getInstance()->removeRefOnView (this);
}
// ***************************************************************************

View file

@ -277,7 +277,7 @@ void CViewBitmapCombo::draw()
sint32 mx = 0, my = 0;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
const std::vector<CViewBase *> &rVB = pIM->getViewsUnderPointer();
const std::vector<CViewBase *> &rVB = CWidgetManager::getInstance()->getViewsUnderPointer();
if (!CWidgetManager::getInstance()->getPointer()) return;
CWidgetManager::getInstance()->getPointer()->getPointerDispPos(mx, my);
bool over = false;

View file

@ -205,9 +205,9 @@ void CViewPointer::draw ()
_LastHightLight = NULL;
}
if (pIM->getCapturePointerLeft() != NULL && pIM->isMouseHandlingEnabled())
if ( CWidgetManager::getInstance()->getCapturePointerLeft() != NULL && pIM->isMouseHandlingEnabled())
{
CCtrlMover *pCM = dynamic_cast<CCtrlMover*>(pIM->getCapturePointerLeft());
CCtrlMover *pCM = dynamic_cast<CCtrlMover*>( CWidgetManager::getInstance()->getCapturePointerLeft());
if ((pCM != NULL) && (pCM->canMove() == true))
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer *>(pCM->getParent());
@ -239,11 +239,11 @@ void CViewPointer::draw ()
}
}
const vector<CCtrlBase *> &rICL = pIM->getCtrlsUnderPointer ();
const vector<CCtrlBase *> &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
// Draw the captured cursor
CCtrlBase *pCB = pIM->getCapturePointerLeft();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft();
if (pCB != NULL)
{
if (drawResizer(pCB,col)) return;
@ -256,7 +256,7 @@ void CViewPointer::draw ()
return;
}
const vector<CViewBase *> &vUP = pIM->getViewsUnderPointer ();
const vector<CViewBase *> &vUP = CWidgetManager::getInstance()->getViewsUnderPointer ();
for(uint i=0;i<vUP.size();i++)
{
@ -292,7 +292,7 @@ void CViewPointer::draw ()
}
// Draw if capture right
pCB = pIM->getCapturePointerRight();
pCB = CWidgetManager::getInstance()->getCapturePointerRight();
if (pCB != NULL)
{
// Is it a 3d scene ?
@ -355,7 +355,7 @@ void CViewPointer::draw ()
CGroupContainer *pGC = dynamic_cast<CGroupContainer *>(pCM->getParent());
if (pGC != NULL && !pGC->isLocked())
{
if (pIM->getCapturePointerLeft() != pCM)
if (CWidgetManager::getInstance()->getCapturePointerLeft() != pCM)
pGC->setHighLighted(true, 128);
else
pGC->setHighLighted(true, 255);
@ -373,7 +373,7 @@ void CViewPointer::draw ()
{
if (rICL.empty())
{
const vector<CInterfaceGroup *> &rIGL = pIM->getGroupsUnderPointer ();
const vector<CInterfaceGroup *> &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer ();
for (uint32 i = 0; i < rIGL.size(); ++i)
{
CInterfaceGroup *pG = rIGL[i];

View file

@ -381,7 +381,7 @@ void CViewText::checkCoords ()
else
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCtrlBase *pCB = pIM->getCapturePointerLeft();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft();
if (pCB != NULL)
{
CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);
@ -630,7 +630,7 @@ void CViewText::draw ()
if(mouseIn)
{
// check the window under the mouse is the root window
CInterfaceGroup *pIG = pIM->getWindowUnder(x,y);
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x,y);
CInterfaceElement *pParent = this;
bool bFound = false;
while (pParent != NULL)

View file

@ -19,6 +19,8 @@
#include "group_container.h"
#include "group_in_scene.h"
#include "view_pointer.h"
#include "group_editbox.h"
#include "dbctrl_sheet.h"
CWidgetManager* CWidgetManager::instance = NULL;
std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal";
@ -699,6 +701,544 @@ void CWidgetManager::popModalWindowCategory(const std::string &category)
}
}
// ------------------------------------------------------------------------------------------------
CInterfaceGroup* CWidgetManager::getWindowUnder (sint32 x, sint32 y)
{
H_AUTO (RZ_Interface_Window_Under )
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->isWindowUnder (x, y))
return pIG;
}
}
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
CInterfaceGroup* CWidgetManager::getGroupUnder (sint32 x, sint32 y)
{
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
if (pIG->getActive() && pIG->getUseCursor())
{
CInterfaceGroup *pIGunder = pIG->getGroupUnder (x ,y);
if (pIGunder != NULL)
return pIGunder;
}
}
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::getViewsUnder (sint32 x, sint32 y, std::vector<CViewBase*> &vVB)
{
vVB.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
{
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->getViewsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vVB))
return ;
}
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::getCtrlsUnder (sint32 x, sint32 y, std::vector<CCtrlBase*> &vICL)
{
vICL.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
{
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (!CWidgetManager::getInstance()->hasModal() || CWidgetManager::getInstance()->getModal().ModalWindow == pIG || CWidgetManager::getInstance()->getModal().ModalExitClickOut)
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->getCtrlsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vICL))
return;
}
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::getGroupsUnder (sint32 x, sint32 y, std::vector<CInterfaceGroup *> &vIGL)
{
vIGL.clear ();
// No Op if screen minimized
if(CViewRenderer::getInstance()->isMinimized())
return;
uint32 sw, sh;
CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
{
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
{
CInterfaceGroup *pIG = *itw;
// Accecpt if not modal clip
if (!CWidgetManager::getInstance()->hasModal() || CWidgetManager::getInstance()->getModal().ModalWindow == pIG ||
CWidgetManager::getInstance()->getModal().ModalExitClickOut)
if (pIG->getActive() && pIG->getUseCursor())
{
if (pIG->isIn(x, y))
{
vIGL.push_back(pIG);
pIG->getGroupsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vIGL);
return;
}
}
}
}
}
}
}
// ***************************************************************************
void CWidgetManager::removeRefOnView( CViewBase *viewBase )
{
uint i;
for (i=0; i<_ViewsUnderPointer.size(); i++)
{
if (_ViewsUnderPointer[i] == viewBase)
{
_ViewsUnderPointer.erase (_ViewsUnderPointer.begin()+i);
i--;
}
}
}
// ***************************************************************************
void CWidgetManager::removeRefOnCtrl(CCtrlBase *ctrlBase)
{
if ( getCurContextHelp() == ctrlBase)
setCurContextHelp( NULL );
if (getCapturePointerLeft() == ctrlBase)
setCapturePointerLeft(NULL);
if (getCapturePointerRight() == ctrlBase)
setCapturePointerRight (NULL);
if (getCaptureKeyboard() == ctrlBase)
setCaptureKeyboard(NULL);
if (getOldCaptureKeyboard() == ctrlBase)
setOldCaptureKeyboard(NULL);
if (getDefaultCaptureKeyboard() == ctrlBase)
setDefaultCaptureKeyboard(NULL);
uint i;
for (i=0; i<_CtrlsUnderPointer.size(); i++)
{
if (_CtrlsUnderPointer[i] == ctrlBase)
{
_CtrlsUnderPointer.erase (_CtrlsUnderPointer.begin()+i);
i--;
}
}
// Unregister from ClockMsgTargets
unregisterClockMsgTarget(ctrlBase);
}
// ***************************************************************************
void CWidgetManager::removeRefOnGroup (CInterfaceGroup *group)
{
uint i;
for (i=0; i<_GroupsUnderPointer.size(); i++)
{
if (_GroupsUnderPointer[i] == group)
{
_GroupsUnderPointer.erase (_GroupsUnderPointer.begin()+i);
i--;
}
}
}
void CWidgetManager::reset()
{
setCurContextHelp( NULL );
_ViewsUnderPointer.clear();
_CtrlsUnderPointer.clear();
_GroupsUnderPointer.clear();
_CaptureKeyboard = NULL;
_OldCaptureKeyboard = NULL;
setCapturePointerLeft(NULL);
setCapturePointerRight(NULL);
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::checkCoords()
{
H_AUTO ( RZ_Interface_validateCoords )
uint32 nMasterGroup;
{
H_AUTO ( RZ_Interface_checkCoords )
// checkCoords all the windows
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
{
std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
std::list<CInterfaceGroup*>::const_iterator itw;
for (itw = rList.begin(); itw!= rList.end();)
{
CInterfaceGroup *pIG = *itw;
itw++; // since checkCoords invalidate the iterator, be sure we move to the next one before
if (pIG->getActive())
pIG->checkCoords ();
}
}
}
}
}
bool bRecomputeCtrlUnderPtr = false;
{
H_AUTO ( RZ_Interface_updateCoords )
// updateCoords all the needed windows
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
{
std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
std::list<CInterfaceGroup*>::const_iterator itw;
for (itw = rList.begin(); itw!= rList.end(); itw++)
{
CInterfaceGroup *pIG = *itw;
bool updateCoordCalled= false;
// updateCoords the window only if the master group is his parent and if need it
// do it until updateCoords() no more invalidate coordinates!!
while (pIG->getParent()==rMG.Group && (pIG->getInvalidCoords()>0))
{
bRecomputeCtrlUnderPtr = true;
// Update as many pass wanted (3 time for complex resizing, 1 for scroll for example)
uint numPass= pIG->getInvalidCoords();
// reset before updateCoords
pIG->resetInvalidCoords();
for(uint i=0;i<numPass;i++)
{
pIG->updateCoords ();
}
updateCoordCalled= true;
}
// If the group need to update pos each frame (eg: CGroupInScene),
// and updateCoords not called
if(pIG->getParent()==rMG.Group && !updateCoordCalled && pIG->isNeedFrameUpdatePos())
{
// This Group will compute the delta to apply.
pIG->onFrameUpdateWindowPos(0,0);
}
}
}
}
}
if ( CWidgetManager::getInstance()->getPointer() != NULL)
CWidgetManager::getInstance()->getPointer()->updateCoords();
}
if (bRecomputeCtrlUnderPtr)
{
H_AUTO ( RZ_Interface_RecomputeCtrlUnderPtr )
if ( CWidgetManager::getInstance()->getPointer() != NULL )
{
sint32 mx = _Pointer->getX();
sint32 my = _Pointer->getY();
getViewsUnder (mx, my, _ViewsUnderPointer);
getCtrlsUnder (mx, my, _CtrlsUnderPointer);
getGroupsUnder (mx, my, _GroupsUnderPointer);
CInterfaceGroup *ptr = getWindowUnder (mx, my);
_WindowUnder = ptr;
}
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
{
if (!_Pointer)
return;
uint32 nScrW, nScrH;
sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy;
CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
_Pointer->getPointerPos (oldpx, oldpy);
olddisppx = oldpx;
olddisppy = oldpy;
newpx = oldpx + dx;
newpy = oldpy + dy;
if (newpx < 0) newpx = 0;
if (newpy < 0) newpy = 0;
if (newpx > (sint32)nScrW) newpx = nScrW;
if (newpy > (sint32)nScrH) newpy = nScrH;
dx = newpx - oldpx;
dy = newpy - oldpy;
disppx = newpx;
disppy = newpy;
_Pointer->setPointerPos (newpx, newpy);
_Pointer->setPointerDispPos (disppx, disppy);
// must get back coordinates because of snapping
sint32 mx = _Pointer->getX();
sint32 my = _Pointer->getY();
getViewsUnder (mx, my, _ViewsUnderPointer);
getCtrlsUnder (mx, my, _CtrlsUnderPointer);
getGroupsUnder (mx, my, _GroupsUnderPointer);
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::movePointerAbs(sint32 px, sint32 py)
{
if(!CWidgetManager::getInstance()->getPointer())
return;
uint32 nScrW, nScrH;
CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
NLMISC::clamp(px, 0, (sint32) nScrW);
NLMISC::clamp(py, 0, (sint32) nScrH);
//
_Pointer->setPointerPos (px, py);
_Pointer->setPointerDispPos (px, py);
//
getViewsUnder (px, py, _ViewsUnderPointer);
getCtrlsUnder (px, py, _CtrlsUnderPointer);
getGroupsUnder (px, py, _GroupsUnderPointer);
}
// ***************************************************************************
void CWidgetManager::setCapturePointerLeft(CCtrlBase *c)
{
// additionally, abort any dragging
if(CDBCtrlSheet::getDraggedSheet())
{
CDBCtrlSheet::getDraggedSheet()->abortDraging();
}
_CapturePointerLeft = c;
notifyElementCaptured(c);
}
// ***************************************************************************
void CWidgetManager::setCapturePointerRight(CCtrlBase *c)
{
_CapturePointerRight = c;
notifyElementCaptured(c);
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::setCaptureKeyboard(CCtrlBase *c)
{
CGroupEditBox *oldEb= dynamic_cast<CGroupEditBox*>((CCtrlBase*)_CaptureKeyboard);
CGroupEditBox *newEb= dynamic_cast<CGroupEditBox*>(c);
if (_CaptureKeyboard && _CaptureKeyboard != c)
{
_CaptureKeyboard->onKeyboardCaptureLost();
}
// If the old capturedKeyboard is an editBox and allow recoverFocusOnEnter
if ( oldEb && oldEb->getRecoverFocusOnEnter() )
{
_OldCaptureKeyboard = _CaptureKeyboard;
}
if ( newEb )
{
CGroupEditBox::disableSelection();
if (!newEb->getAHOnFocus().empty())
{
CAHManager::getInstance()->runActionHandler(newEb->getAHOnFocus(), newEb, newEb->getAHOnFocusParams());
}
}
_CaptureKeyboard = c;
notifyElementCaptured(c);
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::resetCaptureKeyboard()
{
CCtrlBase *captureKeyboard = _CaptureKeyboard;
_OldCaptureKeyboard = NULL;
_CaptureKeyboard = NULL;
if (captureKeyboard)
{
captureKeyboard->onKeyboardCaptureLost();
}
}
// ***************************************************************************
void CWidgetManager::registerClockMsgTarget(CCtrlBase *vb)
{
if (!vb) return;
if (isClockMsgTarget(vb))
{
nlwarning("<CInterfaceManager::registerClockMsgTarget> Element %s is already registered", vb->getId().c_str());
return;
}
_ClockMsgTargets.push_back(vb);
}
// ***************************************************************************
void CWidgetManager::unregisterClockMsgTarget(CCtrlBase *vb)
{
if (!vb) return;
std::vector<CCtrlBase*>::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
if (it != _ClockMsgTargets.end())
{
_ClockMsgTargets.erase(it);
}
}
// ***************************************************************************
bool CWidgetManager::isClockMsgTarget(CCtrlBase *vb) const
{
std::vector<CCtrlBase*>::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
return it != _ClockMsgTargets.end();
}
void CWidgetManager::sendClockTickEvent()
{
NLGUI::CEventDescriptorSystem clockTick;
clockTick.setEventTypeExtended(NLGUI::CEventDescriptorSystem::clocktick);
if (_CapturePointerLeft)
{
_CapturePointerLeft->handleEvent(clockTick);
}
if (_CapturePointerRight)
{
_CapturePointerRight->handleEvent(clockTick);
}
// and send clock tick msg to ctrl that are registered
std::vector<CCtrlBase*> clockMsgTarget = _ClockMsgTargets;
for(std::vector<CCtrlBase*>::iterator it = clockMsgTarget.begin(); it != clockMsgTarget.end(); ++it)
{
(*it)->handleEvent(clockTick);
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::notifyElementCaptured(CCtrlBase *c)
{
std::set<CCtrlBase *> seen;
CCtrlBase *curr = c;
while (curr)
{
seen.insert(curr);
curr->elementCaptured(c);
curr = curr->getParent();
}
// also warn the ctrl under the pointer
for (uint i = 0; i < (uint) _CtrlsUnderPointer.size(); ++i)
{
if (!seen.count(_CtrlsUnderPointer[i]))
{
_CtrlsUnderPointer[i]->elementCaptured(c);
}
}
}
CWidgetManager::CWidgetManager()
{

View file

@ -25,6 +25,7 @@
class CInterfaceElement;
class CCtrlBase;
class CViewBase;
class CInterfaceGroup;
class CViewPointer;
@ -186,6 +187,80 @@ public:
CViewPointer* getPointer(){ return _Pointer; }
void setPointer( CViewPointer *pointer ){ _Pointer = pointer; }
/**
* get the window under a spot
* \param : X coord of the spot
* \param : Y coord of the spot
* \return : pointer to the window
*/
CInterfaceGroup* getWindowUnder (sint32 x, sint32 y);
CInterfaceGroup* getCurrentWindowUnder() { return _WindowUnder; }
void setCurrentWindowUnder( CInterfaceGroup *group ){ _WindowUnder = group; }
CInterfaceGroup* getGroupUnder (sint32 x, sint32 y);
void getViewsUnder( sint32 x, sint32 y, std::vector< CViewBase* > &vVB );
void getCtrlsUnder( sint32 x, sint32 y, std::vector< CCtrlBase* > &vICL );
void getGroupsUnder (sint32 x, sint32 y, std::vector< CInterfaceGroup* > &vIGL );
const std::vector< CViewBase* >& getViewsUnderPointer(){ return _ViewsUnderPointer; }
const std::vector< CInterfaceGroup* >& getGroupsUnderPointer() { return _GroupsUnderPointer; }
const std::vector< CCtrlBase* >& getCtrlsUnderPointer() { return _CtrlsUnderPointer; }
//
void clearViewUnders(){ _ViewsUnderPointer.clear(); }
void clearGroupsUnders() { _GroupsUnderPointer.clear(); }
void clearCtrlsUnders() { _CtrlsUnderPointer.clear(); }
// Remove all references on a view (called when the ctrl is destroyed)
void removeRefOnView( CViewBase *ctrlBase );
// Remove all references on a ctrl (called when the ctrl is destroyed)
void removeRefOnCtrl (CCtrlBase *ctrlBase);
// Remove all references on a group (called when the group is destroyed)
void removeRefOnGroup (CInterfaceGroup *group);
void reset();
void checkCoords();
// Relative move of pointer
void movePointer (sint32 dx, sint32 dy);
// Set absolute coordinates of pointer
void movePointerAbs(sint32 px, sint32 py);
/**
* Capture
*/
CCtrlBase *getCapturePointerLeft() { return _CapturePointerLeft; }
CCtrlBase *getCapturePointerRight() { return _CapturePointerRight; }
CCtrlBase *getCaptureKeyboard() { return _CaptureKeyboard; }
CCtrlBase *getOldCaptureKeyboard() { return _OldCaptureKeyboard; }
CCtrlBase *getDefaultCaptureKeyboard() { return _DefaultCaptureKeyboard; }
void setCapturePointerLeft(CCtrlBase *c);
void setCapturePointerRight(CCtrlBase *c);
void setOldCaptureKeyboard(CCtrlBase *c){ _OldCaptureKeyboard = c; }
// NB: setCaptureKeyboard(NULL) has not the same effect as resetCaptureKeyboard(). it allows the capture
// to come back to the last captured window (resetCaptureKeyboard() not)
void setCaptureKeyboard(CCtrlBase *c);
/** Set the default box to use when no keyboard has been previously captured
* The given dialog should be static
*/
void setDefaultCaptureKeyboard(CCtrlBase *c){ _DefaultCaptureKeyboard = c; }
void resetCaptureKeyboard();
// True if the keyboard is captured
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
// register a view that wants to be notified at each frame (receive the msg 'clocktick')
void registerClockMsgTarget(CCtrlBase *vb);
void unregisterClockMsgTarget(CCtrlBase *vb);
bool isClockMsgTarget(CCtrlBase *vb) const;
void sendClockTickEvent();
void notifyElementCaptured(CCtrlBase *c);
static IParser *parser;
private:
@ -198,6 +273,23 @@ private:
static std::string _CtrlLaunchingModalId;
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
CViewPointer *_Pointer;
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
// Capture
NLMISC::CRefPtr<CCtrlBase> _CaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _OldCaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _DefaultCaptureKeyboard;
NLMISC::CRefPtr<CCtrlBase> _CapturePointerLeft;
NLMISC::CRefPtr<CCtrlBase> _CapturePointerRight;
// What is under pointer
std::vector< CViewBase* > _ViewsUnderPointer;
std::vector< CCtrlBase* > _CtrlsUnderPointer;
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
// view that should be notified from clock msg
std::vector<CCtrlBase*> _ClockMsgTargets;
};
#endif

View file

@ -1319,7 +1319,7 @@ class CAHLoginTab : public IActionHandler
if (NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->getValue32() == UI_VARIABLES_SCREEN_CHECKPASS)
{
CCtrlBase *pCB = pIM->getCaptureKeyboard();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCaptureKeyboard();
if (pCB != NULL)
{
CCtrlBase *pNewCB;
@ -1328,12 +1328,12 @@ class CAHLoginTab : public IActionHandler
pNewCB = dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD));
else
pNewCB = dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN));
pIM->setCaptureKeyboard(pNewCB);
CWidgetManager::getInstance()->setCaptureKeyboard(pNewCB);
}
}
else if (NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->getValue32() == UI_VARIABLES_SCREEN_CREATE_ACCOUNT)
{
CCtrlBase *pCB = pIM->getCaptureKeyboard();
CCtrlBase *pCB = CWidgetManager::getInstance()->getCaptureKeyboard();
if (pCB != NULL)
{
CCtrlBase *pNewCB;
@ -1346,7 +1346,7 @@ class CAHLoginTab : public IActionHandler
pNewCB = dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_EMAIL));
else
pNewCB = dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_LOGIN));
pIM->setCaptureKeyboard(pNewCB);
CWidgetManager::getInstance()->setCaptureKeyboard(pNewCB);
}
}
}

View file

@ -1388,7 +1388,7 @@ void setDefaultChatWindow(CChatWindow *defaultChatWindow)
if (defaultChatWindow->getContainer())
{
CInterfaceGroup *ig = defaultChatWindow->getContainer()->getGroup("eb");
if (ig) im->setDefaultCaptureKeyboard(ig);
if (ig) CWidgetManager::getInstance()->setDefaultCaptureKeyboard(ig);
}
}
}
@ -3010,7 +3010,7 @@ bool mainLoop()
Actions.enable(false);
EditActions.enable(false);
CInterfaceManager::getInstance()->setDefaultCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setDefaultCaptureKeyboard(NULL);
// Interface saving
CInterfaceManager::getInstance()->uninitInGame0();
@ -3115,8 +3115,8 @@ void displayDebugUIUnderMouse()
line-= 2 * lineStep;
}
//
const vector<CCtrlBase *> &rICL = pIM->getCtrlsUnderPointer ();
const vector<CInterfaceGroup *> &rIGL = pIM->getGroupsUnderPointer ();
const vector<CCtrlBase *> &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
const vector<CInterfaceGroup *> &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer ();
// If previous highlighted element is found in the list, then keep it, else reset to first element
if (std::find(rICL.begin(), rICL.end(), HighlightedDebugUI) == rICL.end() &&
std::find(rIGL.begin(), rIGL.end(), HighlightedDebugUI) == rIGL.end())
@ -3183,8 +3183,8 @@ void displayDebugUIUnderMouse()
static void getElementsUnderMouse(vector<CInterfaceElement *> &ielem)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
const vector<CCtrlBase *> &rICL = pIM->getCtrlsUnderPointer();
const vector<CInterfaceGroup *> &rIGL = pIM->getGroupsUnderPointer();
const vector<CCtrlBase *> &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer();
const vector<CInterfaceGroup *> &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer();
ielem.clear();
ielem.insert(ielem.end(), rICL.begin(), rICL.end());
ielem.insert(ielem.end(), rIGL.begin(), rIGL.end());

View file

@ -1664,8 +1664,8 @@ void CEditor::waitScenarioScreen()
//
ActionsContext.setContext("waiting_network");
TGameCycle serverTick = NetMngr.getCurrentServerTick();
getUI().setCaptureKeyboard(NULL);
getUI().setDefaultCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setDefaultCaptureKeyboard(NULL);
loadBackgroundBitmap (StartBackground);
// patch for the 'sys info that pop' prb (cause unknown for now ...)
@ -2351,9 +2351,9 @@ void CEditor::setMode(TMode mode)
_Mode = mode;
loadKeySet(getKeySetPrefix(_Mode));
CWidgetManager::getInstance()->disableModalWindow();
getUI().setCapturePointerLeft(NULL);
getUI().setCapturePointerRight(NULL);
getUI().setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
// Season is now unknown, until server force it (in test mode), or first set act set it (in edit mode)
_Season = UnknownSeason;
//
@ -7541,7 +7541,7 @@ class CAHR2Undo : public IActionHandler
virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
// if an edit box currently has focus, then try undo on it first
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(getEditor().getUI().getCaptureKeyboard());
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>( CWidgetManager::getInstance()->getCaptureKeyboard());
if (eb && eb->undo())
{
return;
@ -7570,7 +7570,7 @@ class CAHR2Redo : public IActionHandler
virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
// if an edit box currently has focus, then try redo on it first
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(getEditor().getUI().getCaptureKeyboard());
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(CWidgetManager::getInstance()->getCaptureKeyboard());
if (eb && eb->redo())
{
return;

View file

@ -186,7 +186,7 @@ sint32 CTool::getMouseY()
bool CTool::isMouseOnUI()
{
//H_AUTO(R2_CTool_isMouseOnUI)
return getUI().getWindowUnder(getMouseX(), getMouseY()) != NULL;
return CWidgetManager::getInstance()->getWindowUnder(getMouseX(), getMouseY()) != NULL;
}
@ -207,7 +207,7 @@ CGroupMap *CTool::getWorldMap()
CGroupMap *CTool::isMouseOnWorldMap()
{
//H_AUTO(R2_CTool_isMouseOnWorldMap)
const std::vector<CInterfaceGroup *> &groupsUnder = getUI().getGroupsUnderPointer();
const std::vector<CInterfaceGroup *> &groupsUnder = CWidgetManager::getInstance()->getGroupsUnderPointer();
if (groupsUnder.empty()) return NULL;
for(uint k = 0; k < groupsUnder.size(); ++k)
{
@ -221,7 +221,7 @@ CGroupMap *CTool::isMouseOnWorldMap()
CGroupContainer *CTool::isMouseOnContainer()
{
//H_AUTO(R2_CTool_isMouseOnContainer)
const std::vector<CInterfaceGroup *> &groupsUnder = getUI().getGroupsUnderPointer();
const std::vector<CInterfaceGroup *> &groupsUnder = CWidgetManager::getInstance()->getGroupsUnderPointer();
if (groupsUnder.empty()) return NULL;
for(uint k = 0; k < groupsUnder.size(); ++k)
{
@ -589,7 +589,7 @@ CInstance *CTool::checkInstanceUnderMouse(IDisplayerUIHandle **miniMapHandle /*=
IDisplayerUIHandle *bestCandidate = NULL;
sint8 bestCandidateLayer = -128;
// see if the element is under the mouse
const std::vector<CCtrlBase *> &ctrlsUnder = getUI().getCtrlsUnderPointer();
const std::vector<CCtrlBase *> &ctrlsUnder = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for(sint k = (sint)ctrlsUnder.size() - 1; k >= 0; --k)
{
IDisplayerUIHandle *handle = dynamic_cast<IDisplayerUIHandle *>(ctrlsUnder[k]);
@ -637,7 +637,7 @@ CInstance *CTool::checkInstanceUnderMouse(IDisplayerUIHandle **miniMapHandle /*=
}
}
}
else if (!IsMouseFreeLook() && !getUI().getCapturePointerLeft() && !getUI().getCapturePointerRight())
else if (!IsMouseFreeLook() && !CWidgetManager::getInstance()->getCapturePointerLeft() && !CWidgetManager::getInstance()->getCapturePointerRight())
{
// Over the screen ?
if (isInScreen(x, y))
@ -719,7 +719,7 @@ void CTool::captureMouse()
CGroupMap *gm = isMouseOnWorldMap();
if (gm)
{
getUI().setCapturePointerLeft(gm);
CWidgetManager::getInstance()->setCapturePointerLeft(gm);
}
else
{
@ -734,7 +734,7 @@ void CTool::captureMouse()
void CTool::releaseMouse()
{
//H_AUTO(R2_CTool_releaseMouse)
getUI().setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
UserControls.releaseMouse();
getUI().enableMouseHandling(true);
getUI().setContextHelpActive(true);

View file

@ -93,7 +93,7 @@ void CToolCreateEntity::updateInvalidCursorOnUI()
{
//H_AUTO(R2_CToolCreateEntity_updateInvalidCursorOnUI)
// set the default cursor unless the mouse is on the palette
const std::vector<CInterfaceGroup *> &groups = getUI().getGroupsUnderPointer();
const std::vector<CInterfaceGroup *> &groups = CWidgetManager::getInstance()->getGroupsUnderPointer();
for(uint k = 0; k < groups.size(); ++k)
{
if (groups[k]->getId() == "ui:interface:r2ed_palette") // hardcoded for now ...

View file

@ -175,7 +175,7 @@ bool CToolMaintainedAction::onMouseLeftButtonClicked()
CGroupMap *gm = CTool::isMouseOnWorldMap();
if (gm)
{
if (getUI().getCapturePointerLeft())
if (CWidgetManager::getInstance()->getCapturePointerLeft())
{
return false;
}

View file

@ -242,9 +242,9 @@ void releaseMainLoopReselect()
EditActions.releaseAllKeyNoRunning();
Actions.releaseAllKeyNoRunning();
pIM->removeAllTemplates();
pIM->setCaptureKeyboard(NULL);
pIM->setCapturePointerLeft(NULL);
pIM->setCapturePointerRight(NULL);
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);
// Yoyo: Don't release attack list manager, because I think it only owns static data (and 3D data created from Driver, not Scenes)
// Note that in initMainLoop(), CAttackListManager::getInstance().init() will do nothing (since already created and not released here)