2012-05-30 00:12:37 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2012-06-08 00:43:20 +00:00
|
|
|
#include "nel/gui/db_manager.h"
|
2012-06-07 22:28:47 +00:00
|
|
|
#include "nel/gui/view_renderer.h"
|
2012-06-08 23:37:43 +00:00
|
|
|
#include "nel/gui/widget_manager.h"
|
|
|
|
#include "nel/gui/view_pointer_base.h"
|
|
|
|
#include "nel/gui/ctrl_draggable.h"
|
|
|
|
#include "nel/gui/interface_group.h"
|
|
|
|
#include "nel/gui/group_container_base.h"
|
|
|
|
#include "nel/gui/group_modal.h"
|
|
|
|
#include "nel/gui/group_editbox_base.h"
|
|
|
|
#include "nel/gui/interface_options.h"
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-28 09:06:36 +00:00
|
|
|
namespace NLGUI
|
|
|
|
{
|
|
|
|
void LinkHack();
|
|
|
|
}
|
|
|
|
|
2012-06-15 20:40:08 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
const uint DOUBLE_CLICK_MIN = 50;
|
|
|
|
const uint DOUBLE_CLICK_MAX = 750;
|
2012-06-23 04:24:09 +00:00
|
|
|
const float ROLLOVER_MIN_DELTA_PER_MS = 0.28f;
|
|
|
|
const float ROLLOVER_MAX_DELTA_PER_MS = 0.12f;
|
2012-06-28 09:06:36 +00:00
|
|
|
|
|
|
|
void Hack()
|
|
|
|
{
|
|
|
|
NLGUI::LinkHack();
|
|
|
|
}
|
2012-06-15 20:40:08 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
namespace NLGUI
|
|
|
|
{
|
|
|
|
CWidgetManager* CWidgetManager::instance = NULL;
|
|
|
|
std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal";
|
|
|
|
IParser* CWidgetManager::parser = NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// SMasterGroup
|
|
|
|
// ----------------------------------------------------------------------------
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::addWindow(CInterfaceGroup *pIG, uint8 nPrio)
|
|
|
|
{
|
|
|
|
nlassert(nPrio<WIN_PRIORITY_MAX);
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Priority WIN_PRIORITY_WORLD_SPACE is only for CGroupInScene !
|
|
|
|
// Add this group in another priority list
|
|
|
|
nlassert ((nPrio!=WIN_PRIORITY_MAX) || pIG->isGroupInScene() );
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
|
|
|
{
|
|
|
|
// If the element already exists in the list return !
|
|
|
|
if (*it == pIG)
|
|
|
|
return;
|
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
PrioritizedWindows[nPrio].push_back(pIG);
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::delWindow(CInterfaceGroup *pIG)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if ((*it) == pIG)
|
|
|
|
{
|
|
|
|
PrioritizedWindows[i].erase(it);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
it++;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::SMasterGroup::getWindowFromId(const std::string &winID)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
|
|
|
{
|
|
|
|
if ((*it)->getId() == winID)
|
|
|
|
return *it;
|
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool CWidgetManager::SMasterGroup::isWindowPresent(CInterfaceGroup *pIG)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
|
|
|
{
|
|
|
|
if ((*it) == pIG)
|
|
|
|
return true;
|
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return false;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Set a window top in its priority queue
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::setTopWindow(CInterfaceGroup *pIG)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (*it == pIG)
|
|
|
|
{
|
|
|
|
PrioritizedWindows[i].erase(it);
|
|
|
|
PrioritizedWindows[i].push_back(pIG);
|
|
|
|
LastTopWindowPriority= i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
it++;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
// todo hulud interface syntax error
|
|
|
|
nlwarning("window %s do not exist in a priority list", pIG->getId().c_str());
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::setBackWindow(CInterfaceGroup *pIG)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (*it == pIG)
|
|
|
|
{
|
|
|
|
PrioritizedWindows[i].erase(it);
|
|
|
|
PrioritizedWindows[i].push_front(pIG);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
it++;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
// todo hulud interface syntax error
|
|
|
|
nlwarning("window %s do not exist in a priority list", pIG->getId().c_str());
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::deactiveAllContainers()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::vector<CGroupContainerBase*> gcs;
|
|
|
|
|
|
|
|
// Make first a list of all window (Warning: all group container are not window!)
|
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
|
|
|
{
|
|
|
|
CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
|
|
|
|
if (pGC != NULL)
|
|
|
|
gcs.push_back(pGC);
|
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Then hide them. Must do this in 2 times, because setActive(false) change PrioritizedWindows,
|
|
|
|
// and hence invalidate its.
|
|
|
|
for (uint32 i = 0; i < gcs.size(); ++i)
|
|
|
|
{
|
|
|
|
gcs[i]->setActive(false);
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::centerAllContainers()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
|
|
|
|
if ((pGC != NULL) && (pGC->getParent() != NULL))
|
|
|
|
{
|
|
|
|
sint32 wParent = pGC->getParent()->getW(false);
|
|
|
|
sint32 w = pGC->getW(false);
|
|
|
|
pGC->setXAndInvalidateCoords((wParent - w) / 2);
|
|
|
|
sint32 hParent = pGC->getParent()->getH(false);
|
|
|
|
sint32 h = pGC->getH(false);
|
|
|
|
pGC->setYAndInvalidateCoords(h+(hParent - h) / 2);
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::SMasterGroup::unlockAllContainers()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 i = 0; i < WIN_PRIORITY_MAX; ++i)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[i].begin();
|
|
|
|
while (it != PrioritizedWindows[i].end())
|
|
|
|
{
|
|
|
|
CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(*it);
|
|
|
|
if (pGC != NULL)
|
|
|
|
pGC->setLocked(false);
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
class CElementToSort
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
public:
|
|
|
|
CInterfaceGroup *pIG;
|
|
|
|
float Distance;
|
|
|
|
bool operator< (const CElementToSort& other) const
|
|
|
|
{
|
|
|
|
// We want first farest views
|
|
|
|
return Distance > other.Distance;
|
|
|
|
}
|
|
|
|
};
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::SMasterGroup::sortWorldSpaceGroup ()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
static std::vector<CElementToSort> sortTable;
|
|
|
|
sortTable.clear ();
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Fill the sort table
|
|
|
|
std::list<CInterfaceGroup*>::iterator it = PrioritizedWindows[WIN_PRIORITY_WORLD_SPACE].begin();
|
|
|
|
while (it != PrioritizedWindows[WIN_PRIORITY_WORLD_SPACE].end())
|
|
|
|
{
|
|
|
|
sortTable.push_back (CElementToSort ());
|
|
|
|
CElementToSort &elm = sortTable.back();
|
|
|
|
elm.pIG = *it;
|
|
|
|
elm.Distance = (*it)->getDepthForZSort();
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
it++;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Sort the table
|
|
|
|
std::sort (sortTable.begin(), sortTable.end());
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Fill the final table
|
|
|
|
uint i = 0;
|
|
|
|
it = PrioritizedWindows[WIN_PRIORITY_WORLD_SPACE].begin();
|
|
|
|
while (it != PrioritizedWindows[WIN_PRIORITY_WORLD_SPACE].end())
|
|
|
|
{
|
|
|
|
*it = sortTable[i].pIG;
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
it++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager* CWidgetManager::getInstance()
|
|
|
|
{
|
|
|
|
if( instance == NULL )
|
|
|
|
instance = new CWidgetManager;
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
return instance;
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::release()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
delete instance;
|
|
|
|
instance = NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getMasterGroupFromId (const std::string &MasterGroupName)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
|
|
|
{
|
|
|
|
if (_MasterGroups[i].Group->getId() == MasterGroupName)
|
|
|
|
return _MasterGroups[i].Group;
|
|
|
|
}
|
|
|
|
return NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getWindowFromId (const std::string & groupId)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
CInterfaceGroup *pIG = rMG.getWindowFromId(groupId);
|
|
|
|
if (pIG != NULL)
|
|
|
|
return pIG;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::addWindowToMasterGroup (const std::string &sMasterGroupName, CInterfaceGroup *pIG)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// Warning this function is not smart : its a o(n) !
|
|
|
|
if (pIG == NULL) return;
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); ++nMasterGroup)
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getId() == sMasterGroupName)
|
|
|
|
{
|
|
|
|
rMG.addWindow(pIG, pIG->getPriority());
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::removeWindowFromMasterGroup(const std::string &sMasterGroupName,CInterfaceGroup *pIG)
|
|
|
|
{
|
|
|
|
// Warning this function is not smart : its a o(n) !
|
|
|
|
if (pIG == NULL) return;
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); ++nMasterGroup)
|
|
|
|
{
|
|
|
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getId() == sMasterGroupName)
|
|
|
|
{
|
|
|
|
rMG.delWindow(pIG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void unlinkAllContainers (CInterfaceGroup *pIG)
|
|
|
|
{
|
|
|
|
const std::vector<CInterfaceGroup*> &rG = pIG->getGroups();
|
|
|
|
for(uint i = 0; i < rG.size(); ++i)
|
|
|
|
unlinkAllContainers (rG[i]);
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CGroupContainerBase *pGC = dynamic_cast<CGroupContainerBase*>(pIG);
|
|
|
|
if (pGC != NULL)
|
|
|
|
pGC->removeAllContainers();
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::removeAllMasterGroups()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
uint i;
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
for (i = 0; i < _MasterGroups.size(); ++i)
|
|
|
|
unlinkAllContainers (_MasterGroups[i].Group);
|
|
|
|
|
|
|
|
// Yoyo: important to not Leave NULL in the array, because of CGroupHTML and LibWWW callback
|
|
|
|
// that may call CInterfaceManager::getElementFromId() (and this method hates having NULL in the arrays ^^)
|
|
|
|
while(!_MasterGroups.empty())
|
|
|
|
{
|
|
|
|
delete _MasterGroups.back().Group;
|
|
|
|
_MasterGroups.pop_back();
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::activateMasterGroup (const std::string &sMasterGroupName, bool bActive)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getMasterGroupFromId (sMasterGroupName);
|
|
|
|
if (pIG != NULL)
|
|
|
|
{
|
|
|
|
pIG->setActive(bActive);
|
|
|
|
pIG->invalidateCoords();
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getWindow(CInterfaceElement *pIE)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *pIG = pIE->getParent();
|
|
|
|
if (pIG == NULL) return NULL;
|
|
|
|
if (pIG->getParent() == NULL) return NULL;
|
|
|
|
while (pIG->getParent()->getParent() != NULL)
|
|
|
|
{
|
|
|
|
pIG = pIG->getParent();
|
|
|
|
}
|
|
|
|
return pIG;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceElement* CWidgetManager::getElementFromId (const std::string &sEltId)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// System special
|
|
|
|
if(sEltId == _CtrlLaunchingModalId)
|
|
|
|
return getCtrlLaunchingModal();
|
2012-05-31 02:27:27 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Search for all elements
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
CInterfaceElement *pIEL = rMG.Group->getElement (sEltId);
|
2012-05-31 02:27:27 +00:00
|
|
|
if (pIEL != NULL)
|
|
|
|
return pIEL;
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceElement* CWidgetManager::getElementFromId (const std::string &sStart, const std::string &sEltId)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceElement *pIEL = getElementFromId (sEltId);
|
|
|
|
if (pIEL == NULL)
|
|
|
|
{
|
|
|
|
std::string sZeStart = sStart, sTmp;
|
|
|
|
if (sZeStart[sZeStart.size()-1] == ':')
|
|
|
|
sZeStart = sZeStart.substr(0, sZeStart.size()-1);
|
|
|
|
|
|
|
|
while (sZeStart != "")
|
|
|
|
{
|
|
|
|
if (sEltId[0] == ':')
|
|
|
|
sTmp = sZeStart + sEltId;
|
|
|
|
else
|
|
|
|
sTmp = sZeStart + ":" + sEltId;
|
|
|
|
pIEL = getElementFromId (sTmp);
|
|
|
|
if (pIEL != NULL)
|
|
|
|
return pIEL;
|
|
|
|
std::string::size_type nextPos = sZeStart.rfind(':');
|
|
|
|
if (nextPos == std::string::npos) break;
|
|
|
|
sZeStart = sZeStart.substr(0, nextPos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pIEL;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::setTopWindow (CInterfaceGroup* win)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
//find the window in the window list
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
|
|
|
{
|
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
|
|
|
rMG.setTopWindow(win);
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::setBackWindow(CInterfaceGroup* win)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
|
|
|
rMG.setBackWindow(win);
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getTopWindow (uint8 nPriority) const
|
|
|
|
{
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
|
|
|
{
|
|
|
|
const CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
|
|
|
{
|
|
|
|
// return the first.
|
|
|
|
if(rMG.PrioritizedWindows[nPriority].empty())
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return rMG.PrioritizedWindows[nPriority].back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getBackWindow (uint8 nPriority) const
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
|
|
|
{
|
|
|
|
// return the first.
|
|
|
|
if(rMG.PrioritizedWindows[nPriority].empty())
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return rMG.PrioritizedWindows[nPriority].front();
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
CInterfaceGroup* CWidgetManager::getLastEscapableTopWindow() const
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator it;
|
|
|
|
it= rList.rbegin();
|
|
|
|
for(;it!=rList.rend();it++)
|
|
|
|
{
|
|
|
|
if((*it)->getActive() && (*it)->getEscapable())
|
|
|
|
return *it;
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::setWindowPriority (CInterfaceGroup *pWin, uint8 nNewPriority)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (rMG.isWindowPresent(pWin))
|
|
|
|
{
|
|
|
|
rMG.delWindow(pWin);
|
|
|
|
rMG.addWindow(pWin, nNewPriority);
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
uint8 CWidgetManager::getLastTopWindowPriority() const
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
|
|
|
{
|
|
|
|
return rMG.LastTopWindowPriority;
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return 0;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
bool CWidgetManager::hasModal() const
|
|
|
|
{
|
|
|
|
if( !_ModalStack.empty() )
|
2012-05-31 02:27:27 +00:00
|
|
|
return true;
|
2012-06-09 01:57:40 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SModalWndInfo& CWidgetManager::getModal()
|
|
|
|
{
|
|
|
|
return _ModalStack.back();
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
bool CWidgetManager::isPreviousModal( CInterfaceGroup *wnd ) const
|
|
|
|
{
|
|
|
|
std::vector< SModalWndInfo >::size_type s = _ModalStack.size();
|
|
|
|
for( std::vector< SModalWndInfo >::size_type i = 0; i < s; i++ )
|
|
|
|
if( _ModalStack[ i ].ModalWindow == wnd )
|
|
|
|
return true;
|
2012-05-31 02:27:27 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::enableModalWindow (CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// disable any modal before. release keyboard
|
|
|
|
disableModalWindow();
|
|
|
|
pushModalWindow(ctrlLaunchingModal, pIG);
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::enableModalWindow (CCtrlBase *CtrlLaunchingModal, const std::string &groupName)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *group= dynamic_cast<CGroupModal*>( getElementFromId(groupName) );
|
|
|
|
if(group)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// enable the modal
|
|
|
|
enableModalWindow(CtrlLaunchingModal, group);
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::disableModalWindow ()
|
|
|
|
{
|
|
|
|
while (!_ModalStack.empty())
|
|
|
|
{
|
|
|
|
SModalWndInfo winInfo = _ModalStack.back();
|
|
|
|
_ModalStack.pop_back(); // must pop back as early as possible because 'setActive' may trigger another 'popModalWindow', leading to a crash
|
|
|
|
// disable old modal window
|
|
|
|
if(winInfo.ModalWindow)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
setBackWindow(winInfo.ModalWindow);
|
|
|
|
winInfo.ModalWindow->setActive(false);
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// disable any context help
|
|
|
|
setCurContextHelp( NULL );
|
|
|
|
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp = 0;
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::pushModalWindow(CCtrlBase *ctrlLaunchingModal, CInterfaceGroup *pIG)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// enable the wanted modal
|
|
|
|
if(pIG)
|
|
|
|
{
|
|
|
|
SModalWndInfo mwi;
|
|
|
|
mwi.ModalWindow = pIG;
|
|
|
|
mwi.CtrlLaunchingModal = ctrlLaunchingModal;
|
|
|
|
// setup special group
|
|
|
|
CGroupModal *groupModal= dynamic_cast<CGroupModal*>(pIG);
|
|
|
|
if(groupModal)
|
|
|
|
{
|
|
|
|
mwi.ModalExitClickOut = groupModal->ExitClickOut;
|
|
|
|
mwi.ModalExitClickL = groupModal->ExitClickL;
|
|
|
|
mwi.ModalExitClickR = groupModal->ExitClickR;
|
|
|
|
mwi.ModalHandlerClickOut = groupModal->OnClickOut;
|
|
|
|
mwi.ModalClickOutParams = groupModal->OnClickOutParams;
|
|
|
|
mwi.ModalExitKeyPushed = groupModal->ExitKeyPushed;
|
|
|
|
// update coords of the modal
|
|
|
|
if(groupModal->SpawnOnMousePos)
|
|
|
|
{
|
|
|
|
groupModal->SpawnMouseX = _Pointer->getX();
|
|
|
|
groupModal->SpawnMouseY = _Pointer->getY();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// default for group not modal. Backward compatibility
|
|
|
|
mwi.ModalExitClickOut = false;
|
|
|
|
mwi.ModalExitClickL = false;
|
|
|
|
mwi.ModalExitClickR = false;
|
|
|
|
mwi.ModalExitKeyPushed = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ModalStack.push_back(mwi);
|
|
|
|
|
|
|
|
// update coords and activate the modal
|
|
|
|
mwi.ModalWindow->invalidateCoords();
|
|
|
|
mwi.ModalWindow->setActive(true);
|
|
|
|
setTopWindow(mwi.ModalWindow);
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::pushModalWindow(CCtrlBase *ctrlLaunchingModal, const std::string &groupName)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *group= dynamic_cast<CGroupModal*>( getElementFromId(groupName) );
|
|
|
|
if(group)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// enable the modal
|
|
|
|
enableModalWindow(ctrlLaunchingModal, group);
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::popModalWindow()
|
|
|
|
{
|
2012-05-31 02:27:27 +00:00
|
|
|
if (!_ModalStack.empty())
|
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
SModalWndInfo winInfo = _ModalStack.back();
|
|
|
|
_ModalStack.pop_back(); // must pop back as early as possible because 'setActive' may trigger another 'popModalWindow', leading to a crash
|
|
|
|
if(winInfo.ModalWindow)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
setBackWindow(winInfo.ModalWindow);
|
|
|
|
winInfo.ModalWindow->setActive(false);
|
|
|
|
}
|
|
|
|
if (!_ModalStack.empty())
|
|
|
|
{
|
|
|
|
if(_ModalStack.back().ModalWindow)
|
|
|
|
{
|
|
|
|
_ModalStack.back().ModalWindow->setActive(true);
|
|
|
|
setTopWindow(_ModalStack.back().ModalWindow);
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::popModalWindowCategory(const std::string &category)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for(;;)
|
2012-05-31 02:27:27 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (_ModalStack.empty()) break;
|
|
|
|
if (!_ModalStack.back().ModalWindow) break;
|
|
|
|
CGroupModal *gm = dynamic_cast<CGroupModal *>((CInterfaceGroup*)(_ModalStack.back().ModalWindow));
|
|
|
|
if (gm && gm->Category == category)
|
|
|
|
{
|
|
|
|
_ModalStack.back().ModalWindow->setActive(false);
|
|
|
|
_ModalStack.pop_back();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getWindowUnder (sint32 x, sint32 y)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
H_AUTO (RZ_Interface_Window_Under )
|
|
|
|
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
|
|
|
|
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *pIG = *itw;
|
|
|
|
if (pIG->getActive() && pIG->getUseCursor())
|
|
|
|
{
|
|
|
|
if (pIG->isWindowUnder (x, y))
|
|
|
|
return pIG;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceGroup* CWidgetManager::getGroupUnder (sint32 x, sint32 y)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
|
|
|
|
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CInterfaceGroup *pIG = *itw;
|
|
|
|
if (pIG->getActive() && pIG->getUseCursor())
|
|
|
|
{
|
|
|
|
CInterfaceGroup *pIGunder = pIG->getGroupUnder (x ,y);
|
|
|
|
if (pIGunder != NULL)
|
|
|
|
return pIGunder;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
return NULL;
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::getViewsUnder (sint32 x, sint32 y, std::vector<CViewBase*> &vVB)
|
|
|
|
{
|
|
|
|
vVB.clear ();
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// No Op if screen minimized
|
|
|
|
if(CViewRenderer::getInstance()->isMinimized())
|
|
|
|
return;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
uint32 sw, sh;
|
|
|
|
CViewRenderer::getInstance()->getScreenSize(sw, sh);
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0; nPriority--)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
|
|
|
|
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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 ;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::getCtrlsUnder (sint32 x, sint32 y, std::vector<CCtrlBase*> &vICL)
|
|
|
|
{
|
|
|
|
vICL.clear ();
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// No Op if screen minimized
|
|
|
|
if(CViewRenderer::getInstance()->isMinimized())
|
|
|
|
return;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
uint32 sw, sh;
|
|
|
|
CViewRenderer::getInstance()->getScreenSize(sw, sh);
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
|
|
|
|
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::getGroupsUnder (sint32 x, sint32 y, std::vector<CInterfaceGroup *> &vIGL)
|
|
|
|
{
|
|
|
|
vIGL.clear ();
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// No Op if screen minimized
|
|
|
|
if(CViewRenderer::getInstance()->isMinimized())
|
|
|
|
return;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
uint32 sw, sh;
|
|
|
|
CViewRenderer::getInstance()->getScreenSize(sw, sh);
|
|
|
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = WIN_PRIORITY_MAX; nPriority > 0 ; nPriority--)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
const std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority-1];
|
|
|
|
std::list<CInterfaceGroup*>::const_reverse_iterator itw;
|
|
|
|
for (itw = rList.rbegin(); itw != rList.rend(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (pIG->isIn(x, y))
|
|
|
|
{
|
|
|
|
vIGL.push_back(pIG);
|
|
|
|
pIG->getGroupsUnder (x, y, 0, 0, (sint32) sw, (sint32) sh, vIGL);
|
|
|
|
return;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::removeRefOnView( CViewBase *viewBase )
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
uint i;
|
|
|
|
for (i=0; i<_ViewsUnderPointer.size(); i++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (_ViewsUnderPointer[i] == viewBase)
|
|
|
|
{
|
|
|
|
_ViewsUnderPointer.erase (_ViewsUnderPointer.begin()+i);
|
|
|
|
i--;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
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++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (_CtrlsUnderPointer[i] == ctrlBase)
|
|
|
|
{
|
|
|
|
_CtrlsUnderPointer.erase (_CtrlsUnderPointer.begin()+i);
|
|
|
|
i--;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// Unregister from ClockMsgTargets
|
|
|
|
unregisterClockMsgTarget(ctrlBase);
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::removeRefOnGroup (CInterfaceGroup *group)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
uint i;
|
|
|
|
for (i=0; i<_GroupsUnderPointer.size(); i++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (_GroupsUnderPointer[i] == group)
|
|
|
|
{
|
|
|
|
_GroupsUnderPointer.erase (_GroupsUnderPointer.begin()+i);
|
|
|
|
i--;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::reset()
|
|
|
|
{
|
|
|
|
setCurContextHelp( NULL );
|
|
|
|
|
|
|
|
_ViewsUnderPointer.clear();
|
|
|
|
_CtrlsUnderPointer.clear();
|
|
|
|
_GroupsUnderPointer.clear();
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
_CaptureKeyboard = NULL;
|
|
|
|
_OldCaptureKeyboard = NULL;
|
|
|
|
setCapturePointerLeft(NULL);
|
|
|
|
setCapturePointerRight(NULL);
|
|
|
|
|
|
|
|
resetColorProps();
|
2012-06-23 04:24:09 +00:00
|
|
|
|
|
|
|
_AlphaRolloverSpeedDB = NULL;
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::checkCoords()
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
H_AUTO ( RZ_Interface_validateCoords )
|
|
|
|
|
|
|
|
uint32 nMasterGroup;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
H_AUTO ( RZ_Interface_checkCoords )
|
|
|
|
|
|
|
|
// checkCoords all the windows
|
|
|
|
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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 ();
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
bool bRecomputeCtrlUnderPtr = false;
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
H_AUTO ( RZ_Interface_updateCoords )
|
|
|
|
|
|
|
|
// updateCoords all the needed windows
|
|
|
|
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
|
|
|
if (rMG.Group->getActive())
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint8 nPriority = 0; nPriority < WIN_PRIORITY_MAX; nPriority++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
|
|
|
|
std::list<CInterfaceGroup*>::const_iterator itw;
|
|
|
|
for (itw = rList.begin(); itw!= rList.end(); itw++)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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))
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
if ( CWidgetManager::getInstance()->getPointer() != NULL)
|
|
|
|
CWidgetManager::getInstance()->getPointer()->updateCoords();
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
if (bRecomputeCtrlUnderPtr)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
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;
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
|
|
|
|
{
|
|
|
|
if (!_Pointer)
|
|
|
|
return;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
uint32 nScrW, nScrH;
|
|
|
|
sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
|
|
|
|
_Pointer->getPointerPos (oldpx, oldpy);
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
olddisppx = oldpx;
|
|
|
|
olddisppy = oldpy;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
newpx = oldpx + dx;
|
|
|
|
newpy = oldpy + dy;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
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;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
disppx = newpx;
|
|
|
|
disppy = newpy;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
_Pointer->setPointerPos (newpx, newpy);
|
|
|
|
_Pointer->setPointerDispPos (disppx, disppy);
|
2012-06-05 03:25:49 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// 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);
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::movePointerAbs(sint32 px, sint32 py)
|
|
|
|
{
|
|
|
|
if(!CWidgetManager::getInstance()->getPointer())
|
|
|
|
return;
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
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);
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::setCapturePointerLeft(CCtrlBase *c)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// additionally, abort any dragging
|
|
|
|
if( CCtrlDraggable::getDraggedSheet() != NULL )
|
|
|
|
CCtrlDraggable::getDraggedSheet()->abortDragging();
|
|
|
|
|
|
|
|
_CapturePointerLeft = c;
|
|
|
|
notifyElementCaptured(c);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::setCapturePointerRight(CCtrlBase *c)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
_CapturePointerRight = c;
|
|
|
|
notifyElementCaptured(c);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::setCaptureKeyboard(CCtrlBase *c)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CGroupEditBoxBase *oldEb= dynamic_cast<CGroupEditBoxBase*>((CCtrlBase*)_CaptureKeyboard);
|
|
|
|
CGroupEditBoxBase *newEb= dynamic_cast<CGroupEditBoxBase*>(c);
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
if (_CaptureKeyboard && _CaptureKeyboard != c)
|
|
|
|
{
|
|
|
|
_CaptureKeyboard->onKeyboardCaptureLost();
|
|
|
|
}
|
|
|
|
// If the old capturedKeyboard is an editBox and allow recoverFocusOnEnter
|
|
|
|
if ( oldEb && oldEb->getRecoverFocusOnEnter() )
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
_OldCaptureKeyboard = _CaptureKeyboard;
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
if ( newEb )
|
|
|
|
{
|
|
|
|
CGroupEditBoxBase::disableSelection();
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!newEb->getAHOnFocus().empty())
|
|
|
|
{
|
|
|
|
CAHManager::getInstance()->runActionHandler(newEb->getAHOnFocus(), newEb, newEb->getAHOnFocusParams());
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
|
|
|
_CaptureKeyboard = c;
|
|
|
|
notifyElementCaptured(c);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::resetCaptureKeyboard()
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
CCtrlBase *captureKeyboard = _CaptureKeyboard;
|
|
|
|
_OldCaptureKeyboard = NULL;
|
|
|
|
_CaptureKeyboard = NULL;
|
|
|
|
if (captureKeyboard)
|
|
|
|
{
|
|
|
|
captureKeyboard->onKeyboardCaptureLost();
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::registerClockMsgTarget(CCtrlBase *vb)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!vb) return;
|
|
|
|
if (isClockMsgTarget(vb))
|
|
|
|
{
|
|
|
|
nlwarning("<CInterfaceManager::registerClockMsgTarget> Element %s is already registered", vb->getId().c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_ClockMsgTargets.push_back(vb);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::unregisterClockMsgTarget(CCtrlBase *vb)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!vb) return;
|
|
|
|
std::vector<CCtrlBase*>::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
|
|
|
if (it != _ClockMsgTargets.end())
|
|
|
|
{
|
|
|
|
_ClockMsgTargets.erase(it);
|
|
|
|
}
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
bool CWidgetManager::isClockMsgTarget(CCtrlBase *vb) const
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::vector<CCtrlBase*>::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
|
|
|
return it != _ClockMsgTargets.end();
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::sendClockTickEvent()
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
NLGUI::CEventDescriptorSystem clockTick;
|
|
|
|
clockTick.setEventTypeExtended(NLGUI::CEventDescriptorSystem::clocktick);
|
|
|
|
|
|
|
|
if (_CapturePointerLeft)
|
2012-06-03 01:48:31 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
_CapturePointerLeft->handleEvent(clockTick);
|
|
|
|
}
|
|
|
|
if (_CapturePointerRight)
|
|
|
|
{
|
|
|
|
_CapturePointerRight->handleEvent(clockTick);
|
2012-06-03 01:48:31 +00:00
|
|
|
}
|
2012-06-05 23:56:25 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// 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);
|
|
|
|
}
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::notifyElementCaptured(CCtrlBase *c)
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
std::set<CCtrlBase *> seen;
|
|
|
|
CCtrlBase *curr = c;
|
|
|
|
while (curr)
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
seen.insert(curr);
|
|
|
|
curr->elementCaptured(c);
|
|
|
|
curr = curr->getParent();
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
// also warn the ctrl under the pointer
|
|
|
|
for (uint i = 0; i < (uint) _CtrlsUnderPointer.size(); ++i)
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!seen.count(_CtrlsUnderPointer[i]))
|
|
|
|
{
|
|
|
|
_CtrlsUnderPointer[i]->elementCaptured(c);
|
|
|
|
}
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::makeWindow(CInterfaceGroup *group)
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if(!group)
|
|
|
|
return;
|
2012-06-05 23:56:25 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
uint32 i = 0;
|
|
|
|
for (i = 0; i < _MasterGroups.size(); ++i)
|
|
|
|
{
|
|
|
|
if (_MasterGroups[i].Group == group->getParent())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == _MasterGroups.size())
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
|
|
|
std::string stmp = std::string("not found master group for window: ")+group->getId();
|
|
|
|
nlwarning (stmp.c_str());
|
2012-06-09 01:57:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// check if group hasn't been inserted twice.
|
|
|
|
if (_MasterGroups[i].isWindowPresent(group))
|
|
|
|
{
|
|
|
|
nlwarning("Window inserted twice");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_MasterGroups[i].addWindow(group,group->getPriority());
|
|
|
|
}
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-09 01:57:40 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::unMakeWindow(CInterfaceGroup *group, bool noWarning)
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!group)
|
|
|
|
return;
|
|
|
|
|
|
|
|
uint32 i = 0;
|
|
|
|
for (i = 0; i < _MasterGroups.size(); ++i)
|
|
|
|
{
|
|
|
|
if (_MasterGroups[i].Group == group->getParent())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == _MasterGroups.size())
|
2012-06-05 23:56:25 +00:00
|
|
|
{
|
|
|
|
if (!noWarning)
|
2012-06-09 01:57:40 +00:00
|
|
|
{
|
|
|
|
std::string stmp = std::string("not found master group for window: ")+group->getId();
|
|
|
|
nlwarning (stmp.c_str());
|
|
|
|
}
|
|
|
|
return;
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
// check if group hasn't been inserted twice.
|
|
|
|
if (!_MasterGroups[i].isWindowPresent(group))
|
|
|
|
{
|
|
|
|
if (!noWarning)
|
|
|
|
nlwarning("Window not inserted in master group");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_MasterGroups[i].delWindow(group);
|
|
|
|
}
|
2012-06-05 23:56:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::setGlobalColor (NLMISC::CRGBA col)
|
2012-06-08 00:43:20 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
if (!_RProp)
|
|
|
|
{
|
|
|
|
_RProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
|
|
|
|
_GProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G");
|
|
|
|
_BProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
|
|
|
|
_AProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
|
|
|
|
}
|
|
|
|
_RProp ->setValue32 (col.R);
|
|
|
|
_GProp ->setValue32 (col.G);
|
|
|
|
_BProp ->setValue32 (col.B);
|
|
|
|
_AProp ->setValue32 (col.A);
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
_GlobalColor = col;
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// set the global color for content (the same with modulated alpha)
|
|
|
|
_GlobalColorForContent = _GlobalColor;
|
|
|
|
_GlobalColorForContent.A = (uint8) (( (uint16) _GlobalColorForContent.A * (uint16) _ContentAlpha) >> 8);
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::setContentAlpha(uint8 alpha)
|
|
|
|
{
|
|
|
|
_ContentAlpha = alpha;
|
|
|
|
// update alpha of global color
|
|
|
|
_GlobalColorForContent.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContentAlpha) >> 8);*/
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::resetColorProps()
|
|
|
|
{
|
|
|
|
_RProp = NULL;
|
|
|
|
_GProp = NULL;
|
|
|
|
_BProp = NULL;
|
|
|
|
_AProp = NULL;
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CInterfaceOptions* CWidgetManager::getOptions( const std::string &name )
|
|
|
|
{
|
|
|
|
std::map< std::string, NLMISC::CSmartPtr< CInterfaceOptions > >::iterator it = _OptionsMap.find( name );
|
|
|
|
if( it == _OptionsMap.end() )
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return it->second;
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::addOptions( std::string name, CInterfaceOptions *options )
|
|
|
|
{
|
|
|
|
_OptionsMap.insert( std::map< std::string, CInterfaceOptions* >::value_type( name, options ) );
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::removeOptions( std::string name )
|
|
|
|
{
|
|
|
|
_OptionsMap.erase( name );
|
|
|
|
}
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
void CWidgetManager::removeAllOptions()
|
|
|
|
{
|
|
|
|
_OptionsMap.clear();
|
|
|
|
}
|
2012-06-15 20:40:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
void CWidgetManager::enableMouseHandling( bool handle )
|
|
|
|
{
|
|
|
|
_MouseHandlingEnabled = handle;
|
|
|
|
if(!handle)
|
|
|
|
{
|
|
|
|
if(!getPointer())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// If Left captured, reset
|
|
|
|
if( getCapturePointerLeft() )
|
|
|
|
setCapturePointerLeft( NULL );
|
|
|
|
|
|
|
|
// Same for Right
|
|
|
|
if( getCapturePointerRight() )
|
|
|
|
setCapturePointerRight( NULL );
|
|
|
|
|
|
|
|
// Avoid any problem with modals
|
|
|
|
disableModalWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
uint CWidgetManager::getUserDblClickDelay()
|
|
|
|
{
|
|
|
|
uint nVal = 50;
|
|
|
|
NLMISC::CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED");
|
|
|
|
if( pNL != NULL )
|
|
|
|
nVal = pNL->getValue32();
|
|
|
|
|
|
|
|
uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f);
|
|
|
|
return dbclickDelay;
|
|
|
|
}
|
2012-06-17 00:08:21 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::setupOptions()
|
|
|
|
{
|
|
|
|
// After parsing options and templates node -> init system options.
|
|
|
|
CInterfaceOptions *opt = getOptions( "system" );
|
|
|
|
if( opt != NULL )
|
|
|
|
{
|
|
|
|
// List here all Special options
|
|
|
|
_SystemOptions[OptionCtrlSheetGrayColor]= opt->getValue("ctrl_sheet_gray_color");
|
|
|
|
_SystemOptions[OptionCtrlTextGrayColor]= opt->getValue("ctrl_text_gray_color");
|
|
|
|
_SystemOptions[OptionCtrlSheetRedifyColor]= opt->getValue("ctrl_sheet_redify_color");
|
|
|
|
_SystemOptions[OptionCtrlTextRedifyColor]= opt->getValue("ctrl_text_redify_color");
|
|
|
|
_SystemOptions[OptionCtrlSheetGreenifyColor]= opt->getValue("ctrl_sheet_greenify_color");
|
|
|
|
_SystemOptions[OptionCtrlTextGreenifyColor]= opt->getValue("ctrl_text_greenify_color");
|
|
|
|
_SystemOptions[OptionViewTextOverBackColor]= opt->getValue("text_over_back_color");
|
|
|
|
_SystemOptions[OptionFont]= opt->getValue("font");
|
|
|
|
_SystemOptions[OptionAddCoefFont]= opt->getValue("add_coef_font");
|
|
|
|
_SystemOptions[OptionMulCoefAnim]= opt->getValue("mul_coef_anim");
|
|
|
|
_SystemOptions[OptionTimeoutBubbles]= opt->getValue("bubbles_timeout");
|
|
|
|
_SystemOptions[OptionTimeoutMessages]= opt->getValue("messages_timeout");
|
|
|
|
_SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout");
|
|
|
|
_SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2012-06-23 04:24:09 +00:00
|
|
|
|
|
|
|
// Get the alpha roll over speed
|
|
|
|
float CWidgetManager::getAlphaRolloverSpeed()
|
|
|
|
{
|
|
|
|
if( _AlphaRolloverSpeedDB == NULL )
|
|
|
|
_AlphaRolloverSpeedDB = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:ALPHA_ROLLOVER_SPEED");
|
|
|
|
float fTmp = ROLLOVER_MIN_DELTA_PER_MS + (ROLLOVER_MAX_DELTA_PER_MS - ROLLOVER_MIN_DELTA_PER_MS) * 0.01f * (100 - _AlphaRolloverSpeedDB->getValue32());
|
|
|
|
return fTmp*fTmp*fTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWidgetManager::resetAlphaRolloverSpeed()
|
|
|
|
{
|
|
|
|
_AlphaRolloverSpeedDB = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWidgetManager::setContainerAlpha(uint8 alpha)
|
|
|
|
{
|
|
|
|
_ContainerAlpha = alpha;
|
|
|
|
// update alpha of global color
|
|
|
|
NLMISC::CRGBA c = getGlobalColor();
|
|
|
|
c.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContainerAlpha) >> 8); */
|
|
|
|
setGlobalColor( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWidgetManager::updateGlobalAlphas()
|
|
|
|
{
|
|
|
|
_GlobalContentAlpha = (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32();
|
|
|
|
_GlobalContainerAlpha = (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32();
|
|
|
|
_GlobalRolloverFactorContent = (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32();
|
|
|
|
_GlobalRolloverFactorContainer = (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32();
|
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::CWidgetManager()
|
|
|
|
{
|
|
|
|
_Pointer = NULL;
|
|
|
|
curContextHelp = NULL;
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
resetColorProps();
|
2012-06-08 00:43:20 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
|
|
|
_GlobalColorForContent = _GlobalColor;
|
|
|
|
_ContentAlpha = 255;
|
2012-06-23 04:24:09 +00:00
|
|
|
_ContainerAlpha = 255;
|
|
|
|
_GlobalContentAlpha = 255;
|
|
|
|
_GlobalContainerAlpha = 255;
|
|
|
|
_GlobalRolloverFactorContent = 255;
|
|
|
|
_GlobalRolloverFactorContainer = 255;
|
|
|
|
_AlphaRolloverSpeedDB = NULL;
|
2012-06-15 20:40:08 +00:00
|
|
|
|
|
|
|
_MouseHandlingEnabled = true;
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
2012-05-30 00:12:37 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
CWidgetManager::~CWidgetManager()
|
2012-05-30 00:12:37 +00:00
|
|
|
{
|
2012-06-09 01:57:40 +00:00
|
|
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
|
|
|
{
|
|
|
|
delete _MasterGroups[i].Group;
|
|
|
|
}
|
|
|
|
|
|
|
|
_Pointer = NULL;
|
|
|
|
curContextHelp = NULL;
|
2012-05-30 00:12:37 +00:00
|
|
|
}
|
2012-05-31 02:27:27 +00:00
|
|
|
|
2012-06-09 01:57:40 +00:00
|
|
|
}
|
|
|
|
|