mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 09:16:18 +00:00
Add widget to a new parent when the widget being dragged is dropped, otherwise add it to the orphanlist so that it's drawn anyways. NOTE: The dropped widget can be clipped. If it is clipped, it never shows up even tho it's there.
This commit is contained in:
parent
40ccff720d
commit
7907ee8cdb
3 changed files with 49 additions and 1 deletions
|
@ -57,6 +57,7 @@ namespace NLGUI
|
|||
CInterfaceElement* findFromShortId(const std::string &id);
|
||||
|
||||
/// Dynamic creation
|
||||
virtual void addElement (CInterfaceElement *child, sint eltOrder = -1 );
|
||||
virtual void addView (CViewBase *child , sint eltOrder = -1);
|
||||
virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1);
|
||||
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
|
||||
|
|
|
@ -911,6 +911,31 @@ namespace NLGUI
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceGroup::addElement (CInterfaceElement *child, sint eltOrder /*= -1*/)
|
||||
{
|
||||
if (!child)
|
||||
{
|
||||
nlwarning("<CInterfaceGroup::addView> : tried to add a NULL view");
|
||||
return;
|
||||
}
|
||||
|
||||
if( child->isGroup() )
|
||||
{
|
||||
addGroup( static_cast< CInterfaceGroup* >( child ), eltOrder );
|
||||
}
|
||||
else
|
||||
if( child->isCtrl() )
|
||||
{
|
||||
addCtrl( static_cast< CCtrlBase* >( child ), eltOrder );
|
||||
}
|
||||
else
|
||||
if( child->isView() )
|
||||
{
|
||||
addView( static_cast< CViewBase* >( child ), eltOrder );
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceGroup::addView (CViewBase *child, sint eltOrder /*= -1*/)
|
||||
{
|
||||
|
@ -1312,6 +1337,11 @@ namespace NLGUI
|
|||
for (ite = _EltOrder.begin() ; ite != _EltOrder.end(); ite++)
|
||||
{
|
||||
CViewBase *pVB = *ite;
|
||||
if( pVB->getName() == "=MARKED=" )
|
||||
{
|
||||
nlinfo( "=MARKED=" );
|
||||
}
|
||||
|
||||
if (pVB->getActive())
|
||||
pVB->draw();
|
||||
}
|
||||
|
|
|
@ -2673,7 +2673,24 @@ namespace NLGUI
|
|||
{
|
||||
if( draggedElement != NULL )
|
||||
{
|
||||
_OrphanElements.push_back( draggedElement );
|
||||
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
|
||||
|
||||
if( g != NULL )
|
||||
{
|
||||
CInterfaceElement *e = draggedElement;
|
||||
e->setName( "=MARKED=" );
|
||||
e->setParent( g );
|
||||
e->setIdRecurse( e->getShortId() );
|
||||
g->addElement( e );
|
||||
|
||||
e->setParentPos( g );
|
||||
e->setParentSize( g );
|
||||
|
||||
checkCoords();
|
||||
}
|
||||
else
|
||||
_OrphanElements.push_back( draggedElement );
|
||||
|
||||
draggedElement = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue