mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-28 01:56:24 +00:00
No need for free floating elements when we can simply reparent to the top window...
This commit is contained in:
parent
35017fe059
commit
627184184c
2 changed files with 16 additions and 58 deletions
|
@ -533,7 +533,6 @@ namespace NLGUI
|
||||||
NLMISC::CRefPtr< CViewBase > _CapturedView;
|
NLMISC::CRefPtr< CViewBase > _CapturedView;
|
||||||
|
|
||||||
NLMISC::CRefPtr< CInterfaceElement > draggedElement; // the element that we're currently dragging
|
NLMISC::CRefPtr< CInterfaceElement > draggedElement; // the element that we're currently dragging
|
||||||
std::vector< NLMISC::CRefPtr< CInterfaceElement > > _OrphanElements; // elements that were dragged out of their parents
|
|
||||||
|
|
||||||
bool startDragging();
|
bool startDragging();
|
||||||
void stopDragging();
|
void stopDragging();
|
||||||
|
|
|
@ -1037,8 +1037,6 @@ namespace NLGUI
|
||||||
setCapturePointerRight(NULL);
|
setCapturePointerRight(NULL);
|
||||||
_CapturedView = NULL;
|
_CapturedView = NULL;
|
||||||
|
|
||||||
_OrphanElements.clear();
|
|
||||||
|
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
resetAlphaRolloverSpeedProps();
|
resetAlphaRolloverSpeedProps();
|
||||||
resetGlobalAlphasProps();
|
resetGlobalAlphasProps();
|
||||||
|
@ -2041,15 +2039,6 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< NLMISC::CRefPtr< CInterfaceElement > >::iterator oeitr = _OrphanElements.begin();
|
|
||||||
while( oeitr != _OrphanElements.end() )
|
|
||||||
{
|
|
||||||
CInterfaceElement *e = *oeitr;
|
|
||||||
CViewBase *v = dynamic_cast< CViewBase* >( e );
|
|
||||||
v->draw();
|
|
||||||
++oeitr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( draggedElement != NULL )
|
if( draggedElement != NULL )
|
||||||
{
|
{
|
||||||
CInterfaceElement *e = draggedElement;
|
CInterfaceElement *e = draggedElement;
|
||||||
|
@ -2411,29 +2400,6 @@ namespace NLGUI
|
||||||
if (!CCtrlDraggable::getDraggedSheet())
|
if (!CCtrlDraggable::getDraggedSheet())
|
||||||
{
|
{
|
||||||
|
|
||||||
if( CInterfaceElement::getEditorMode() )
|
|
||||||
{
|
|
||||||
std::vector< NLMISC::CRefPtr< CInterfaceElement > >::reverse_iterator itr = _OrphanElements.rbegin();
|
|
||||||
while( itr != _OrphanElements.rend() )
|
|
||||||
{
|
|
||||||
CInterfaceElement *e = *itr;
|
|
||||||
|
|
||||||
int x = getPointer()->getXReal();
|
|
||||||
int y = getPointer()->getYReal();
|
|
||||||
|
|
||||||
if( e->isIn( x, y ) )
|
|
||||||
{
|
|
||||||
_CapturedView = static_cast< CViewBase* >( e );
|
|
||||||
captured = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
++itr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !captured )
|
|
||||||
{
|
|
||||||
// Take the top most control.
|
// Take the top most control.
|
||||||
uint nMaxDepth = 0;
|
uint nMaxDepth = 0;
|
||||||
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer();
|
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer();
|
||||||
|
@ -2451,7 +2417,6 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( CInterfaceElement::getEditorMode() && !captured )
|
if( CInterfaceElement::getEditorMode() && !captured )
|
||||||
{
|
{
|
||||||
|
@ -2700,20 +2665,16 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
|
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
|
||||||
CInterfaceElement *e = draggedElement;
|
CInterfaceElement *e = draggedElement;
|
||||||
|
CInterfaceGroup *tw = getTopWindow();
|
||||||
|
|
||||||
|
if( g == NULL )
|
||||||
|
g = tw;
|
||||||
|
|
||||||
e->setParent( g );
|
e->setParent( g );
|
||||||
e->setIdRecurse( e->getShortId() );
|
e->setIdRecurse( e->getShortId() );
|
||||||
e->setParentPos( g );
|
e->setParentPos( g );
|
||||||
e->setParentSize( g );
|
e->setParentSize( g );
|
||||||
|
|
||||||
if( g != NULL )
|
|
||||||
{
|
|
||||||
g->addElement( e );
|
g->addElement( e );
|
||||||
}
|
|
||||||
else
|
|
||||||
_OrphanElements.push_back( draggedElement );
|
|
||||||
|
|
||||||
checkCoords();
|
|
||||||
|
|
||||||
draggedElement = NULL;
|
draggedElement = NULL;
|
||||||
}
|
}
|
||||||
|
@ -3513,8 +3474,6 @@ namespace NLGUI
|
||||||
|
|
||||||
CWidgetManager::~CWidgetManager()
|
CWidgetManager::~CWidgetManager()
|
||||||
{
|
{
|
||||||
_OrphanElements.clear();
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
{
|
{
|
||||||
delete _MasterGroups[i].Group;
|
delete _MasterGroups[i].Group;
|
||||||
|
|
Loading…
Reference in a new issue