SDK/BaseWidget: Add SetParent
This commit is contained in:
@@ -270,6 +270,7 @@ Nazara Development Kit:
|
|||||||
- Fixed possible crash when disabling BaseWidget background
|
- Fixed possible crash when disabling BaseWidget background
|
||||||
- Added BaseWidget::OnMouseWheelMoved
|
- Added BaseWidget::OnMouseWheelMoved
|
||||||
- Added Entity::OnEntity[Disabled|Enabled] signals
|
- Added Entity::OnEntity[Disabled|Enabled] signals
|
||||||
|
- Added BaseWidget::SetParent
|
||||||
|
|
||||||
# 0.4:
|
# 0.4:
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ namespace Ndk
|
|||||||
void SetBackgroundColor(const Nz::Color& color);
|
void SetBackgroundColor(const Nz::Color& color);
|
||||||
void SetCursor(Nz::SystemCursor systemCursor);
|
void SetCursor(Nz::SystemCursor systemCursor);
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
|
void SetParent(BaseWidget* widget);
|
||||||
|
|
||||||
inline void SetFixedHeight(float fixedHeight);
|
inline void SetFixedHeight(float fixedHeight);
|
||||||
inline void SetFixedSize(const Nz::Vector2f& fixedSize);
|
inline void SetFixedSize(const Nz::Vector2f& fixedSize);
|
||||||
|
|||||||
@@ -145,6 +145,27 @@ namespace Ndk
|
|||||||
m_canvas->SetKeyboardOwner(m_canvasIndex);
|
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)
|
void BaseWidget::Show(bool show)
|
||||||
{
|
{
|
||||||
if (m_visible != show)
|
if (m_visible != show)
|
||||||
|
|||||||
Reference in New Issue
Block a user