Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::InherenceWithPriorityObject< TType > Class Template Reference

InherenceObject variant that keeps children sorted by priority. More...

#include <spk_inherence_with_priority_object.hpp>

Inheritance diagram for spk::InherenceWithPriorityObject< TType >:
Inheritance graph
Collaboration diagram for spk::InherenceWithPriorityObject< TType >:
Collaboration graph

Public Types

using Priority = std::size_t
 Priority value type used for sorting.

Public Member Functions

 InherenceWithPriorityObject ()
 Builds a priority-aware inherence object.
void addChild (TType *p_child) override
 Adds a child and re-sorts by priority.
void setPriority (const Priority &p_priority)
 Sets this node's priority and refreshes parent ordering.
const Prioritypriority () const
 Returns the current priority value.
Public Member Functions inherited from spk::InherenceObject< TType >
virtual void removeChild (TType *p_child)
 Removes a child from this node.
TType * parent () const
 Returns the parent pointer.
virtual std::vector< TType * > & children ()
 Returns the children vector.
virtual const std::vector< TType * > & children () const
 Returns the children vector.
void clearChildren ()
 Clears the children list and resets each child's parent pointer.

Protected Member Functions

void _sortChildByPriority ()
 Sorts children by descending priority.
void _notifyParentPriorityChanged ()
 Notifies the parent that this node's priority changed.

Detailed Description

template<typename TType>
class spk::InherenceWithPriorityObject< TType >

InherenceObject variant that keeps children sorted by priority.

Template Parameters
TTypeDerived type inheriting from InherenceWithPriorityObject.
See also
InherenceObject
Widget child;
child.setPriority(10);
parent.addChild(&child);
TType * parent() const
Returns the parent pointer.
Definition spk_inherence_object.hpp:85
InherenceObject variant that keeps children sorted by priority.
Definition spk_inherence_with_priority_object.hpp:28
Base class for interactive UI elements handling focus and events.
Definition spk_widget.hpp:52
void addChild(Widget *p_child) override
Adds a child widget and sorts the hierarchy by layer.
Definition spk_widget.cpp:130

Member Function Documentation

◆ addChild()

template<typename TType>
void spk::InherenceWithPriorityObject< TType >::addChild ( TType * p_child)
inlineoverridevirtual

Adds a child and re-sorts by priority.

Parameters
p_childChild pointer to add.

Reimplemented from spk::InherenceObject< TType >.

Here is the call graph for this function:

◆ priority()

template<typename TType>
const Priority & spk::InherenceWithPriorityObject< TType >::priority ( ) const
inline

Returns the current priority value.

Returns
Priority value.

◆ setPriority()

template<typename TType>
void spk::InherenceWithPriorityObject< TType >::setPriority ( const Priority & p_priority)
inline

Sets this node's priority and refreshes parent ordering.

Parameters
p_priorityNew priority value.
Here is the call graph for this function:

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