Loading...
Searching...
No Matches
elements.hpp File Reference

Go to the source code of this file.

## Namespaces

namespace | ftxui
namespace | ftxui::Dimension
| Define how the Screen's dimensions should look like.

## Typedefs

using | Element = std::shared_ptr< Node >
using | Elements = std::vector< Element >
using | Decorator = std::function< Element(Element)>
using | GraphFunction = std::function< std::vector< int >(int, int)>

## Enumerations

enum | BorderStyle { LIGHT , DASHED , HEAVY , DOUBLE , ROUNDED , EMPTY }
enum | WidthOrHeight { WIDTH , HEIGHT }
enum | Constraint { LESS_THAN , EQUAL , GREATER_THAN }

## Functions

Element | operator| (Element element, Decorator decorator)
| From an element, apply a decorator.
Element & | operator|= (Element &e, Decorator d)
| Apply a decorator to an element.
Elements | operator| (Elements elements, Decorator decorator)
| From a set of element, apply a decorator to every elements.
Decorator | operator| (Decorator a, Decorator b)
| Compose two decorator into one.
Element | text (std::string text)
| Display a piece of UTF8 encoded unicode text.
Element | vtext (std::string text)
| Display a piece of unicode text vertically.
Element | separator ()
| Draw a vertical or horizontal separation in between two other elements.
Element | separatorLight ()
| Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Element | separatorDashed ()
| Draw a vertical or horizontal separation in between two other elements, using the DASHED style.
Element | separatorHeavy ()
| Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
Element | separatorDouble ()
| Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Element | separatorEmpty ()
| Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.
Element | separatorStyled (BorderStyle style)
| Draw a vertical or horizontal separation in between two other elements.
Element | separator (Pixel pixel)
| Draw a separator in between two element filled with a given pixel.
Element | separatorCharacter (std::string value)
| Draw a vertical or horizontal separation in between two other elements.
Element | separatorHSelector (float left, float right, Color unselected_color, Color selected_color)
| Draw an horizontal bar, with the area in between left/right colored differently.
Element | separatorVSelector (float up, float down, Color unselected_color, Color selected_color)
| Draw an vertical bar, with the area in between up/downcolored differently.
Element | gauge (float progress)
| Draw a high definition progress bar.
Element | gaugeLeft (float progress)
| Draw a high definition progress bar progressing from right to left.
Element | gaugeRight (float progress)
| Draw a high definition progress bar progressing from left to right.
Element | gaugeUp (float progress)
| Draw a high definition progress bar progressing from bottom to top.
Element | gaugeDown (float progress)
| Draw a high definition progress bar progressing from top to bottom.
Element | gaugeDirection (float progress, Direction direction)
| Draw a high definition progress bar progressing in specified direction.
Element | border (Element child)
| Draw a border around the element.
Element | borderLight (Element child)
| Draw a light border around the element.
Element | borderDashed (Element child)
| Draw a dashed border around the element.
Element | borderHeavy (Element child)
| Draw a heavy border around the element.
Element | borderDouble (Element child)
| Draw a double border around the element.
Element | borderRounded (Element child)
| Draw a rounded border around the element.
Element | borderEmpty (Element child)
| Draw an empty border around the element.
Decorator | borderStyled (BorderStyle style)
| Same as border but with different styles.
Decorator | borderStyled (BorderStyle style, Color foreground_color)
| Same as border but with a foreground color and a different style.
Decorator | borderStyled (Color foreground_color)
| Same as border but with a foreground color.
Decorator | borderWith (const Pixel &pixel)
| Same as border but with a constant Pixel around the element.
Element | window (Element title, Element content, BorderStyle border)
| Draw window with a title and a border around the element.
Element | spinner (int charset_index, size_t image_index)
| Useful to represent the effect of time and/or events. This display an ASCII art "video".
Element | paragraph (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines.
Element | paragraphAlignLeft (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the left.
Element | paragraphAlignRight (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the right.
Element | paragraphAlignCenter (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned on the center.
Element | paragraphAlignJustify (const std::string &the_text)
| Return an element drawing the paragraph on multiple lines, aligned using a justified alignment. the center.
Element | graph (GraphFunction graph_function)
| Draw a graph using a GraphFunction.
Element | emptyElement ()
Element | canvas (ConstRef< Canvas > canvas)
| Produce an element from a Canvas, or a reference to a Canvas.
Element | canvas (int width, int height, std::function< void(Canvas &)> fn)
| Produce an element drawing a canvas of requested size.
Element | canvas (std::function< void(Canvas &)> fn)
| Produce an element drawing a canvas.
Element | bold (Element child)
| Use a bold font, for elements with more emphasis.
Element | dim (Element child)
| Use a light font, for elements with less emphasis.
Element | italic (Element child)
| Apply a underlinedDouble to text.
Element | inverted (Element child)
| Add a filter that will invert the foreground and the background colors.
Element | underlined (Element child)
| Make the underlined element to be underlined.
Element | underlinedDouble (Element child)
| Apply a underlinedDouble to text.
Element | blink (Element child)
| The text drawn alternates in between visible and hidden.
Element | strikethrough (Element child)
| Apply a strikethrough to text.
Decorator | color (Color c)
| Decorate using a foreground color.
Decorator | bgcolor (Color color)
| Decorate using a background color.
Decorator | color (const LinearGradient &gradient)
| Decorate using a linear-gradient effect on the foreground color.
Decorator | bgcolor (const LinearGradient &gradient)
| Decorate using a linear-gradient effect on the background color.
Element | color (Color color, Element child)
| Set the foreground color of an element.
Element | bgcolor (Color color, Element child)
| Set the background color of an element.
Element | color (const LinearGradient &gradient, Element child)
| Set the foreground color of an element with linear-gradient effect.
Element | bgcolor (const LinearGradient &gradient, Element child)
| Set the background color of an element with linear-gradient effect.
Decorator | focusPosition (int x, int y)
| Used inside a `frame`, this force the view to be scrolled toward a a given position. The position is expressed in the numbers of cells.
Decorator | focusPositionRelative (float x, float y)
| Used inside a `frame`, this force the view to be scrolled toward a a given position. The position is expressed in proportion of the requested size.
Element | automerge (Element child)
| Enable character to be automatically merged with others nearby.
Decorator | hyperlink (std::string link)
| Decorate using an hyperlink. The link will be opened when the user click on it. This is supported only on a limited set of terminal emulator. List: https://github.com/Alhadis/OSC8-Adoption/.
Element | hyperlink (std::string link, Element child)
| Make the rendered area clickable using a web browser. The link will be opened when the user click on it. This is supported only on a limited set of terminal emulator. List: https://github.com/Alhadis/OSC8-Adoption/.
Element | selectionStyleReset (Element child)
| Reset the selection style of an element.
Decorator | selectionColor (Color foreground)
| Set the color of an element when selected.
Decorator | selectionBackgroundColor (Color foreground)
| Set the background color of an element when selected. Note that the style is applied on top of the existing style.
Decorator | selectionForegroundColor (Color foreground)
| Set the foreground color of an element when selected. Note that the style is applied on top of the existing style.
Decorator | selectionStyle (std::function< void(Pixel &)> style)
| Set the style of an element when selected.
Element | hbox (Elements children)
| A container displaying elements horizontally one by one.
Element | vbox (Elements children)
| A container displaying elements vertically one by one.
Element | dbox (Elements children_)
| Stack several element on top of each other.
Element | flexbox (Elements, FlexboxConfig config=FlexboxConfig())
Element | gridbox (std::vector< Elements > lines)
| A container displaying a grid of elements.
Element | hflow (Elements)
Element | vflow (Elements)
Element | flex (Element child)
| Make a child element to expand proportionally to the space left in a container.
Element | flex_grow (Element child)
| Expand if possible.
Element | flex_shrink (Element child)
| Minimize if needed.
Element | xflex (Element child)
| Expand/Minimize if possible/needed on the X axis.
Element | xflex_grow (Element child)
| Expand if possible on the X axis.
Element | xflex_shrink (Element child)
| Minimize if needed on the X axis.
Element | yflex (Element child)
| Expand/Minimize if possible/needed on the Y axis.
Element | yflex_grow (Element child)
| Expand if possible on the Y axis.
Element | yflex_shrink (Element child)
| Minimize if needed on the Y axis.
Element | notflex (Element child)
| Make the element not flexible.
Element | filler ()
| An element that will take expand proportionally to the space left in a container.
Decorator | size (WidthOrHeight direction, Constraint constraint, int value)
| Apply a constraint on the size of an element.
Element | frame (Element child)
| Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container. In this case only a smaller portion is displayed. The view is scrollable to make the focused element visible.
Element | xframe (Element child)
| Same as `frame`, but only on the x-axis.
Element | yframe (Element child)
| Same as `frame`, but only on the y-axis.
Element | focus (Element child)
| Set the `child` to be the one focused among its siblings.
Element | select (Element child)
| Set the `child` to be the one focused among its siblings.
Element | focusCursorBlock (Element child)
| Same as `focus`, but set the cursor shape to be a still block.
Element | focusCursorBlockBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking block.
Element | focusCursorBar (Element child)
| Same as `focus`, but set the cursor shape to be a still block.
Element | focusCursorBarBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking bar.
Element | focusCursorUnderline (Element child)
| Same as `focus`, but set the cursor shape to be a still underline.
Element | focusCursorUnderlineBlinking (Element child)
| Same as `focus`, but set the cursor shape to be a blinking underline.
Element | vscroll_indicator (Element child)
| Display a vertical scrollbar to the right. colors.
Element | hscroll_indicator (Element child)
| Display an horizontal scrollbar to the bottom. colors.
Decorator | reflect (Box &box)
Element | clear_under (Element element)
| Before drawing |child|, clear the pixels below. This is useful in.
Element | hcenter (Element child)
| Center an element horizontally.
Element | vcenter (Element child)
| Center an element vertically.
Element | center (Element child)
| Center an element horizontally and vertically.
Element | align_right (Element child)
| Align an element on the right side.
Element | nothing (Element element)
| A decoration doing absolutely nothing.
Dimensions | Fit (Element &, bool extend_beyond_screen=false)