SDK/BaseWidget: Add OnParentResized method
This commit is contained in:
parent
c9b84e3852
commit
4f1438f0f1
|
|
@ -78,11 +78,13 @@ namespace Ndk
|
||||||
virtual void OnMouseButtonPress(int x, int y, Nz::Mouse::Button button);
|
virtual void OnMouseButtonPress(int x, int y, Nz::Mouse::Button button);
|
||||||
virtual void OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button);
|
virtual void OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button);
|
||||||
virtual void OnMouseExit();
|
virtual void OnMouseExit();
|
||||||
|
virtual void OnParentResized(const Nz::Vector2f& newSize);
|
||||||
virtual void OnTextEntered(char32_t character, bool repeated);
|
virtual void OnTextEntered(char32_t character, bool repeated);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline BaseWidget();
|
inline BaseWidget();
|
||||||
|
|
||||||
|
inline void NotifyParentResized(const Nz::Vector2f& newSize);
|
||||||
inline void UpdateCanvasIndex(std::size_t index);
|
inline void UpdateCanvasIndex(std::size_t index);
|
||||||
|
|
||||||
std::size_t m_canvasIndex;
|
std::size_t m_canvasIndex;
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,9 @@ namespace Ndk
|
||||||
|
|
||||||
inline void BaseWidget::SetContentSize(const Nz::Vector2f& size)
|
inline void BaseWidget::SetContentSize(const Nz::Vector2f& size)
|
||||||
{
|
{
|
||||||
|
NotifyParentResized(size);
|
||||||
m_contentSize = size;
|
m_contentSize = size;
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +79,12 @@ namespace Ndk
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void BaseWidget::NotifyParentResized(const Nz::Vector2f& newSize)
|
||||||
|
{
|
||||||
|
for (const auto& widgetPtr : m_children)
|
||||||
|
widgetPtr->OnParentResized(newSize);
|
||||||
|
}
|
||||||
|
|
||||||
inline void BaseWidget::UpdateCanvasIndex(std::size_t index)
|
inline void BaseWidget::UpdateCanvasIndex(std::size_t index)
|
||||||
{
|
{
|
||||||
m_canvasIndex = index;
|
m_canvasIndex = index;
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,10 @@ namespace Ndk
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseWidget::OnParentResized(const Nz::Vector2f& newSize)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void BaseWidget::OnTextEntered(char32_t character, bool repeated)
|
void BaseWidget::OnTextEntered(char32_t character, bool repeated)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue