Extra doxygen annotations on Widget
This commit is contained in:
@@ -25,6 +25,8 @@ using namespace JGL;
|
||||
namespace JUI
|
||||
{
|
||||
|
||||
/// An enumeration for mouse buttons, used by JUI to decouple from external systems.
|
||||
/// Some boilerplate is required in order to get input mechanisms up and running. See the demo files for reference.
|
||||
enum class MouseButton {
|
||||
Left = 1,
|
||||
Middle = 2,
|
||||
@@ -34,8 +36,9 @@ namespace JUI
|
||||
using namespace J3ML::Math;
|
||||
using namespace J3ML::LinearAlgebra;
|
||||
|
||||
/// Widget class is the base for all JUI elements.
|
||||
/// Widgets exist in a tree hierarchy where each object has one parent, and an arbitrary number of children.
|
||||
/// Widget is the base class for all JUI elements and represents any object that can be in the tree hierarchy.
|
||||
/// Some widgets are expressly used for layout, and therefore do not strictly speaking 'Appear' on screen.
|
||||
/// Widgets exist in a tree hierarchy where each object has one parent, and an arbitrary number of children. No circular references are allowed.
|
||||
class Widget
|
||||
{
|
||||
public:
|
||||
@@ -69,7 +72,11 @@ namespace JUI
|
||||
/// Adds a given widget to this widget's list of children.
|
||||
/// @return The widget in question.
|
||||
Widget* Add(Widget* newChild);
|
||||
|
||||
/// Returns true if this object is an ancestor to the given widget.
|
||||
bool IsAncestorOf(Widget* descendant) const;
|
||||
|
||||
/// Returns true if this object is a descendant of the given widget.
|
||||
bool IsDescendantOf(Widget* ancestor) const;
|
||||
|
||||
/// Returns the first child widget that has the given symbolic name
|
||||
@@ -88,8 +95,8 @@ namespace JUI
|
||||
[[nodiscard]] virtual Vector2 GetAbsolutePosition() const;
|
||||
[[nodiscard]] virtual float GetAbsoluteRotation() const;
|
||||
|
||||
/// Returns the parent of this widget
|
||||
/// TODO: Use std::optional here and anywhere else a nullptr could be returned.
|
||||
/// Returns the parent of this widget, or a nullptr if there is no parent.
|
||||
/// @see GetFamilyTreeRoot().
|
||||
Widget* GetParent() const;
|
||||
|
||||
/// Returns the menu-coordinates that are used to position this widget in relation to its parent.
|
||||
@@ -135,25 +142,48 @@ namespace JUI
|
||||
[[nodiscard]] Vector2 AnchorPoint() const;
|
||||
|
||||
/// Returns the padding factor on the left of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingLeft(), class UDim.
|
||||
[[nodiscard]] UDim PaddingLeft() const;
|
||||
/// Returns the padding factor on the top of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingTop(), class UDim.
|
||||
[[nodiscard]] UDim PaddingTop() const;
|
||||
/// Returns the padding factor on the right of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingRight(), class UDim.
|
||||
[[nodiscard]] UDim PaddingRight() const;
|
||||
/// Returns the padding factor on the bottom of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingBottom(), class UDim.
|
||||
[[nodiscard]] UDim PaddingBottom() const;
|
||||
|
||||
/// Sets the padding factor on the left of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingLeft(), class UDim.
|
||||
void PaddingLeft(const UDim &pad_left);
|
||||
/// Sets the padding factor on the top of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingLeft(), class UDim.
|
||||
void PaddingTop(const UDim &pad_top);
|
||||
/// Sets the padding factor on the right of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingLeft(), class UDim.
|
||||
void PaddingRight(const UDim &pad_right);
|
||||
/// Sets the padding factor on the bottom of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @see PaddingLeft(), class UDim.
|
||||
void PaddingBottom(const UDim &pad_bottom);
|
||||
|
||||
/// Sets the padding factor on the four respective sides of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
/// @param left
|
||||
/// @param top
|
||||
/// @param right
|
||||
/// @param bottom
|
||||
void Padding(const UDim& left, const UDim& top, const UDim& right, const UDim& bottom);
|
||||
|
||||
/// Sets the same padding factor on all four sides of this widget.
|
||||
/// Padding refers to spacing on the inside of elements, while margin is spacing outside the element.
|
||||
void Padding(const UDim& padding);
|
||||
|
||||
/// Returns the margin factor on the left of this widget.
|
||||
@@ -212,10 +242,14 @@ namespace JUI
|
||||
/// In a well-formed JUI menu, this **should** always be a Scene.
|
||||
Widget* GetFamilyTreeRoot() const;
|
||||
|
||||
/// Returns whether or not the mouse is inside this widget's approximate bounding-box.
|
||||
bool IsMouseInside() const;
|
||||
|
||||
void AnchorPoint(const Vector2 &point);
|
||||
|
||||
/// Returns the complete bounding box around this instance that will be rendered onto.
|
||||
/// This differs from AbsolutePosition and AbsoluteSize in that they are computed for positioning elements relative to each other.
|
||||
/// Only this method represents the full bounding box of the widget.
|
||||
[[nodiscard]] virtual AABB2D GetActualRenderBounds() const;
|
||||
|
||||
public:
|
||||
|
@@ -140,7 +140,10 @@ namespace JUI {
|
||||
bool Widget::IsVisible() const { return visible; }
|
||||
void Widget::Visible(bool enabled) { visible = enabled;}
|
||||
|
||||
Widget* Widget::GetParent() const { return parent;}
|
||||
Widget* Widget::GetParent() const {
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
UDim2 Widget::Position() const { return position; }
|
||||
void Widget::Position(const UDim2& pos) { position = pos; }
|
||||
|
Reference in New Issue
Block a user