|
@@ -9,15 +9,15 @@
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
- /**
|
|
|
|
|
- * @brief Base class for all GUI elements (visible or layout).
|
|
|
|
|
|
|
+ /** @addtogroup Implementation
|
|
|
|
|
+ * @{
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
|
|
+ /** Base class for all GUI elements (visible or layout). */
|
|
|
class BS_EXPORT GUIElementBase
|
|
class BS_EXPORT GUIElementBase
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- /**
|
|
|
|
|
- * @brief Valid types of GUI base elements.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Valid types of GUI base elements. */
|
|
|
enum class Type
|
|
enum class Type
|
|
|
{
|
|
{
|
|
|
Layout,
|
|
Layout,
|
|
@@ -28,9 +28,7 @@ namespace BansheeEngine
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
protected:
|
|
|
- /**
|
|
|
|
|
- * @brief Flags that signal the state of the GUI element.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Flags that signal the state of the GUI element. */
|
|
|
enum GUIElementFlags
|
|
enum GUIElementFlags
|
|
|
{
|
|
{
|
|
|
GUIElem_Dirty = 0x01,
|
|
GUIElem_Dirty = 0x01,
|
|
@@ -48,88 +46,80 @@ namespace BansheeEngine
|
|
|
virtual ~GUIElementBase();
|
|
virtual ~GUIElementBase();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Sets element position relative to parent GUI panel.
|
|
|
|
|
|
|
+ * Sets element position relative to parent GUI panel.
|
|
|
*
|
|
*
|
|
|
- * @note Be aware that this value will be ignored if GUI element is part of a layout since then
|
|
|
|
|
- * the layout controls its placement.
|
|
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * Be aware that this value will be ignored if GUI element is part of a layout since then the layout controls its
|
|
|
|
|
+ * placement.
|
|
|
*/
|
|
*/
|
|
|
void setPosition(INT32 x, INT32 y);
|
|
void setPosition(INT32 x, INT32 y);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Sets element width in pixels.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Sets element width in pixels. */
|
|
|
void setWidth(UINT32 width);
|
|
void setWidth(UINT32 width);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Sets element width in pixels. Element will be resized according to its
|
|
|
|
|
- * contents and parent layout but will always stay within the provided range.
|
|
|
|
|
- * If maximum width is zero, the element is allowed to expand as much as it needs.
|
|
|
|
|
|
|
+ * Sets element width in pixels. Element will be resized according to its contents and parent layout but will
|
|
|
|
|
+ * always stay within the provided range. If maximum width is zero, the element is allowed to expand as much as
|
|
|
|
|
+ * it needs.
|
|
|
*/
|
|
*/
|
|
|
void setFlexibleWidth(UINT32 minWidth = 0, UINT32 maxWidth = 0);
|
|
void setFlexibleWidth(UINT32 minWidth = 0, UINT32 maxWidth = 0);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Sets element height in pixels.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Sets element height in pixels. */
|
|
|
void setHeight(UINT32 height);
|
|
void setHeight(UINT32 height);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Sets element height in pixels. Element will be resized according to its
|
|
|
|
|
- * contents and parent layout but will always stay within the provided range.
|
|
|
|
|
- * If maximum height is zero, the element is allowed to expand as much as it needs.
|
|
|
|
|
|
|
+ * Sets element height in pixels. Element will be resized according to its contents and parent layout but will
|
|
|
|
|
+ * always stay within the provided range. If maximum height is zero, the element is allowed to expand as much as
|
|
|
|
|
+ * it needs.
|
|
|
*/
|
|
*/
|
|
|
void setFlexibleHeight(UINT32 minHeight = 0, UINT32 maxHeight = 0);
|
|
void setFlexibleHeight(UINT32 minHeight = 0, UINT32 maxHeight = 0);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Resets element dimensions to their initial values dictated by the element's style.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Resets element dimensions to their initial values dictated by the element's style. */
|
|
|
virtual void resetDimensions();
|
|
virtual void resetDimensions();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Hides or shows this element and recursively applies the same state to all the child elements.
|
|
|
|
|
- * This will not remove the element from the layout, the room for it will still be reserved but it just
|
|
|
|
|
- * won't be visible.
|
|
|
|
|
|
|
+ * Hides or shows this element and recursively applies the same state to all the child elements. This will not
|
|
|
|
|
+ * remove the element from the layout, the room for it will still be reserved but it just won't be visible.
|
|
|
*/
|
|
*/
|
|
|
void setVisible(bool visible);
|
|
void setVisible(bool visible);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Activates or deactives this element and recursively applies the same state to all the child elements.
|
|
|
|
|
- * This has the same effect as ::setVisible, but when disabled it will also remove the element from the
|
|
|
|
|
- * layout, essentially having the same effect is if you destroyed the element.
|
|
|
|
|
|
|
+ * Activates or deactives this element and recursively applies the same state to all the child elements. This has
|
|
|
|
|
+ * the same effect as setVisible(), but when disabled it will also remove the element from the layout, essentially
|
|
|
|
|
+ * having the same effect is if you destroyed the element.
|
|
|
*/
|
|
*/
|
|
|
void setActive(bool active);
|
|
void setActive(bool active);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Disables or enables the element. Disabled elements cannot be interacted with and have a faded out
|
|
|
|
|
- * appearance.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance. */
|
|
|
void setDisabled(bool disabled);
|
|
void setDisabled(bool disabled);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns non-clipped bounds of the GUI element. Relative to a parent GUI panel.
|
|
|
|
|
|
|
+ * Returns non-clipped bounds of the GUI element. Relative to a parent GUI panel.
|
|
|
*
|
|
*
|
|
|
- * @param relativeTo Parent panel of the provided element relative to which to return the
|
|
|
|
|
- * bounds. If null the bounds relative to the first parent panel are returned.
|
|
|
|
|
- * Behavior is undefined if provided panel is not a parent of the element.
|
|
|
|
|
|
|
+ * @param[in] relativeTo Parent panel of the provided element relative to which to return the bounds. If null
|
|
|
|
|
+ * the bounds relative to the first parent panel are returned. Behavior is undefined if
|
|
|
|
|
+ * provided panel is not a parent of the element.
|
|
|
*
|
|
*
|
|
|
* @note This call can be potentially expensive if the GUI state is dirty.
|
|
* @note This call can be potentially expensive if the GUI state is dirty.
|
|
|
*/
|
|
*/
|
|
|
Rect2I getBounds(GUIPanel* relativeTo = nullptr);
|
|
Rect2I getBounds(GUIPanel* relativeTo = nullptr);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Sets the bounds of the GUI element. Relative to a parent GUI panel.
|
|
|
|
|
- * Equivalent to calling setPosition, setWidth and setHeight.
|
|
|
|
|
|
|
+ * Sets the bounds of the GUI element. Relative to a parent GUI panel. Equivalent to calling setPosition(),
|
|
|
|
|
+ * setWidth() and setHeight().
|
|
|
*/
|
|
*/
|
|
|
void setBounds(const Rect2I& bounds);
|
|
void setBounds(const Rect2I& bounds);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns non-clipped bounds of the GUI element. Relative to a parent GUI widget.
|
|
|
|
|
|
|
+ * Returns non-clipped bounds of the GUI element. Relative to a parent GUI widget.
|
|
|
*
|
|
*
|
|
|
* @note This call can be potentially expensive if the GUI state is dirty.
|
|
* @note This call can be potentially expensive if the GUI state is dirty.
|
|
|
*/
|
|
*/
|
|
|
Rect2I getGlobalBounds();
|
|
Rect2I getGlobalBounds();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns non-clipped visible bounds of the GUI element (bounds exclude the margins). Relative to the parent GUI panel.
|
|
|
|
|
|
|
+ * Returns non-clipped visible bounds of the GUI element (bounds exclude the margins). Relative to the parent GUI
|
|
|
|
|
+ * panel.
|
|
|
*
|
|
*
|
|
|
* @note This call can be potentially expensive as the bounds need to be calculated based on current GUI state.
|
|
* @note This call can be potentially expensive as the bounds need to be calculated based on current GUI state.
|
|
|
*/
|
|
*/
|
|
@@ -139,179 +129,109 @@ namespace BansheeEngine
|
|
|
/* INTERNAL METHODS */
|
|
/* INTERNAL METHODS */
|
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
|
|
+ /** @cond INTERNAL */
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @brief Updates child elements positions, sizes, clip rectangles and depths so they
|
|
|
|
|
- * fit into the provided bounds, while respecting their layout options.
|
|
|
|
|
|
|
+ * Updates child elements positions, sizes, clip rectangles and depths so they fit into the provided bounds, while
|
|
|
|
|
+ * respecting their layout options.
|
|
|
*
|
|
*
|
|
|
- * @param data Layout data containing the necessary bounds and restrictions
|
|
|
|
|
- * to use for calculating the child element layout data.
|
|
|
|
|
|
|
+ * @param[in] data Layout data containing the necessary bounds and restrictions to use for calculating the
|
|
|
|
|
+ * child element layout data.
|
|
|
*
|
|
*
|
|
|
* @note Internal method.
|
|
* @note Internal method.
|
|
|
*/
|
|
*/
|
|
|
virtual void _updateLayout(const GUILayoutData& data);
|
|
virtual void _updateLayout(const GUILayoutData& data);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Calculates optimal sizes of all child elements, as determined by their style and layout options.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Calculates optimal sizes of all child elements, as determined by their style and layout options. */
|
|
|
virtual void _updateOptimalLayoutSizes();
|
|
virtual void _updateOptimalLayoutSizes();
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @copydoc _updateLayout
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** @copydoc _updateLayout */
|
|
|
virtual void _updateLayoutInternal(const GUILayoutData& data);
|
|
virtual void _updateLayoutInternal(const GUILayoutData& data);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Calculates positions & sizes of all elements in the layout. This method expects a pre-allocated array to store the data in.
|
|
|
|
|
|
|
+ * Calculates positions & sizes of all elements in the layout. This method expects a pre-allocated array to store
|
|
|
|
|
+ * the data in.
|
|
|
*
|
|
*
|
|
|
- * @brief layoutArea Parent layout area to position the child elements in.
|
|
|
|
|
- * @param elementAreas Array to hold output areas. Must be the same size as the number of child elements.
|
|
|
|
|
- * @param numElements Size of the element areas array.
|
|
|
|
|
- * @param sizeRanges Ranges of possible sizes used for the child elements. Array must be same size as elements array.
|
|
|
|
|
- * @param mySizeRange Size range of this element.
|
|
|
|
|
|
|
+ * @param[in] layoutArea Parent layout area to position the child elements in.
|
|
|
|
|
+ * @param[out] elementAreas Array to hold output areas. Must be the same size as the number of child elements.
|
|
|
|
|
+ * @param[in] numElements Size of the element areas array.
|
|
|
|
|
+ * @param[in] sizeRanges Ranges of possible sizes used for the child elements. Array must be same size as
|
|
|
|
|
+ * elements array.
|
|
|
|
|
+ * @param[in] mySizeRange Size range of this element.
|
|
|
*/
|
|
*/
|
|
|
virtual void _getElementAreas(const Rect2I& layoutArea, Rect2I* elementAreas, UINT32 numElements,
|
|
virtual void _getElementAreas(const Rect2I& layoutArea, Rect2I* elementAreas, UINT32 numElements,
|
|
|
const Vector<LayoutSizeRange>& sizeRanges, const LayoutSizeRange& mySizeRange) const;
|
|
const Vector<LayoutSizeRange>& sizeRanges, const LayoutSizeRange& mySizeRange) const;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Updates layout data that determines GUI elements final position & depth
|
|
|
|
|
- * in the GUI widget.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Updates layout data that determines GUI elements final position & depth in the GUI widget. */
|
|
|
virtual void _setLayoutData(const GUILayoutData& data) { mLayoutData = data; }
|
|
virtual void _setLayoutData(const GUILayoutData& data) { mLayoutData = data; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Retrieves layout data that determines GUI elements final position & depth
|
|
|
|
|
- * in the GUI widget.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Retrieves layout data that determines GUI elements final position & depth in the GUI widget. */
|
|
|
const GUILayoutData& _getLayoutData() const { return mLayoutData; }
|
|
const GUILayoutData& _getLayoutData() const { return mLayoutData; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Sets a new parent for this element.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Sets a new parent for this element. */
|
|
|
void _setParent(GUIElementBase* parent);
|
|
void _setParent(GUIElementBase* parent);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns number of child elements.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns number of child elements. */
|
|
|
UINT32 _getNumChildren() const { return (UINT32)mChildren.size(); }
|
|
UINT32 _getNumChildren() const { return (UINT32)mChildren.size(); }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Return the child element at the specified index.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Return the child element at the specified index.*/
|
|
|
GUIElementBase* _getChild(UINT32 idx) const { return mChildren[idx]; }
|
|
GUIElementBase* _getChild(UINT32 idx) const { return mChildren[idx]; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns previously calculated optimal size for this element.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns previously calculated optimal size for this element. */
|
|
|
virtual Vector2I _getOptimalSize() const = 0;
|
|
virtual Vector2I _getOptimalSize() const = 0;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns layout options that determine how is the element positioned and sized.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns layout options that determine how is the element positioned and sized. */
|
|
|
const GUIDimensions& _getDimensions() const { return mDimensions; }
|
|
const GUIDimensions& _getDimensions() const { return mDimensions; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Calculates element size range constrained by its layout options.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Calculates element size range constrained by its layout options. */
|
|
|
virtual LayoutSizeRange _calculateLayoutSizeRange() const ;
|
|
virtual LayoutSizeRange _calculateLayoutSizeRange() const ;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns element size range constrained by its layout options. This is
|
|
|
|
|
- * different from ::_calculateLayoutSizeRange because this method may return
|
|
|
|
|
- * cached size range.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
|
|
+ * Returns element size range constrained by its layout options. This is different from _calculateLayoutSizeRange()
|
|
|
|
|
+ * because this method may return cached size range.
|
|
|
*/
|
|
*/
|
|
|
virtual LayoutSizeRange _getLayoutSizeRange() const;
|
|
virtual LayoutSizeRange _getLayoutSizeRange() const;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns element padding that determines how far apart to space out this element
|
|
|
|
|
- * from other elements in a layout.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
|
|
+ * Returns element padding that determines how far apart to space out this element from other elements in a layout.
|
|
|
*/
|
|
*/
|
|
|
virtual const RectOffset& _getPadding() const = 0;
|
|
virtual const RectOffset& _getPadding() const = 0;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns specific sub-type of this object.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns specific sub-type of this object. */
|
|
|
virtual Type _getType() const = 0;
|
|
virtual Type _getType() const = 0;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns parent GUI base element.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns parent GUI base element. */
|
|
|
GUIElementBase* _getParent() const { return mParentElement; }
|
|
GUIElementBase* _getParent() const { return mParentElement; }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Returns the parent element whose layout needs to be updated
|
|
|
|
|
- * when this elements contents change.
|
|
|
|
|
|
|
+ * Returns the parent element whose layout needs to be updated when this elements contents change.
|
|
|
*
|
|
*
|
|
|
- * @note Due to the nature of the GUI system, when a child element bounds
|
|
|
|
|
- * or contents change, its parents and siblings usually need their
|
|
|
|
|
- * layout bound updated. This function returns the first parent of
|
|
|
|
|
- * all the elements that require updating. This parent usually
|
|
|
|
|
- * has fixed bounds or some other property that allows its children
|
|
|
|
|
- * to be updated independently from the even higher-up elements.
|
|
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * Due to the nature of the GUI system, when a child element bounds or contents change, its parents and siblings
|
|
|
|
|
+ * usually need their layout bound updated. This function returns the first parent of all the elements that require
|
|
|
|
|
+ * updating. This parent usually has fixed bounds or some other property that allows its children to be updated
|
|
|
|
|
+ * independently from the even higher-up elements.
|
|
|
*/
|
|
*/
|
|
|
GUIElementBase* _getUpdateParent() const { return mUpdateParent; }
|
|
GUIElementBase* _getUpdateParent() const { return mUpdateParent; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns parent GUI widget, can be null.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns parent GUI widget, can be null. */
|
|
|
GUIWidget* _getParentWidget() const { return mParentWidget; }
|
|
GUIWidget* _getParentWidget() const { return mParentWidget; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Checks if element is visible or hidden.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Checks if element is visible or hidden. */
|
|
|
bool _isVisible() const { return (mFlags & GUIElem_Hidden) == 0; }
|
|
bool _isVisible() const { return (mFlags & GUIElem_Hidden) == 0; }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Checks if element is active or inactive. Inactive elements are not visible, don't take up space
|
|
|
|
|
- * in their parent layouts, and can't be interacted with.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
|
|
+ * Checks if element is active or inactive. Inactive elements are not visible, don't take up space
|
|
|
|
|
+ * in their parent layouts, and can't be interacted with.
|
|
|
*/
|
|
*/
|
|
|
bool _isActive() const { return (mFlags & GUIElem_Inactive) == 0; }
|
|
bool _isActive() const { return (mFlags & GUIElem_Inactive) == 0; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Checks if element is disabled. Disabled elements cannot be interacted with and have a faded out appearance.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Checks if element is disabled. Disabled elements cannot be interacted with and have a faded out appearance. */
|
|
|
bool _isDisabled() const { return (mFlags & GUIElem_Disabled) != 0; }
|
|
bool _isDisabled() const { return (mFlags & GUIElem_Disabled) != 0; }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Internal version of ::setVisible that doesn't modify local visibility, instead it is only meant to be called
|
|
|
|
|
|
|
+ * Internal version of setVisible() that doesn't modify local visibility, instead it is only meant to be called
|
|
|
* on child elements of the element whose visibility was modified.
|
|
* on child elements of the element whose visibility was modified.
|
|
|
- *
|
|
|
|
|
- * @copydoc setVisible
|
|
|
|
|
*/
|
|
*/
|
|
|
void _setVisible(bool visible);
|
|
void _setVisible(bool visible);
|
|
|
|
|
|
|
@@ -332,103 +252,67 @@ namespace BansheeEngine
|
|
|
void _setDisabled(bool disabled);
|
|
void _setDisabled(bool disabled);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Changes the active GUI element widget. This allows you to move an element
|
|
|
|
|
- * to a different viewport, or change element style by using a widget with a different skin.
|
|
|
|
|
- * You are allowed to pass null here, but elements with no parent will be unmanaged. You will be
|
|
|
|
|
- * responsible for deleting them manually, and they will not render anywhere.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
|
|
+ * Changes the active GUI element widget. This allows you to move an element to a different viewport, or change
|
|
|
|
|
+ * element style by using a widget with a different skin. You are allowed to pass null here, but elements with no
|
|
|
|
|
+ * parent will be unmanaged. You will be responsible for deleting them manually, and they will not render anywhere.
|
|
|
*/
|
|
*/
|
|
|
virtual void _changeParentWidget(GUIWidget* widget);
|
|
virtual void _changeParentWidget(GUIWidget* widget);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Registers a new child element.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**Registers a new child element. */
|
|
|
void _registerChildElement(GUIElementBase* element);
|
|
void _registerChildElement(GUIElementBase* element);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Unregisters an existing child element.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Unregisters an existing child element. */
|
|
|
void _unregisterChildElement(GUIElementBase* element);
|
|
void _unregisterChildElement(GUIElementBase* element);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Checks if element has been destroyed and is queued for deletion.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Checks if element has been destroyed and is queued for deletion. */
|
|
|
virtual bool _isDestroyed() const { return false; }
|
|
virtual bool _isDestroyed() const { return false; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Marks the element's dimensions as dirty, triggering a layout rebuild.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Marks the element's dimensions as dirty, triggering a layout rebuild. */
|
|
|
void _markLayoutAsDirty();
|
|
void _markLayoutAsDirty();
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Marks the element's contents as dirty, which causes the sprite meshes to be recreated from scratch.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Marks the element's contents as dirty, which causes the sprite meshes to be recreated from scratch. */
|
|
|
void _markContentAsDirty();
|
|
void _markContentAsDirty();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Mark only the elements that operate directly on the sprite mesh without requiring the mesh
|
|
|
|
|
- * to be recreated as dirty. This includes position, depth and clip rectangle. This will cause
|
|
|
|
|
- * the parent widget mesh to be rebuilt from its child element's meshes.
|
|
|
|
|
- *
|
|
|
|
|
- * @note Internal method.
|
|
|
|
|
|
|
+ * Mark only the elements that operate directly on the sprite mesh without requiring the mesh to be recreated as
|
|
|
|
|
+ * dirty. This includes position, depth and clip rectangle. This will cause the parent widget mesh to be rebuilt
|
|
|
|
|
+ * from its child element's meshes.
|
|
|
*/
|
|
*/
|
|
|
void _markMeshAsDirty();
|
|
void _markMeshAsDirty();
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns true if elements contents have changed since last update.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns true if elements contents have changed since last update. */
|
|
|
bool _isDirty() const { return (mFlags & GUIElem_Dirty) != 0; }
|
|
bool _isDirty() const { return (mFlags & GUIElem_Dirty) != 0; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Marks the element contents to be up to date. (i.e. processed by the GUI system)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Marks the element contents to be up to date. (i.e. processed by the GUI system) */
|
|
|
void _markAsClean();
|
|
void _markAsClean();
|
|
|
|
|
|
|
|
|
|
+ /** @endcond */
|
|
|
|
|
+
|
|
|
protected:
|
|
protected:
|
|
|
- /**
|
|
|
|
|
- * @brief Finds anchor and update parents and recursively assigns them to all children.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Finds anchor and update parents and recursively assigns them to all children. */
|
|
|
void _updateAUParents();
|
|
void _updateAUParents();
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Refreshes update parents of all child elements.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Refreshes update parents of all child elements. */
|
|
|
void refreshChildUpdateParents();
|
|
void refreshChildUpdateParents();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Finds the first parent element whose size doesn't depend on child sizes.
|
|
|
|
|
|
|
+ * Finds the first parent element whose size doesn't depend on child sizes.
|
|
|
*
|
|
*
|
|
|
- * @note This allows us to optimize layout updates and trigger them only on such parents
|
|
|
|
|
- * when their child elements contents change, compared to doing them on the entire
|
|
|
|
|
- * GUI hierarchy.
|
|
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * This allows us to optimize layout updates and trigger them only on such parents when their child elements
|
|
|
|
|
+ * contents change, compared to doing them on the entire GUI hierarchy.
|
|
|
*/
|
|
*/
|
|
|
GUIElementBase* findUpdateParent();
|
|
GUIElementBase* findUpdateParent();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Helper method for recursion in "_updateAUParents". Sets the provided anchor
|
|
|
|
|
- * parent for all children recursively. Recursion stops when a child anchor is detected.
|
|
|
|
|
- *
|
|
|
|
|
- * @see _updateParents
|
|
|
|
|
|
|
+ * Helper method for recursion in _updateAUParents(). Sets the provided anchor parent for all children recursively.
|
|
|
|
|
+ * Recursion stops when a child anchor is detected.
|
|
|
*/
|
|
*/
|
|
|
void setAnchorParent(GUIPanel* anchorParent);
|
|
void setAnchorParent(GUIPanel* anchorParent);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Helper method for recursion in "_updateAUParents". Sets the provided update
|
|
|
|
|
- * parent for all children recursively. Recursion stops when a child update parent
|
|
|
|
|
- * is detected.
|
|
|
|
|
- *
|
|
|
|
|
- * @see _updateParents
|
|
|
|
|
|
|
+ * Helper method for recursion in _updateAUParents(). Sets the provided update parent for all children recursively.
|
|
|
|
|
+ * Recursion stops when a child update parent is detected.
|
|
|
*/
|
|
*/
|
|
|
void setUpdateParent(GUIElementBase* updateParent);
|
|
void setUpdateParent(GUIElementBase* updateParent);
|
|
|
|
|
|
|
@@ -443,4 +327,6 @@ namespace BansheeEngine
|
|
|
GUIDimensions mDimensions;
|
|
GUIDimensions mDimensions;
|
|
|
GUILayoutData mLayoutData;
|
|
GUILayoutData mLayoutData;
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ /** @} */
|
|
|
}
|
|
}
|