From 45ed6ae4da40c4d64265bbde286298221aa1c9fc Mon Sep 17 00:00:00 2001 From: Bim Date: Wed, 3 Jul 2013 01:48:39 +0200 Subject: [PATCH] Add size set function to GuiComponent Similar to #92... --- src/GuiComponent.cpp | 13 +++++++++++++ src/GuiComponent.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/GuiComponent.cpp b/src/GuiComponent.cpp index 4a5ee0195..94afcdec0 100644 --- a/src/GuiComponent.cpp +++ b/src/GuiComponent.cpp @@ -102,6 +102,19 @@ Vector2u GuiComponent::getSize() return mSize; } +void GuiComponent::setSize(Vector2u size) +{ + mSize = size; + onSizeChanged(); +} + +void GuiComponent::setSize(unsigned int w, unsigned int h) +{ + mSize.x = w; + mSize.y = h; + onSizeChanged(); +} + //Children stuff. void GuiComponent::addChild(GuiComponent* cmp) { diff --git a/src/GuiComponent.h b/src/GuiComponent.h index b7f36af64..2335b3a33 100644 --- a/src/GuiComponent.h +++ b/src/GuiComponent.h @@ -36,6 +36,9 @@ public: virtual void onOffsetChanged() {}; Vector2u getSize(); + void setSize(Vector2u size); + void setSize(unsigned int w, unsigned int h); + virtual void onSizeChanged() {}; void setParent(GuiComponent* parent); GuiComponent* getParent();