Simple GUI Library
Sgl::Shape Class Reference
Inheritance diagram for Sgl::Shape:
Collaboration diagram for Sgl::Shape:

Public Member Functions

 Shape (Sml::Color fillColor=Sml::COLOR_TRANSPARENT)
 
 Shape (const Background *background)
 
virtual void layout () override final
 
virtual bool isResizable () const override final
 
Sml::Color getFillColor () const
 
void setFillColor (Sml::Color color)
 
const BackgroundgetBackground () const
 
void setBackground (const Background *background)
 
const BordergetBorder () const
 
void setBorder (const Border *border)
 
virtual int32_t computeMinWidth (int32_t height=-1) const override final
 
virtual int32_t computeMinHeight (int32_t width=-1) const override final
 
virtual int32_t computeMaxWidth (int32_t height=-1) const override final
 
virtual int32_t computeMaxHeight (int32_t width=-1) const override final
 
- Public Member Functions inherited from Sgl::Component
virtual ComponentgetHitComponent (int32_t x, int32_t y)
 
virtual void render (const Sml::Rectangle< int32_t > &targetRegion)=0
 
virtual void prerender ()
 
virtual bool containsComponent (Component *component)
 
virtual Sml::EventDispatchChain * buildEventDispatchChain (Sml::EventDispatchChain *chain) override
 
bool isVisible () const
 
void setVisible (bool visible)
 
bool isInteractable () const
 
void setInteractable (bool interactable)
 
Visibility getVisibility () const
 
void setVisibility (Visibility visibility)
 
bool isFocused () const
 
bool isHovered () const
 
void requestFocus ()
 
void requestDrag ()
 
const ShadowgetShadow () const
 
void setShadow (const ShadowSpecification *specification)
 
GuiEventDispatchergetEventDispatcher ()
 
ScenegetScene ()
 
void setScene (Scene *scene)
 
const ParentgetParent () const
 
ParentgetModifiableParent ()
 
void setParent (Parent *parent)
 
Sml::Vec2i computeLocalToScenePos (const Sml::Vec2i &localPos) const
 
Sml::Vec2i computeSceneToLocalPos (const Sml::Vec2i &scenePos) const
 
Sml::Rectangle< int32_t > getOriginBounds () const
 
const Sml::Rectangle< int32_t > & getLayoutBounds () const
 
const Sml::Vec2i & getLayoutPos () const
 
int32_t getLayoutX () const
 
int32_t getLayoutY () const
 
int32_t getLayoutWidth () const
 
int32_t getLayoutHeight () const
 
void setLayoutX (int32_t x)
 
void setLayoutY (int32_t y)
 
void setLayoutWidth (int32_t width)
 
void setLayoutHeight (int32_t height)
 
Sml::Vec2i computeScenePos ()
 
virtual int32_t computePrefWidth (int32_t height=-1) const =0
 
virtual int32_t computePrefHeight (int32_t width=-1) const =0
 

Protected Attributes

Sml::Color m_FillColor = Sml::COLOR_TRANSPARENT
 
const Backgroundm_Background = nullptr
 
const Borderm_Border = nullptr
 
- Protected Attributes inherited from Sgl::Component
Visibility m_Visibility = Visibility::VISIBLE_INTERACTABLE
 
bool m_Focused = false
 
bool m_Hovered = false
 
Shadow m_Shadow
 
GuiEventDispatcher m_Dispatcher
 
Scenem_Scene = nullptr
 
Parentm_Parent = nullptr
 
Sml::Rectangle< int32_t > m_LayoutBounds = {{0, 0}, 0, 0}
 

Additional Inherited Members

- Public Types inherited from Sgl::Component
enum class  Visibility { INVISIBLE_DISABLED = 0b00 , INVISIBLE_INTERACTABLE = 0b01 , VISIBLE_DISABLED = 0b10 , VISIBLE_INTERACTABLE = 0b11 }
 Used to determine if Component should be rendered and targeted by events. More...
 
- Public Attributes inherited from Sgl::Component
friend Scene
 
- Static Public Attributes inherited from Sgl::Component
static const int32_t USE_COMPUTED_SIZE = INT32_MIN
 
static const int32_t UNLIMITED_SIZE = INT32_MAX
 
- Protected Member Functions inherited from Sgl::Component
void updateShadow ()
 
void renderShadow (const Sml::Rectangle< int32_t > &targetRegion)
 
virtual void setSceneInSceneTree (Scene *scene)
 

Detailed Description

Definition at line 17 of file shape.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

Sgl::Shape::Shape ( Sml::Color  fillColor = Sml::COLOR_TRANSPARENT)

Definition at line 13 of file shape.cpp.

◆ Shape() [2/2]

Sgl::Shape::Shape ( const Background background)

Definition at line 14 of file shape.cpp.

Member Function Documentation

◆ computeMaxHeight()

int32_t Sgl::Shape::computeMaxHeight ( int32_t  width = -1) const
finaloverridevirtual

Implements Sgl::Component.

Definition at line 42 of file shape.cpp.

◆ computeMaxWidth()

int32_t Sgl::Shape::computeMaxWidth ( int32_t  height = -1) const
finaloverridevirtual

Implements Sgl::Component.

Definition at line 41 of file shape.cpp.

◆ computeMinHeight()

int32_t Sgl::Shape::computeMinHeight ( int32_t  width = -1) const
finaloverridevirtual

Implements Sgl::Component.

Definition at line 39 of file shape.cpp.

◆ computeMinWidth()

int32_t Sgl::Shape::computeMinWidth ( int32_t  height = -1) const
finaloverridevirtual

Implements Sgl::Component.

Definition at line 38 of file shape.cpp.

◆ getBackground()

const Background * Sgl::Shape::getBackground ( ) const

Definition at line 32 of file shape.cpp.

◆ getBorder()

const Border * Sgl::Shape::getBorder ( ) const

Definition at line 35 of file shape.cpp.

◆ getFillColor()

Sml::Color Sgl::Shape::getFillColor ( ) const

Definition at line 29 of file shape.cpp.

◆ isResizable()

bool Sgl::Shape::isResizable ( ) const
finaloverridevirtual

Implements Sgl::Component.

Definition at line 17 of file shape.cpp.

◆ layout()

void Sgl::Shape::layout ( )
finaloverridevirtual

Reimplemented from Sgl::Component.

Definition at line 16 of file shape.cpp.

◆ setBackground()

void Sgl::Shape::setBackground ( const Background background)

Definition at line 33 of file shape.cpp.

◆ setBorder()

void Sgl::Shape::setBorder ( const Border border)

Definition at line 36 of file shape.cpp.

◆ setFillColor()

void Sgl::Shape::setFillColor ( Sml::Color  color)

Definition at line 30 of file shape.cpp.

Member Data Documentation

◆ m_Background

const Background* Sgl::Shape::m_Background = nullptr
protected

Definition at line 49 of file shape.h.

◆ m_Border

const Border* Sgl::Shape::m_Border = nullptr
protected

Definition at line 50 of file shape.h.

◆ m_FillColor

Sml::Color Sgl::Shape::m_FillColor = Sml::COLOR_TRANSPARENT
protected

Definition at line 48 of file shape.h.


The documentation for this class was generated from the following files: