libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
TuiBoxLayout Class Reference

Layout that arranges widgets in a horizontal or vertical line. More...

#include <layout.h>

Inheritance diagram for TuiBoxLayout:
Collaboration diagram for TuiBoxLayout:

Public Member Functions

 TuiBoxLayout (TuiBoxDirection direction, ObjectBase *parent=nullptr)
 Constructs a TuiBoxLayout.
 
TuiBoxDirection direction () const
 Returns the direction.
 
void addWidget (TuiWidget *widget) override
 Adds a widget to the ordered item list.
 
void addLayout (TuiLayout *layout) override
 Adds a sub-layout to the ordered item list.
 
void addStretch (int factor=1)
 Adds a stretch item with the given factor.
 
void setStretch (int index, int factor)
 Sets the stretch factor for the item at the given index.
 
void calculateLayout (const Rect2Di32 &available) override
 Calculates and applies the layout.
 
Size2Di32 sizeHint () const override
 Returns the preferred size based on children and direction.
 
- Public Member Functions inherited from TuiLayout
 TuiLayout (ObjectBase *parent=nullptr)
 
void removeWidget (TuiWidget *widget)
 Removes a widget from this layout.
 
void setMargins (int top, int right, int bottom, int left)
 Sets the margins (top, right, bottom, left).
 
void setMargins (int margin)
 Sets uniform margins.
 
void setSpacing (int spacing)
 Sets the spacing between items.
 
int spacing () const
 Returns the spacing.
 
void margins (int &top, int &right, int &bottom, int &left) const
 Returns the margins.
 
const List< TuiWidget * > & widgets () const
 Returns the list of managed widgets.
 
const List< TuiLayout * > & layouts () const
 Returns the list of sub-layouts.
 
- Public Member Functions inherited from ObjectBase
 ObjectBase (ObjectBase *p=nullptr)
 Default ObjectBase constructor.
 
virtual ~ObjectBase ()
 Destructor. Emits aboutToDestroy, detaches from parent, and destroys children.
 
ObjectBaseparent () const
 Returns the parent object, if one. nullptr if none.
 
void setParent (ObjectBase *p)
 Sets the parent of this object. If the object already has a parent, it will be removed as a child from the old parent and added as a child to the new one.
 
const ObjectBaseListchildList () const
 Returns a list of children of this object.
 
template<typename... Args>
int registerSlot (Slot< Args... > *slot)
 Registers a slot with this object and assigns it an ID.
 
EventLoopeventLoop () const
 Returns the EventLoop this object is affiliated with.
 
void moveToThread (EventLoop *loop)
 Changes the EventLoop affinity of this object.
 
int startTimer (unsigned int intervalMs, bool singleShot=false)
 Starts a timer on this object's EventLoop.
 
void stopTimer (int timerId)
 Stops a timer previously started with startTimer().
 
template<typename... Args>
PROMEKI_NAMESPACE_BEGIN void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 

Additional Inherited Members

- Public Types inherited from ObjectBase
using SlotVariantFunc = std::function< void(const VariantList &)>
 Function type for invoking a slot with a list of Variants.
 
- Static Public Member Functions inherited from ObjectBase
static const MetaInfometaInfo ()
 Returns the MetaInfo for the ObjectBase class.
 
template<typename... Args>
static void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 connects a signal and slot together. This function assumes both the signal and slot exist in a ObjectBase or derived object
 
- Public Attributes inherited from ObjectBase
Signal< ObjectBase * > aboutToDestroySignal = Signal< ObjectBase * >(this, aboutToDestroySignalName)
 
- Static Public Attributes inherited from ObjectBase
static constexpr const charaboutToDestroySignalName = PROMEKI_STRINGIFY( aboutToDestroy ) "(" PROMEKI_STRINGIFY_ARGS( ObjectBase * ) ")"
 
static SignalMeta aboutToDestroySignalMeta = SignalMeta(metaInfo(), aboutToDestroySignalName)
 
- Protected Member Functions inherited from TuiLayout
Rect2Di32 contentRect (const Rect2Di32 &available) const
 Returns the content rect after subtracting margins.
 
- Protected Member Functions inherited from ObjectBase
ObjectBasesignalSender ()
 Returns the ObjectBase that emitted the signal currently being handled.
 
virtual void event (Event *e)
 Called by EventLoop to deliver events to this object.
 
virtual void timerEvent (TimerEvent *e)
 Called when a timer fires for this object.
 
- Protected Attributes inherited from TuiLayout
List< TuiWidget * > _widgets
 
List< TuiLayout * > _layouts
 

Detailed Description

Layout that arranges widgets in a horizontal or vertical line.

Items are added in order via addWidget(), addLayout(), or addStretch(). All three are placed into a single ordered list so that sub-layouts participate in size negotiation and positioning just like widgets.

Constructor & Destructor Documentation

◆ TuiBoxLayout()

TuiBoxLayout::TuiBoxLayout ( TuiBoxDirection  direction,
ObjectBase parent = nullptr 
)

Constructs a TuiBoxLayout.

Parameters
directionThe layout direction.
parentOptional parent.

Member Function Documentation

◆ addLayout()

void TuiBoxLayout::addLayout ( TuiLayout layout)
overridevirtual

Adds a sub-layout to the ordered item list.

Reimplemented from TuiLayout.

◆ addWidget()

void TuiBoxLayout::addWidget ( TuiWidget widget)
overridevirtual

Adds a widget to the ordered item list.

Reimplemented from TuiLayout.

◆ calculateLayout()

void TuiBoxLayout::calculateLayout ( const Rect2Di32 available)
overridevirtual

Calculates and applies the layout.

Implements TuiLayout.

◆ sizeHint()

Size2Di32 TuiBoxLayout::sizeHint ( ) const
overridevirtual

Returns the preferred size based on children and direction.

Reimplemented from TuiLayout.


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