| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsPrerequisites.h"
- #include "BsGUIElementBase.h"
- namespace BansheeEngine
- {
- /** @addtogroup GUI
- * @{
- */
- /** GUI element that may be inserted into layouts in order to make a space of a fixed size. */
- class BS_EXPORT GUIFixedSpace : public GUIElementBase
- {
- public:
- GUIFixedSpace(UINT32 size)
- :mSize(size)
- { }
- ~GUIFixedSpace();
- /** Returns the size of the space in pixels. */
- UINT32 getSize() const { return mSize; }
- /** Changes the size of the space to the specified value, in pixels. */
- void setSize(UINT32 size) { if (mSize != size) { mSize = size; _markLayoutAsDirty(); } }
- /** Creates a new fixed space GUI element. */
- static GUIFixedSpace* create(UINT32 size);
- /** Destroys the space and removes it from its parent. */
- static void destroy(GUIFixedSpace* space);
- public: // ***** INTERNAL ******
- /** @name Internal
- * @{
- */
- /** @copydoc GUIElementBase::_getType */
- Type _getType() const override { return GUIElementBase::Type::FixedSpace; }
- /** @copydoc GUIElementBase::_getOptimalSize */
- Vector2I _getOptimalSize() const override { return Vector2I(getSize(), getSize()); }
- /** @copydoc GUIElementBase::_calculateLayoutSizeRange */
- LayoutSizeRange _calculateLayoutSizeRange() const override;
- /** @copydoc GUIElementBase::_getPadding */
- const RectOffset& _getPadding() const override
- {
- static RectOffset padding;
- return padding;
- }
- /** @} */
- protected:
- UINT32 mSize;
- };
- /**
- * GUI element that may be inserted into layouts to make a space of a flexible size. The space will expand only if
- * there is room and other elements are not squished because of it. If multiple flexible spaces are in a layout, their
- * sizes will be shared equally.
- *
- * @note
- * For example if you had a horizontal layout with a button, and you wanted to align that button to the right of the
- * layout, you would insert a flexible space before the button in the layout.
- */
- class BS_EXPORT GUIFlexibleSpace : public GUIElementBase
- {
- public:
- GUIFlexibleSpace() {}
- ~GUIFlexibleSpace();
- /** Creates a new flexible space GUI element. */
- static GUIFlexibleSpace* create();
- /** Destroys the space and removes it from its parent. */
- static void destroy(GUIFlexibleSpace* space);
- public: // ***** INTERNAL ******
- /** @name Internal
- * @{
- */
- /** @copydoc GUIElementBase::_getType */
- Type _getType() const override { return GUIElementBase::Type::FlexibleSpace; }
- /** @copydoc GUIElementBase::_getOptimalSize */
- virtual Vector2I _getOptimalSize() const override { return Vector2I(0, 0); }
- /** @copydoc GUIElementBase::_calculateLayoutSizeRange */
- virtual LayoutSizeRange _calculateLayoutSizeRange() const override;
- /** @copydoc GUIElementBase::_getPadding */
- virtual const RectOffset& _getPadding() const override
- {
- static RectOffset padding;
- return padding;
- }
- /** @} */
- };
- /** @} */
- }
|