Displays text (single or multi-line). More...
#include <label.h>


Public Member Functions | |
| TuiLabel (const String &text=String(), ObjectBase *parent=nullptr) | |
| void | setText (const String &text) |
| Sets the display text. | |
| const String & | text () const |
| Returns the display text. | |
| void | setAlignment (TuiAlignment align) |
| Sets the text alignment. | |
| TuiAlignment | alignment () const |
| Returns the text alignment. | |
| void | setWordWrap (bool wrap) |
| Enables or disables word wrapping. | |
| bool | wordWrap () const |
| Returns true if word wrapping is enabled. | |
| Size2Di32 | sizeHint () const override |
| Returns the preferred size. Override in subclasses. | |
Public Member Functions inherited from TuiWidget | |
| TuiWidget (ObjectBase *parent=nullptr) | |
| Constructs a TuiWidget. | |
| virtual | ~TuiWidget () |
| Destructor. | |
| const Rect2Di32 & | geometry () const |
| Returns the geometry relative to parent. | |
| void | setGeometry (const Rect2Di32 &rect) |
| Sets the geometry. | |
| int | x () const |
| Returns the X coordinate relative to parent. | |
| int | y () const |
| Returns the Y coordinate relative to parent. | |
| int | width () const |
| Returns the width. | |
| int | height () const |
| Returns the height. | |
| Size2Di32 | size () const |
| Returns the size. | |
| const Size2Di32 & | minimumSize () const |
| Returns the minimum size constraint. | |
| void | setMinimumSize (const Size2Di32 &size) |
| Sets the minimum size constraint. | |
| const Size2Di32 & | maximumSize () const |
| Returns the maximum size constraint. | |
| void | setMaximumSize (const Size2Di32 &size) |
| Sets the maximum size constraint. | |
| TuiSizePolicy | sizePolicy () const |
| Returns the size policy. | |
| void | setSizePolicy (TuiSizePolicy policy) |
| Sets the size policy. | |
| bool | isVisible () const |
| Returns true if the widget's own visibility flag is set. | |
| bool | isEffectivelyVisible () const |
| Returns true if the widget and all its ancestors are visible. | |
| void | show () |
| Shows the widget. | |
| void | hide () |
| Hides the widget. | |
| void | setVisible (bool visible) |
| Sets visibility. | |
| bool | isEnabled () const |
| Returns true if the widget is enabled. | |
| void | setEnabled (bool enabled) |
| Sets enabled state. | |
| TuiFocusPolicy | focusPolicy () const |
| Returns the focus policy. | |
| void | setFocusPolicy (TuiFocusPolicy policy) |
| Sets the focus policy. | |
| bool | hasFocus () const |
| Returns true if this widget has focus. | |
| void | setFocus () |
| Requests focus for this widget. | |
| void | update () |
| Marks the widget as needing a repaint. | |
| bool | isDirty () const |
| Returns true if the widget needs repainting. | |
| void | clearDirty () |
| Clears the dirty flag. | |
| TuiLayout * | layout () const |
| Returns the layout, if one is set. | |
| void | setLayout (TuiLayout *layout) |
| Sets the layout for this widget. | |
| Point2Di32 | mapToParent (const Point2Di32 &p) const |
| Maps a local point to the parent's coordinate system. | |
| Point2Di32 | mapFromParent (const Point2Di32 &p) const |
| Maps a parent point to local coordinates. | |
| Point2Di32 | mapToGlobal (const Point2Di32 &p) const |
| Maps a local point to global (screen) coordinates. | |
| Point2Di32 | mapFromGlobal (const Point2Di32 &p) const |
| Maps a global (screen) point to local coordinates. | |
| virtual Size2Di32 | minimumSizeHint () const |
| Returns the minimum size hint. Override in subclasses. | |
Public Member Functions inherited from ObjectBase | |
| ObjectBase (ObjectBase *p=nullptr) | |
| Default ObjectBase constructor. | |
| virtual | ~ObjectBase () |
| Destructor. Emits aboutToDestroy, detaches from parent, and destroys children. | |
| ObjectBase * | parent () 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 ObjectBaseList & | childList () 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. | |
| EventLoop * | eventLoop () 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) |
Protected Member Functions | |
| void | paintEvent (TuiPaintEvent *e) override |
| Called to paint the widget. Override in subclasses. | |
Protected Member Functions inherited from TuiWidget | |
| virtual void | keyEvent (KeyEvent *e) |
| Called on keyboard input. Override in subclasses. | |
| virtual void | mouseEvent (MouseEvent *e) |
| Called on mouse input. Override in subclasses. | |
| virtual void | resizeEvent (TuiResizeEvent *e) |
| Called when the widget is resized. Override in subclasses. | |
| virtual void | focusInEvent (Event *e) |
| Called when the widget gains focus. | |
| virtual void | focusOutEvent (Event *e) |
| Called when the widget loses focus. | |
| void | event (Event *e) override |
| Event dispatch override. | |
Protected Member Functions inherited from ObjectBase | |
| ObjectBase * | signalSender () |
| Returns the ObjectBase that emitted the signal currently being handled. | |
| virtual void | timerEvent (TimerEvent *e) |
| Called when a timer fires for this object. | |
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 MetaInfo & | metaInfo () |
| 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 char * | aboutToDestroySignalName = PROMEKI_STRINGIFY( aboutToDestroy ) "(" PROMEKI_STRINGIFY_ARGS( ObjectBase * ) ")" |
| static SignalMeta | aboutToDestroySignalMeta = SignalMeta(metaInfo(), aboutToDestroySignalName) |
Displays text (single or multi-line).
|
overrideprotectedvirtual |
Called to paint the widget. Override in subclasses.
Reimplemented from TuiWidget.
|
overridevirtual |
Returns the preferred size. Override in subclasses.
Reimplemented from TuiWidget.