CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
cydui::components::component_state_t Class Referenceexport
+ Collaboration diagram for cydui::components::component_state_t:

Public Member Functions

virtual ~component_state_t ()=default
 
 component_state_t ()=default
 
 component_state_t (void *props)
 
void mark_dirty ()
 Marks this component state as needing to be redrawn.
 
template<fabric::async::EventType EV>
void emit (EV ev)
 
void force_redraw ()
 Emits a RedrawEvent for this component.
 
std::string component_name () const
 
component_state_tparent ()
 
void add_children_state (const std::string &id, const component_state_ref &child)
 
bool is_animated () const
 
bool is_text_input () const
 

Public Attributes

std::string component_name_
 
component_state_tparent_ = nullptr
 
std::shared_ptr< fabric::async::async_bus_t > window = nullptr
 
std::optional< std::shared_ptr< component_base_t > > component_instance = std::nullopt
 
std::unordered_map< std::string, component_state_refchildren_states { }
 
bool _dirty = false
 
bool focused = false
 
bool hovering = false
 

Protected Member Functions

void set_component_name (const std::string &name)
 

Friends

class component_base_t
 
class component_state_delegate_t
 

Detailed Description

Definition at line 26 of file component_state.cppm.

Constructor & Destructor Documentation

◆ ~component_state_t()

virtual cydui::components::component_state_t::~component_state_t ( )
virtualdefault

◆ component_state_t() [1/2]

cydui::components::component_state_t::component_state_t ( )
default
+ Here is the caller graph for this function:

◆ component_state_t() [2/2]

cydui::components::component_state_t::component_state_t ( void * props)
inlineexplicit

Definition at line 31 of file component_state.cppm.

Member Function Documentation

◆ add_children_state()

void cydui::components::component_state_t::add_children_state ( const std::string & id,
const component_state_ref & child )
inline

Definition at line 77 of file component_state.cppm.

◆ component_name()

std::string cydui::components::component_state_t::component_name ( ) const
inline

Definition at line 69 of file component_state.cppm.

◆ emit()

template<fabric::async::EventType EV>
void cydui::components::component_state_t::emit ( EV ev)
inline

Definition at line 51 of file component_state.cppm.

+ Here is the caller graph for this function:

◆ force_redraw()

void cydui::components::component_state_t::force_redraw ( )
inline

Emits a RedrawEvent for this component.

Warning
This is only meant to be called from custom event handlers. Event handlers for events declared in cydui_events.h automatically trigger a redraw if state->mark_dirty() gets called. Use that instead.

Definition at line 64 of file component_state.cppm.

+ Here is the call graph for this function:

◆ is_animated()

bool cydui::components::component_state_t::is_animated ( ) const
inline

Definition at line 83 of file component_state.cppm.

◆ is_text_input()

bool cydui::components::component_state_t::is_text_input ( ) const
inline

Definition at line 87 of file component_state.cppm.

◆ mark_dirty()

void cydui::components::component_state_t::mark_dirty ( )
inline

Marks this component state as needing to be redrawn.

Events declared in cydui_events.h are dispatched automatically by the layout, which then checks for any dirty components that need redrawing.

It is due diligence of the component developer to appropriately mark the component as dirty when appropriate. As a baseline, any mutation to the state of a component should mark it dirty if said mutation affects how the component, or its children, are rendered.

Definition at line 46 of file component_state.cppm.

+ Here is the caller graph for this function:

◆ parent()

component_state_t * cydui::components::component_state_t::parent ( )
inline

Definition at line 73 of file component_state.cppm.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_component_name()

void cydui::components::component_state_t::set_component_name ( const std::string & name)
inlineprotected

Definition at line 97 of file component_state.cppm.

Friends And Related Symbol Documentation

◆ component_base_t

friend class component_base_t
friend

Definition at line 92 of file component_state.cppm.

◆ component_state_delegate_t

friend class component_state_delegate_t
friend

Definition at line 93 of file component_state.cppm.

Member Data Documentation

◆ _dirty

bool cydui::components::component_state_t::_dirty = false

Definition at line 110 of file component_state.cppm.

◆ children_states

std::unordered_map<std::string, component_state_ref> cydui::components::component_state_t::children_states { }

Definition at line 108 of file component_state.cppm.

◆ component_instance

std::optional<std::shared_ptr<component_base_t> > cydui::components::component_state_t::component_instance = std::nullopt

Definition at line 107 of file component_state.cppm.

◆ component_name_

std::string cydui::components::component_state_t::component_name_

Definition at line 102 of file component_state.cppm.

◆ focused

bool cydui::components::component_state_t::focused = false

Definition at line 111 of file component_state.cppm.

◆ hovering

bool cydui::components::component_state_t::hovering = false

Definition at line 112 of file component_state.cppm.

◆ parent_

component_state_t* cydui::components::component_state_t::parent_ = nullptr

Definition at line 104 of file component_state.cppm.

◆ window

std::shared_ptr<fabric::async::async_bus_t> cydui::components::component_state_t::window = nullptr

Definition at line 105 of file component_state.cppm.


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