terminalgui
0.1.0
Widgets for your terminal, powered by Qt! Create textual GUI (TUI) in your console easily.
|
Public Slots | |
void | setActiveTextColor (const Tg::Color &activeTextColor) |
void | setActiveBackgroundColor (const Tg::Color &activeBackgroundColor) |
void | setInactiveTextColor (const Tg::Color &inactiveTextColor) |
void | setInactiveBackgroundColor (const Tg::Color &inactiveBackgroundColor) |
void | setPressedTextColor (const Tg::Color &pressedTextColor) |
void | setPressedBackgroundColor (const Tg::Color &pressedBackgroundColor) |
![]() | |
void | setText (const QString &text, const bool expand=false) |
void | setHighlighted (const bool highlighted) |
![]() | |
void | setPosition (const QPoint &position) |
Moves Widget to a new position. More... | |
void | setSize (const QSize &size) |
Resizes Widget to a new size. | |
void | setBackgroundColor (const Tg::Color &color) |
Changes background color. | |
void | setBackgroundCharacter (const QChar &character) |
Changes character drawn in the empty space of this Widget. | |
void | setTextColor (const Tg::Color &color) |
Changes text color. | |
void | setBorderTextColor (const Tg::Color &color) |
Changes border text color. | |
void | setBorderBackgroundColor (const Tg::Color &color) |
Changes border background color. | |
void | setVisible (const bool visible) |
Makes Widget visible (or not). More... | |
void | show () |
Makes Widget visible. More... | |
void | hide () |
Makes Widget hidden. More... | |
void | setBorderVisible (const bool visible) |
Makes Widget's border visible (or not). | |
void | setZ (const int z) |
WidgetList | childrenWidgets () const |
Returns all children of this Widget which can be cast to Widget. | |
Signals | |
void | clicked () const |
void | activeTextColorChanged (const Tg::Color &activeTextColor) const |
void | activeBackgroundColorChanged (const Tg::Color &activeBackgroundColor) const |
void | inactiveTextColorChanged (const Tg::Color &inactiveTextColor) const |
void | inactiveBackgroundColorChanged (const Tg::Color &inactiveBackgroundColor) const |
void | pressedTextColorChanged (const Tg::Color &pressedTextColor) const |
void | pressedBackgroundColorChanged (const Tg::Color &pressedBackgroundColor) const |
![]() | |
void | textChanged (const QString &text) const |
void | highlightedChanged (const bool highlighted) const |
![]() | |
void | needsRedraw (const RedrawType type, const Widget *widget) const |
Indicates that widget (usually this ) needs to be redrawn using redraw type. | |
void | positionChanged (const QPoint &position) const |
Emitted when Widget's position changes. | |
void | sizeChanged (const QSize &size) const |
Emitted when Widget's size is changed. | |
void | backgroundColorChanged (const Tg::Color &color) const |
Indicates that Widget's background color has changed. | |
void | backgroundCharacterChanged (const QChar &character) const |
Indicates that Widget's background character has changed. | |
void | textColorChanged (const Tg::Color &color) const |
Indicates that Widget's text color has changed. | |
void | borderTextColorChanged (const Tg::Color &color) const |
Indicates that Widget's border text color has changed. | |
void | borderBackgroundColorChanged (const Tg::Color &color) const |
Indicates that Widget's border background color has changed. | |
void | visibleChanged (const bool visible) const |
Indicates that Widget is shown or hidden (depening on visible). | |
void | borderVisibleChanged (const bool visible) const |
Indicates that Widget's border is now visible (or not). | |
void | acceptsFocusChanged (const bool accepts) const |
Indicates that Widget now accepts focus (or not). | |
void | hasFocusChanged (const bool hasFocus) const |
Indicates that Widget now hasFocus (or not). | |
void | moveFocusToPreviousWidget () const |
Indicates that active focus should be moved to the previous Widget ready to receive it. | |
void | moveFocusToNextWidget () const |
Indicates that active focus should be moved to the next Widget ready to receive it. | |
void | propagatesStyleChanged (const bool propagates) const |
Indicates that Widget either stopped or resumed (propagates) propagating its Style object to its children. | |
void | styleChanged () const |
Emitted when Widget's Style object is changed. | |
void | layoutOvershootChanged (const SizeOvershoot overshoot) const |
Emitted when layout overshoot has changed. | |
void | widgetOvershootChanged (const SizeOvershoot overshoot) const |
Emitted when Widget overshoot has changed. | |
void | childAdded (Widget *child) const |
Emitted when a child Widget has been added. | |
void | childRemoved () const |
Emitted when a child Widget has been removed. | |
void | zChanged (const int z) const |
Emitted when z value changes. | |
Public Member Functions | |
Button (Widget *parent) | |
Button (Screen *screen) | |
Button (const QString &text=QString(), Widget *parent=nullptr) | |
Button (const QString &text=QString(), Screen *screen=nullptr) | |
Tg::Color | activeTextColor () const |
Tg::Color | activeBackgroundColor () const |
Tg::Color | inactiveTextColor () const |
Tg::Color | inactiveBackgroundColor () const |
Tg::Color | pressedTextColor () const |
Tg::Color | pressedBackgroundColor () const |
void | click () |
![]() | |
Label (Widget *parent) | |
Label (Screen *screen) | |
Label (const QString &text=QString(), Widget *parent=nullptr) | |
Label (const QString &text=QString(), Screen *screen=nullptr) | |
QString | text () const |
bool | highlighted () const |
![]() | |
Widget (Widget *parent) | |
Constructs Widget as a child of parent. More... | |
Widget (Screen *screen) | |
Constructs a top-level Widget on a given screen. More... | |
~Widget () | |
Deregisters the Widget from parent Screen, then destroys the Widget object. | |
QPoint | position () const |
Returns current position of the Widget (relative). More... | |
QSize | size () const |
Returns current size of the Widget. More... | |
QRect | boundingRectangle () const |
Returns the rectangle constructed from position() and size(). More... | |
QRect | globalBoundingRectangle () const |
Returns the rectangle contructed from position() (mapped to global coordinates using mapToGlobal()) and size(). More... | |
QRect | contentsRectangle () const |
Returns the rectangle which holds Widget interior. More... | |
Tg::Color | backgroundColor () const |
Returns current background color - either taken from Style or value set using setBackgroundColor(). More... | |
QChar | backgroundCharacter () const |
Returns character drawn on empty space in this Widget. | |
Tg::Color | textColor () const |
Returns current text color - either taken from Style or value set using setTextColor(). More... | |
Tg::Color | borderTextColor () const |
Returns current border text color - either taken from Style or value set using setBorderTextColor(). More... | |
Tg::Color | borderBackgroundColor () const |
Returns current border background color - either taken from Style or value set using setBorderBackgroundColor(). More... | |
bool | visible () const |
Returns true when Widget is visible. | |
bool | borderVisible () const |
Returns true when Widget's border is visible. More... | |
bool | acceptsFocus () const |
Returns true when Widget is set to accept focus (keyboard or mouse). More... | |
bool | hasFocus () const |
Returns true when Widget actively holds focus (is receiving keyboard events). More... | |
void | setAcceptsFocus (const bool accept) |
When accept is true , this Widget will receive keyboard events from Screen instance - but only when it actively holds focus (see hasFocus()). More... | |
Screen * | screen () const |
Returns the Screen on which this Widget is being drawn. | |
Widget * | parentWidget () const |
Returns the parent Widget. More... | |
Widget * | topLevelParentWidget () const |
Returns top-level parent of current Widget. More... | |
bool | isTopLevel () const |
Returns true if this Widget is top-level. More... | |
bool | isBorder (const QPoint &pixel) const |
Returns true when pixel lies within the border of the Widget. More... | |
bool | verticalArrowsMoveFocus () const |
Returns true if this Widget ignores up and down arrows on keyboard. More... | |
QPoint | mapFromGlobal (const QPoint &position) const |
Returns position mapped from global coordinates into local one (coordinates within the Widget, where (0,0) is top-left corner). | |
QPoint | mapToGlobal (const QPoint &position) const |
Returns position mapped from local coordinates into global ones (coordinates within parent Screen). | |
QPoint | mapToChild (const WidgetPointer &child, const QPoint &position) const |
Returns position mapped into child coordinate system. | |
bool | propagatesStyle () const |
Returns true if this Widget automatically applies its Style to all children Widgets. More... | |
void | setStyle (const StylePointer &style, const bool propagate=true) |
Sets a new Style on this Widget. More... | |
Layout::Type | layoutType () const |
Returns Layout type. More... | |
void | setLayoutType (const Layout::Type type) |
Sets the way this Widget places, paints and treats children widgets to type. | |
SizeOvershoot | layoutOvershoot () const |
Returns current overshoot of layout inside this Widget. More... | |
SizeOvershoot | widgetOvershoot () const |
Returns current overshoot of contents of this Widget. More... | |
int | z () const |
Returns the z value - position of this Widget on z order stack. | |
Protected Slots | |
void | onButtonPressTimeout () |
void | onHasFocusChanged () |
![]() | |
void | scheduleFullRedraw () const |
Instructs Screen that full redraw of entire Screen area should be performed. More... | |
void | schedulePartialRedraw () const |
Instructs Screen to redraw this Widget only, at its current position. More... | |
void | schedulePreviousPositionRedraw () const |
Instructs Screen to redraw the area previously occupied by this Widget. More... | |
Protected Member Functions | |
void | init () override |
Initializes Widget and it's connections. More... | |
void | consumeKeyboardBuffer (const QString &keyboardBuffer) override |
Called when Widget accepts focus and keyboardBuffer is not empty. More... | |
![]() | |
void | init () override |
Initializes Widget and it's connections. More... | |
QString | drawPixel (const QPoint &pixel) const override |
Returns ANSI-encoded string, used by Screen to draw the pixel. More... | |
int | reservedCharactersCount () const |
QString | reservedText () const |
void | setReservedText (const QString &reserved) |
![]() | |
void | setHasFocus (const bool active) |
Sets this Widget to hold active focus (or not). More... | |
virtual QString | drawBorderPixel (const QPoint &pixel) const |
Returns ANSI-encoded string, used by Screen to draw the pixel. More... | |
QPoint | previousGlobalPosition () const |
Returns Widget's last position (before it was moved), in global coordinates. More... | |
QSize | previousSize () const |
Returns Widget's previous size (before it was resized). More... | |
QRect | globalPreviousBoundingRectangle () const |
Returns globalBoundingRectangle() recorded last time when widget was moved or its size has been changed. | |
int | effectiveBorderWidth () const |
If borders are visible, it returns border width. More... | |
void | setVerticalArrowsMoveFocus (const bool enable) |
If enable is true , clicking up arrow or down arrow on keyboard will be intercepted by parent Screen and used to switch focus to previous or next Widget. More... | |
void | setPropagatesStyle (const bool propagate) |
When propagate is true , this Widget will set its style() object on its children whenever it changes. More... | |
void | propagateStyleToChild (Widget *child) const |
Propagates style() to child. More... | |
StylePointer | style () const |
Returns the pointer to Style object used to draw this Widget. More... | |
void | setWidgetOvershoot (const SizeOvershoot overshoot) |
Sets current overshoot of the contents of this Widget. | |
void | setupPressTimer (QTimer *timer) const |
Sets timer object which controls how long pressed elements (buttons, scroll bar arrows, etc.) look different (pressed). More... | |
void | doLayout () |
Forces Widget to lay out its children according to layoutType(). More... | |
Properties | |
Tg::Color | activeTextColor |
Tg::Color | activeBackgroundColor |
Tg::Color | inactiveTextColor |
Tg::Color | inactiveBackgroundColor |
Tg::Color | pressedTextColor |
Tg::Color | pressedBackgroundColor |
![]() | |
QString | text |
bool | highlighted |
![]() | |
QPoint | position |
Position of Widget. More... | |
QSize | size |
Size of the Widget. More... | |
int | z |
Widget position on the z axis - this is used to control which Widgets should be displayed above and which below if they overlap. | |
Tg::Color | backgroundColor |
Color of the background of Widget's interior (contentsRectangle()). More... | |
QChar | backgroundCharacter |
This is the character which fills the empty background. More... | |
Tg::Color | textColor |
Color of the characters ("foreground color") printed inside of the Widget (see contentsRectangle()). More... | |
Tg::Color | borderTextColor |
Color of the characters ("foreground color") printed on the borders of the Widget (see boundingRectangle()). More... | |
Tg::Color | borderBackgroundColor |
Color of the background of Widget's border (see boundingRectangle()). More... | |
bool | visible |
A visible Widget is visible. More... | |
bool | borderVisible |
Controls whether border is drawn. More... | |
bool | acceptsFocus |
When true, Widget will receive keyboard signals (Screen will call consumeKeyboardBuffer()) when its turn comes. | |
bool | hasFocus |
Returns true when Widget is currently actively listening to keyboard signals. More... | |
bool | propagatesStyle |
If true , Widget will set its Style object on its children widgets. More... | |
|
overrideprotectedvirtual |
Called when Widget accepts focus and keyboardBuffer is not empty.
Reimplemented from Tg::Widget.
Reimplemented in Tg::RadioButton, and Tg::CheckBox.
|
overrideprotectedvirtual |
Initializes Widget and it's connections.
All subclasses should call init() of its parent class. If a subclass has any properties or signals which affect the visual look of the Widget, it should reimplement init() and connect such signal to schedulePartialRedraw() slot.
Reimplemented from Tg::Widget.
Reimplemented in Tg::RadioButton, and Tg::CheckBox.