SDK/BaseWidget: Add SetParent
This commit is contained in:
parent
c09b2d3747
commit
3bed2fb7fe
|
|
@ -270,6 +270,7 @@ Nazara Development Kit:
|
|||
- Fixed possible crash when disabling BaseWidget background
|
||||
- Added BaseWidget::OnMouseWheelMoved
|
||||
- Added Entity::OnEntity[Disabled|Enabled] signals
|
||||
- Added BaseWidget::SetParent
|
||||
|
||||
# 0.4:
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ namespace Ndk
|
|||
void SetBackgroundColor(const Nz::Color& color);
|
||||
void SetCursor(Nz::SystemCursor systemCursor);
|
||||
void SetFocus();
|
||||
void SetParent(BaseWidget* widget);
|
||||
|
||||
inline void SetFixedHeight(float fixedHeight);
|
||||
inline void SetFixedSize(const Nz::Vector2f& fixedSize);
|
||||
|
|
|
|||
|
|
@ -145,6 +145,27 @@ namespace Ndk
|
|||
m_canvas->SetKeyboardOwner(m_canvasIndex);
|
||||
}
|
||||
|
||||
void BaseWidget::SetParent(BaseWidget* widget)
|
||||
{
|
||||
Canvas* oldCanvas = m_canvas;
|
||||
Canvas* newCanvas = widget->GetCanvas();
|
||||
|
||||
// Changing a widget canvas is a problem because of the canvas entities
|
||||
NazaraAssert(oldCanvas == newCanvas, "Transferring a widget between canvas is not yet supported");
|
||||
|
||||
Node::SetParent(widget);
|
||||
m_widgetParent = widget;
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
void BaseWidget::SetRenderingRect(const Nz::Rectf& renderingRect)
|
||||
{
|
||||
m_renderingRect = renderingRect;
|
||||
|
||||
UpdatePositionAndSize();
|
||||
}
|
||||
|
||||
void BaseWidget::Show(bool show)
|
||||
{
|
||||
if (m_visible != show)
|
||||
|
|
|
|||
Loading…
Reference in New Issue