mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-25 10:20:54 +00:00
A little refactoring.
This commit is contained in:
parent
75047b71b4
commit
fada6e7dcc
4 changed files with 18 additions and 7 deletions
|
@ -126,6 +126,7 @@ namespace NLGUI
|
||||||
|
|
||||||
void onRemoved();
|
void onRemoved();
|
||||||
void onWidgetDeleted( CInterfaceElement *e );
|
void onWidgetDeleted( CInterfaceElement *e );
|
||||||
|
void moveBy( sint32 x, sint32 y );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,14 @@ namespace NLGUI
|
||||||
/// so other widgets in the group can check if it belongs to them
|
/// so other widgets in the group can check if it belongs to them
|
||||||
virtual void onWidgetDeleted( CInterfaceElement *e ){}
|
virtual void onWidgetDeleted( CInterfaceElement *e ){}
|
||||||
|
|
||||||
|
/// Move the element by x in the X direction and y in the Y direction
|
||||||
|
// Uses real coordinates
|
||||||
|
virtual void moveBy( sint32 x, sint32 y )
|
||||||
|
{
|
||||||
|
_XReal += x;
|
||||||
|
_YReal += y;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool editorSelected;
|
bool editorSelected;
|
||||||
|
|
|
@ -863,10 +863,6 @@ namespace NLGUI
|
||||||
if(getFrozen() && getFrozenHalfTone())
|
if(getFrozen() && getFrozenHalfTone())
|
||||||
_ViewText->setAlpha(_ViewText->getAlpha()>>2);
|
_ViewText->setAlpha(_ViewText->getAlpha()>>2);
|
||||||
|
|
||||||
// When dragging the button, the text needs to move too
|
|
||||||
if( CInterfaceElement::editorMode )
|
|
||||||
_ViewText->updateCoords();
|
|
||||||
|
|
||||||
_ViewText->draw();
|
_ViewText->draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1017,5 +1013,13 @@ namespace NLGUI
|
||||||
void CCtrlTextButton::onWidgetDeleted( CInterfaceElement *e )
|
void CCtrlTextButton::onWidgetDeleted( CInterfaceElement *e )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCtrlTextButton::moveBy( sint32 x, sint32 y )
|
||||||
|
{
|
||||||
|
CInterfaceElement::moveBy( x, y );
|
||||||
|
|
||||||
|
if( _ViewText != NULL )
|
||||||
|
_ViewText->updateCoords();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2633,9 +2633,7 @@ namespace NLGUI
|
||||||
sint32 dx = newX - oldX;
|
sint32 dx = newX - oldX;
|
||||||
sint32 dy = newY - oldY;
|
sint32 dy = newY - oldY;
|
||||||
|
|
||||||
draggedElement->setXReal( draggedElement->getXReal() + dx );
|
draggedElement->moveBy( dx, dy );
|
||||||
draggedElement->setYReal( draggedElement->getYReal() + dy );
|
|
||||||
draggedElement->invalidateCoords();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue