FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
ftxui Namespace Reference

FTXUI ftxui:: 命名空間 More...

Namespaces

namespace  animation
 
namespace  box_helper
 
namespace  Container
 
namespace  Dimension
 定義螢幕的維度外觀。
 
namespace  flexbox_helper
 
namespace  literals
 
namespace  task
 
namespace  Terminal
 
namespace  util
 

Classes

class  AnimationTask
 
class  AutoReset
 將一個值指派給變數,離開作用域時重設其舊值。 More...
 
class  ConstRef
 一個適配器。擁有或引用一個不可變的物件。 More...
 
class  MultiReceiverBuffer
 
class  ReceiverImpl
 
class  Ref
 一個適配器。擁有或引用一個可變的物件。 More...
 
class  SenderImpl
 
struct  SliderOption
 
class  TerminalInputParser
 

Typedefs

using Component = std::shared_ptr<ComponentBase>
 
using CapturedMouse = std::unique_ptr<CapturedMouseInterface>
 
using ComponentDecorator = std::function<Component(Component)>
 
using ElementDecorator = std::function<Element(Element)>
 
using Components = std::vector<Component>
 
template<class T >
using Sender = std::unique_ptr<SenderImpl<T>>
 
template<class T >
using Receiver = std::unique_ptr<ReceiverImpl<T>>
 
using ScreenInteractive = App
 
using Closure = std::function<void()>
 
using Task = std::variant<Event, Closure, AnimationTask>
 
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)>
 
using Image = Surface
 
using Pixel = Cell
 

Enumerations

enum class  Direction : uint8_t {
  Up = 0 ,
  Down = 1 ,
  Left = 2 ,
  Right = 3
}
 Direction 是一個列舉,表示四個主要方向。 More...
 
enum  BorderStyle : uint8_t {
  LIGHT ,
  DASHED ,
  HEAVY ,
  DOUBLE ,
  ROUNDED ,
  EMPTY
}
 BorderStyle 是一個列舉,表示可以應用於終端機 UI 元素的不同邊框樣式。 More...
 
enum  WidthOrHeight : uint8_t {
  WIDTH ,
  HEIGHT
}
 
enum  Constraint : uint8_t {
  LESS_THAN ,
  EQUAL ,
  GREATER_THAN
}
 
enum class  AppDimension {
  FitComponent ,
  Fixed ,
  Fullscreen ,
  TerminalOutput
}
 
enum class  WordBreakProperty : int8_t {
  ALetter ,
  CR ,
  Double_Quote ,
  Extend ,
  ExtendNumLet ,
  Format ,
  Hebrew_Letter ,
  Katakana ,
  LF ,
  MidLetter ,
  MidNum ,
  MidNumLet ,
  Newline ,
  Numeric ,
  Regional_Indicator ,
  Single_Quote ,
  WSegSpace ,
  ZWJ
}
 

Functions

class FTXUI_EXPORT (COMPONENT) ComponentBase = {})
 它將自己實作為 ftxui::Element 進行渲染。它透過回應 ftxui::Event 來實現鍵盤導航。
 
template<class T , class... Args>
std::shared_ptr< T > Make (Args &&... args)
 
Component operator| (Component component, ComponentDecorator decorator)
 
Component operator| (Component component, ElementDecorator decorator)
 
Component & operator|= (Component &component, ComponentDecorator decorator)
 
Component & operator|= (Component &component, ElementDecorator decorator)
 
Component Button (ConstStringRef label, std::function< void()> on_click, ButtonOption option)
 繪製一個按鈕。點擊時執行一個函式。
 
Component Checkbox (ConstStringRef label, bool *checked, CheckboxOption option)
 繪製可勾選的元素。
 
Component Input (StringRef content, InputOption option)
 用於編輯文字的輸入框。
 
Component Input (StringRef content, StringRef placeholder, InputOption option)
 用於編輯文字的輸入框。
 
Component Menu (ConstStringListRef entries, int *selected, MenuOption option)
 一份文字清單。取得焦點的元素會被選取。
 
Component MenuEntry (ConstStringRef label, MenuEntryOption option)
 一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
 
Component Radiobox (ConstStringListRef entries, int *selected, RadioboxOption option)
 一份元素清單,只能選取其中一個。
 
Component Dropdown (ConstStringListRef entries, int *selected)
 下拉式選單。
 
Component Toggle (ConstStringListRef entries, int *selected)
 元素的水平列表。使用者可以在其中導航。
 
template<typename T >
Component Slider (SliderOption< T > options)
 任意方向的滑桿。
 
Component Slider (ConstStringRef label, Ref< int > value, ConstRef< int > min, ConstRef< int > max, ConstRef< int > increment)
 一個水平滑桿。
 
Component Slider (ConstStringRef label, Ref< float > value, ConstRef< float > min=0.f, ConstRef< float > max=100.f, ConstRef< float > increment=5.f)
 
Component Slider (ConstStringRef label, Ref< long > value, ConstRef< long > min=0L, ConstRef< long > max=100L, ConstRef< long > increment=5L)
 
Component ResizableSplit (ResizableSplitOption options)
 兩個元件之間的分隔。
 
Component ResizableSplitLeft (Component main, Component back, int *main_size)
 兩個元件之間的水平分割,可透過 滑鼠調整大小。
 
Component ResizableSplitRight (Component main, Component back, int *main_size)
 兩個元件之間的水平分割,可透過 滑鼠調整大小。
 
Component ResizableSplitTop (Component main, Component back, int *main_size)
 兩個元件之間的垂直分割,可透過 滑鼠調整大小。
 
Component ResizableSplitBottom (Component main, Component back, int *main_size)
 兩個元件之間的垂直分割,可透過 滑鼠調整大小。
 
Component Renderer (Component child, std::function< Element()> render)
 回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
 
FTXUI_EXPORT(COMPONENT) Component Renderer(std Component Renderer (std::function< Element(bool)> render)
 回傳一個可聚焦的元件,使用 |render| 來渲染其介面。
 
Component CatchEvent (Component child, std::function< bool(Event)>)
 
ComponentDecorator CatchEvent (std::function< bool(Event)> on_event)
 裝飾一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。
 
FTXUI_EXPORT(COMPONENT) ComponentDecorator Maybe(std Component Modal (Component main, Component modal, const bool *show_modal)
 
ComponentDecorator Modal (Component modal, const bool *show_modal)
 
Component Collapsible (ConstStringRef label, Component child, Ref< bool > show)
 可折疊元件。它顯示一個帶有箭頭的核取方塊。一旦啟用,子元件就會顯示。
 
Component Hoverable (Component component, bool *hover)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
Component Hoverable (Component component, std::function< void()> on_enter, std::function< void()> on_leave)
 包裝一個元件。使用回呼函數。
 
Component Hoverable (Component component, std::function< void(bool)> on_change)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
ComponentDecorator Hoverable (std::function< void()> on_enter, std::function< void()> on_leave)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
ComponentDecorator Hoverable (std::function< void(bool)> on_change)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
template<class T >
Receiver< T > MakeReceiver ()
 
struct FTXUI_EXPORT (DOM) Canvas
 畫布是與繪圖操作相關聯的可繪製緩衝區。
 
 FTXUI_EXPORT (DOM) Element &operator|
 
FTXUI_EXPORT(DOM) Element separatorCharacter(std Element separatorHSelector (float left, float right, Color unselected_color, Color selected_color)
 繪製一個水平條,其中左右兩側之間的區域以不同顏色顯示。
 
Element separatorVSelector (float up, float down, Color unselected_color, Color selected_color)
 繪製一個垂直條,其中上方/下方之間的區域以不同顏色顯示。
 
Element gaugeCharset (float progress, std::vector< std::string > charset, Direction direction)
 使用自訂字元集繪製高解析度進度條。
 
Element window (Element title, Element content, BorderStyle border)
 繪製帶有標題和邊框的視窗。
 
Element canvas (int width, int height, std::function< void(Canvas &)> fn)
 從指定大小的畫布中產生一個繪製畫布的元素。
 
Element flexbox (Elements children, FlexboxConfig config)
 一個容器,用於在行/列中顯示元素,並在滿時能夠換行到下一列/行。
 
FTXUI_EXPORT(DOM) Element gridbox(std Element hflow (Elements children)
 一個容器,用於從左到右在行中顯示元素。當填滿時,它會在下方的新行開始。
 
Element vflow (Elements children)
 一個容器,用於從上到下在行中顯示元素。當填滿時,它會在右側的新列開始。 filled, it starts on a new row. is full, it starts a new row.
 
Element xflex (Element child)
 在 X 軸上盡可能擴展/在需要時最小化。
 
Element xflex_grow (Element child)
 在 X 軸上盡可能擴展。
 
Element xflex_shrink (Element child)
 在 X 軸上在需要時最小化。
 
Element yflex (Element child)
 在 Y 軸上盡可能擴展/在需要時最小化。
 
Element yflex_grow (Element child)
 在 Y 軸上盡可能擴展。
 
Element yflex_shrink (Element child)
 在 Y 軸上在需要時最小化。
 
void Render (Screen &screen, Node *node, Selection &selection)
 
std::string GetNodeSelectedContent (Screen &screen, Node *node, Selection &selection)
 
struct FTXUI_EXPORT (SCREEN) Box
 Box 是一個表示二維空間中矩形區域的結構。
 
 FTXUI_EXPORT (SCREEN) Color operator""_rgb(unsigned long long int combined)
 從組合的十六進位 RGB 表示建立顏色, 例如 0x808000_rgb
 
template<typename T >
FTXUI_EXPORT(SCREEN) std FTXUI_EXPORT(SCREEN) std std::wstring to_wstring (T s)
 
std::wstring to_wstring (const std::string &s)
 
template<>
std::wstring to_wstring (const char *s)
 
FTXUI_EXPORT(SCREEN) int string_width(std std::vector< std::string > Utf8ToGlyphs (std::string_view input)
 
std::vector< int > CellToGlyphIndex (std::string_view input)
 
Component Button (ButtonOption option)
 繪製一個按鈕。點擊時執行一個函式。
 
Component CatchEvent (Component child, std::function< bool(Event event)> on_event)
 傳回一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。
 
Component Checkbox (CheckboxOption option)
 繪製可勾選的元素。
 
Component Dropdown (DropdownOption option)
 下拉式選單。
 
ComponentDecorator Hoverable (bool *hover)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
Component Input (InputOption option)
 用於編輯文字的輸入框。
 
Component Maybe (Component child, std::function< bool()> show)
 裝飾一個組件 |child|。它只在 |show| 返回 true 時顯示。
 
ComponentDecorator Maybe (std::function< bool()> show)
 裝飾一個組件。它只在 |show| 函數返回 true 時顯示。
 
Component Maybe (Component child, const bool *show)
 裝飾一個組件 |child|。它只在 |show| 為 true 時顯示。
 
ComponentDecorator Maybe (const bool *show)
 裝飾一個組件。它只在 |show| 為 true 時顯示。
 
Component Menu (MenuOption option)
 一份文字清單。取得焦點的元素會被選取。
 
Component MenuEntry (MenuEntryOption option)
 一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
 
Component Radiobox (RadioboxOption option)
 一份元素清單,只能選取其中一個。
 
Component Renderer (std::function< Element()> render)
 傳回一個元件,使用 |render| 來繪製其介面。
 
ComponentDecorator Renderer (ElementDecorator decorator)
 透過裝飾元件所渲染的內容來裝飾該元件。
 
Component Window (WindowOptions option)
 一個可拖曳/可調整大小的視窗。要使用多個視窗,它們必須透過 Container::Stacked({...}) 元件堆疊。
 
Element automerge (Element child)
 啟用字符自動與附近其他字符合併。
 
Element blink (Element child)
 繪製的文字在可見和隱藏之間交替。
 
Element bold (Element child)
 使用粗體字型,用於需要更多強調的元素。
 
Element border (Element child)
 在元素周圍繪製邊框。
 
Decorator borderWith (const Cell &pixel)
 與 border 相同,但周圍使用固定的 Cell。
 
Decorator borderStyled (BorderStyle style)
 與 border 相同,但具有不同的樣式。
 
Decorator borderStyled (Color foreground_color)
 與 border 相同,但具有前景色。
 
Decorator borderStyled (BorderStyle style, Color foreground_color)
 與 border 相同,但具有前景色和不同的樣式。
 
Element borderDashed (Element child)
 在元素周圍繪製虛線邊框。
 
Element borderLight (Element child)
 在元素周圍繪製細邊框。
 
Element borderHeavy (Element child)
 在元素周圍繪製粗邊框。
 
Element borderDouble (Element child)
 在元素周圍繪製雙線邊框。
 
Element borderRounded (Element child)
 在元素周圍繪製圓角邊框。
 
Element borderEmpty (Element child)
 在元素周圍繪製空邊框。
 
Element canvas (ConstRef< Canvas > canvas)
 從 Canvas 或對 Canvas 的參考中產生一個元素。
 
Element canvas (std::function< void(Canvas &)> fn)
 從繪製畫布的函式中產生一個元素。
 
Element clear_under (Element element)
 在繪製 |child| 之前,先清除底下的儲存格。這在 搭配 dbox 使用時很有用。
 
Element color (Color color, Element child)
 設定元素的前景顏色。
 
Element bgcolor (Color color, Element child)
 設定元素的背景顏色。
 
Decorator color (Color c)
 使用前景顏色進行裝飾。
 
Decorator bgcolor (Color color)
 使用背景顏色進行裝飾。
 
Element hcenter (Element child)
 水平置中一個元素。
 
Element vcenter (Element child)
 垂直置中一個元素。
 
Element center (Element child)
 水平與垂直置中一個元素。
 
Element align_right (Element child)
 將元素靠右對齊。
 
Element dbox (Elements children_)
 將多個元素堆疊在一起。
 
Element dim (Element child)
 使用淺色字體,適用於不那麼強調的元素。
 
Element filler ()
 一個會依照容器中剩餘空間 按比例擴展的元素。
 
Element flex (Element child)
 讓子元素依比例擴展以填滿容器中剩餘的空間。
 
Element flex_grow (Element child)
 盡可能擴展。
 
Element flex_shrink (Element child)
 在需要時最小化。
 
Element notflex (Element child)
 使元素不可伸縮。
 
Decorator flex_factor (int grow, int shrink)
 
Decorator flex_grow_factor (int grow)
 
Decorator flex_shrink_factor (int shrink)
 
Decorator xflex_factor (int grow, int shrink)
 
Decorator xflex_grow_factor (int grow)
 
Decorator xflex_shrink_factor (int shrink)
 
Decorator yflex_factor (int grow, int shrink)
 
Decorator yflex_grow_factor (int grow)
 
Decorator yflex_shrink_factor (int shrink)
 
Decorator focusPositionRelative (float x, float y)
 在 frame 內部使用,這會強制視圖滾動到給定位置。該位置以請求大小的比例表示。
 
Decorator focusPosition (int x, int y)
 在 frame 內部使用,這會強制視圖滾動到給定位置。該位置以單元格數表示。
 
Element focus (Element child)
 將 child 設置為其同級元素中被聚焦的元素。
 
Element select (Element e)
 將 child 設為其兄弟元素中被聚焦的那一個。
 
Element frame (Element child)
 允許元素顯示在「虛擬」區域內。其大小可以大於其容器。在這種情況下,只會顯示較小的一部分。視圖可滾動以使聚焦元素可見。
 
Element xframe (Element child)
 與 frame 相同,但僅限於 x 軸。
 
Element yframe (Element child)
 與 frame 相同,但僅限於 y 軸。
 
Element focusCursorBlock (Element child)
 與 focus 相同,但將游標形狀設置為靜止條狀。
 
Element focusCursorBlockBlinking (Element child)
 與 focus 相同,但將游標形狀設置為閃爍方塊。
 
Element focusCursorBar (Element child)
 與 focus 相同,但將游標形狀設置為靜止條狀。
 
Element focusCursorBarBlinking (Element child)
 與 focus 相同,但將游標形狀設置為閃爍條狀。
 
Element focusCursorUnderline (Element child)
 與 focus 相同,但將游標形狀設置為靜止底線。
 
Element focusCursorUnderlineBlinking (Element child)
 與 focus 相同,但將游標形狀設置為閃爍底線。
 
Element gaugeDirection (float progress, Direction direction)
 繪製一個指定方向的高解析度進度條。
 
Element gaugeRight (float progress)
 繪製一個從左到右進展的高解析度進度條。
 
Element gaugeLeft (float progress)
 繪製一個從右到左進展的高解析度進度條。
 
Element gaugeUp (float progress)
 繪製一個從下到上進展的高解析度進度條。
 
Element gaugeDown (float progress)
 繪製一個從上到下進展的高解析度進度條。
 
Element gauge (float progress)
 繪製一個高解析度進度條。
 
Element graph (GraphFunction graph_function)
 使用 GraphFunction 繪製圖形。
 
Element gridbox (std::vector< Elements > lines)
 A container displaying a grid of elements.
 
Element hbox (Elements children)
 一個逐一水平顯示元素的容器。
 
Element hyperlink (std::string_view link, Element child)
 使渲染區域可點擊並使用網路瀏覽器開啟。 當用戶點擊時,連結將被開啟。 此功能僅在有限的終端模擬器中受支援。 List: https://github.com/Alhadis/OSC8-Adoption/
 
Decorator hyperlink (std::string_view link)
 使用超連結裝飾。 當用戶點擊時,連結將被開啟。 此功能僅在有限的終端模擬器中受支援。 List: https://github.com/Alhadis/OSC8-Adoption/
 
Element inverted (Element child)
 添加一個濾鏡,它將反轉前景和背景 顏色。
 
Element italic (Element child)
 對文字應用雙底線。
 
Element color (const LinearGradient &gradient, Element child)
 使用線性漸變效果設定元素的前景色。
 
Element bgcolor (const LinearGradient &gradient, Element child)
 使用線性漸變效果設定元素的背景顏色。
 
Decorator color (const LinearGradient &gradient)
 使用線性漸變效果裝飾前景色。
 
Decorator bgcolor (const LinearGradient &gradient)
 使用線性漸變效果裝飾背景顏色。
 
void Render (Screen &screen, const Element &element)
 在 ftxui::Screen 上顯示元素。
 
void Render (Screen &screen, Node *node)
 在 ftxui::Screen 上顯示元素。
 
Element paragraph (std::string_view the_text)
 回傳一個在多行上繪製段落的元素。
 
Element paragraphAlignLeft (std::string_view the_text)
 回傳一個在多行上繪製段落並靠左對齊的元素。
 
Element paragraphAlignRight (std::string_view the_text)
 回傳一個在多行上繪製段落並靠右對齊的元素。
 
Element paragraphAlignCenter (std::string_view the_text)
 回傳一個在多行上繪製段落並置中對齊的元素。
 
Element paragraphAlignJustify (std::string_view the_text)
 回傳一個在多行上繪製段落並使用左右對齊的元素。
 
Decorator reflect (Box &box)
 
Element vscroll_indicator (Element child)
 在右側顯示一個垂直捲軸。 顏色與內容一致。
 
Element hscroll_indicator (Element child)
 在底部顯示一個水平捲軸。 顏色與內容一致。
 
Element selectionStyleReset (Element child)
 重設元素的選取樣式。
 
Decorator selectionBackgroundColor (Color foreground)
 設定元素被選取時的背景顏色。 請注意,此樣式會應用在現有樣式之上。
 
Decorator selectionForegroundColor (Color foreground)
 設定元素被選取時的前景顏色。 請注意,此樣式會應用在現有樣式之上。
 
Decorator selectionColor (Color foreground)
 設定元素被選取時的顏色。
 
Decorator selectionStyle (std::function< void(Cell &)> style)
 設定元素被選取時的樣式。
 
Element separator ()
 在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorStyled (BorderStyle style)
 在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorLight ()
 使用 LIGHT 樣式在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorDashed ()
 使用 DASHED 樣式在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorHeavy ()
 使用 HEAVY 樣式在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorDouble ()
 使用 DOUBLE 樣式在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorEmpty ()
 使用 EMPTY 樣式在兩個元素之間繪製垂直或水平分隔線。
 
Element separatorCharacter (std::string_view value)
 在兩個元素之間繪製垂直或水平分隔線。
 
Element separator (Cell pixel)
 用指定的 pixel 填滿並在兩個元素之間繪製一條分隔線。
 
Decorator size (WidthOrHeight direction, Constraint constraint, int value)
 對元素的大小套用限制。
 
Element spinner (int charset_index, size_t image_index)
 用於表示時間和/或事件的效果。這將顯示 一個 ASCII 藝術「影片」。
 
Element strikethrough (Element child)
 對文字應用刪除線。
 
Element text (std::string_view text)
 顯示一段 UTF8 編碼的 Unicode 文字。
 
Element text (std::wstring_view text)
 顯示一段 Unicode 文字。
 
Element vtext (std::string_view text)
 垂直顯示一段 Unicode 文字。
 
Element vtext (std::wstring_view text)
 垂直顯示一段 Unicode 文字。
 
Element underlined (Element child)
 為給定元素加上底線。
 
Element underlinedDouble (Element child)
 對文字應用雙底線。
 
Element nothing (Element element)
 一個什麼都不做的裝飾器。
 
Decorator operator| (Decorator a, Decorator b)
 將兩個裝飾器組合為一個。
 
Elements operator| (Elements elements, Decorator decorator)
 從一組元素中,對每個元素應用一個裝飾器。
 
Element operator| (Element element, Decorator decorator)
 從一個元素中,應用一個裝飾器。
 
Element & operator|= (Element &e, Decorator d)
 對元素應用一個裝飾器。
 
Element emptyElement ()
 
Element vbox (Elements children)
 一個垂直一個接一個顯示元素的容器。
 
Color operator""_rgb (unsigned long long int combined)
 
ColorInfo GetColorInfo (Color::Palette256 index)
 
ColorInfo GetColorInfo (Color::Palette16 index)
 
std::vector< std::vector< ColorInfo > > ColorInfoSorted2D ()
 
bool EatCodePoint (std::string_view input, size_t start, size_t *end, uint32_t *ucs)
 
bool EatCodePoint (std::wstring_view input, size_t start, size_t *end, uint32_t *ucs)
 
bool IsCombining (uint32_t ucs)
 
bool IsFullWidth (uint32_t ucs)
 
bool IsControl (uint32_t ucs)
 
WordBreakProperty CodepointToWordBreakProperty (uint32_t codepoint)
 
int wchar_width (wchar_t ucs)
 
int wstring_width (const std::wstring &text)
 
int string_width (std::string_view input)
 
size_t GlyphPrevious (std::string_view input, size_t start)
 
size_t GlyphNext (std::string_view input, size_t start)
 
size_t GlyphIterate (std::string_view input, int glyph_offset, size_t start)
 
int GlyphCount (std::string_view input)
 
std::vector< WordBreakProperty > Utf8ToWordBreakProperty (std::string_view input)
 
std::string to_string (std::wstring_view s)
 將 std::wstring 轉換為 UTF8 std::string。
 
std::wstring to_wstring (std::string_view s)
 將 UTF8 std::string 轉換為 std::wstring。
 
bool IsWordBreakingCharacter (std::string_view input, size_t glyph_index)
 

Variables

const bool * show
 
Direction direction
 
 Color
 建立一個透明的顏色。
 
size_t image_index
 
int y
 
int shrink
 
 Constraint
 
int value
 
const Element & element
 
Node * node
 
const std::map< std::string, std::string > g_uniformize
 
const std::array< ColorInfo, 256 > palette256
 

Detailed Description

FTXUI ftxui:: 命名空間

Typedef Documentation

◆ Component

typedef std::shared_ptr< ComponentBase > Component = std::shared_ptr<ComponentBase>

Definition at line 23 of file app.hpp.

◆ CapturedMouse

using CapturedMouse = std::unique_ptr<CapturedMouseInterface>

Definition at line 22 of file captured_mouse.hpp.

◆ ComponentDecorator

using ComponentDecorator = std::function<Component(Component)>

Definition at line 33 of file component.hpp.

◆ ElementDecorator

using ElementDecorator = std::function<Element(Element)>

Definition at line 34 of file component.hpp.

◆ Components

using Components = std::vector<Component>

Definition at line 26 of file component_base.hpp.

◆ Sender

template<class T >
using Sender = std::unique_ptr<SenderImpl<T>>

Definition at line 52 of file receiver.hpp.

◆ Receiver

template<class T >
using Receiver = std::unique_ptr<ReceiverImpl<T>>

Definition at line 54 of file receiver.hpp.

◆ ScreenInteractive

using ScreenInteractive = App

Definition at line 10 of file screen_interactive.hpp.

◆ Closure

using Closure = std::function<void()>

Definition at line 13 of file task.hpp.

◆ Task

using Task = std::variant<Event, Closure, AnimationTask>

Definition at line 14 of file task.hpp.

◆ Element

typedef std::shared_ptr< Node > Element = std::shared_ptr<Node>

Definition at line 25 of file elements.hpp.

◆ Elements

typedef std::vector< Element > Elements = std::vector<Element>

Definition at line 26 of file elements.hpp.

◆ Decorator

Decorator = std::function<Element(Element)>

Definition at line 27 of file elements.hpp.

◆ GraphFunction

using GraphFunction = std::function<std::vector<int>(int, int)>

Definition at line 28 of file elements.hpp.

◆ Image

using Image = Surface

Definition at line 11 of file image.hpp.

◆ Pixel

using Pixel = Cell

Definition at line 10 of file pixel.hpp.

Enumeration Type Documentation

◆ WidthOrHeight

enum WidthOrHeight : uint8_t
Enumerator
WIDTH 
HEIGHT 

Definition at line 190 of file elements.hpp.

◆ Constraint

enum Constraint : uint8_t
Enumerator
LESS_THAN 
EQUAL 
GREATER_THAN 

Definition at line 191 of file elements.hpp.

◆ AppDimension

enum class AppDimension
strong
Enumerator
FitComponent 
Fixed 
Fullscreen 
TerminalOutput 

Definition at line 66 of file app.cpp.

◆ WordBreakProperty

enum class WordBreakProperty : int8_t
strong
Enumerator
ALetter 
CR 
Double_Quote 
Extend 
ExtendNumLet 
Format 
Hebrew_Letter 
Katakana 
LF 
MidLetter 
MidNum 
MidNumLet 
Newline 
Numeric 
Regional_Indicator 
Single_Quote 
WSegSpace 
ZWJ 

Definition at line 44 of file string_internal.hpp.

Function Documentation

◆ Make()

template<class T , class... Args>
std::shared_ptr< T > Make ( Args &&... args)

Definition at line 28 of file component.hpp.

◆ operator|() [1/2]

Component operator| ( Component component,
ComponentDecorator decorator )

Definition at line 12 of file component/util.cpp.

◆ operator|() [2/2]

Component operator| ( Component component,
ElementDecorator decorator )

Definition at line 17 of file component/util.cpp.

◆ operator|=() [1/2]

Component & operator|= ( Component & component,
ComponentDecorator decorator )

Definition at line 22 of file component/util.cpp.

◆ operator|=() [2/2]

Component & operator|= ( Component & component,
ElementDecorator decorator )

Definition at line 28 of file component/util.cpp.

◆ Slider() [1/3]

template<typename T >
Component Slider ( SliderOption< T > options)

任意方向的滑桿。

Parameters
options選項

範例

auto screen = App::TerminalOutput();
int value = 50;
auto slider = Slider({
.value = &value,
.min = 0,
.max = 100,
.increment= 20,
});
screen.Loop(slider);
Component Slider(SliderOption< T > options)
任意方向的滑桿。
int value
Definition elements.hpp:192

Definition at line 315 of file src/ftxui/component/slider.cpp.

◆ Slider() [2/3]

Component Slider ( ConstStringRef label,
Ref< float > value,
ConstRef< float > min = 0.f,
ConstRef< float > max = 100.f,
ConstRef< float > increment = 5.f )

Definition at line 272 of file src/ftxui/component/slider.cpp.

◆ Slider() [3/3]

Component Slider ( ConstStringRef label,
Ref< long > value,
ConstRef< long > min = 0L,
ConstRef< long > max = 100L,
ConstRef< long > increment = 5L )

Definition at line 285 of file src/ftxui/component/slider.cpp.

◆ ResizableSplit()

Component ResizableSplit ( ResizableSplitOption options)

兩個元件之間的分隔。

Parameters
options所有參數。

Example

auto left = Renderer([] { return text("Left") | center;});
auto right = Renderer([] { return text("right") | center;});
int left_size = 10;
auto component = ResizableSplit({
.main = left,
.back = right,
.direction = Direction::Left,
.main_size = &left_size,
.separator_func = [] { return separatorDouble(); },
});
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Element center(Element child)
水平與垂直置中一個元素。
Element separatorDouble()
使用 DOUBLE 樣式在兩個元素之間繪製垂直或水平分隔線。
Component ResizableSplit(ResizableSplitOption options)
兩個元件之間的分隔。
std::uint8_t left
Definition screen.cpp:147
std::uint8_t right
Definition screen.cpp:149

Output

║
left ║ right
║

Definition at line 170 of file src/ftxui/component/resizable_split.cpp.

◆ CatchEvent()

Component CatchEvent ( Component child,
std::function< bool(Event)>  )

◆ Collapsible()

Component Collapsible ( ConstStringRef label,
Component child,
Ref< bool > show )

可折疊元件。它顯示一個帶有箭頭的核取方塊。一旦啟用,子元件就會顯示。

Parameters
label核取方塊的標籤。
child要顯示的子元件。
show儲存子元件是否顯示的狀態。

範例

auto component = Collapsible("Show details", details);
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)
可折疊元件。它顯示一個帶有箭頭的核取方塊。一旦啟用,子元件就會顯示。

輸出

▼ Show details
<details component>

Definition at line 32 of file src/ftxui/component/collapsible.cpp.

◆ MakeReceiver()

template<class T >
Receiver< T > MakeReceiver ( )

Definition at line 149 of file receiver.hpp.

◆ FTXUI_EXPORT() [1/2]

FTXUI_EXPORT ( DOM ) &

◆ separatorHSelector()

Element separatorHSelector ( float left,
float right,
Color unselected_color,
Color selected_color )

繪製一個水平條,其中左右兩側之間的區域以不同顏色顯示。

Parameters
left活躍區域的左限。
right活躍區域的右限。
selected_color選定區域的顏色。
unselected_color未選定區域的顏色。

範例

Element document = separatorHSelector(2,5, Color::White, Color::Blue);
std::shared_ptr< Node > Element
Definition elements.hpp:25
FTXUI_EXPORT(DOM) Element separatorCharacter(std Element separatorHSelector(float left, float right, Color unselected_color, Color selected_color)
繪製一個水平條,其中左右兩側之間的區域以不同顏色顯示。

Definition at line 435 of file src/ftxui/dom/separator.cpp.

◆ separatorVSelector()

Element separatorVSelector ( float up,
float down,
Color unselected_color,
Color selected_color )

繪製一個垂直條,其中上方/下方之間的區域以不同顏色顯示。

Parameters
up活躍區域的上限。
down活躍區域的下限。
selected_color選定區域的顏色。
unselected_color未選定區域的顏色。

範例

Element document = separatorHSelector(2,5, Color::White, Color::Blue);

Definition at line 504 of file src/ftxui/dom/separator.cpp.

◆ canvas() [1/3]

Element canvas ( int width,
int height,
std::function< void(Canvas &)> fn )

從指定大小的畫布中產生一個繪製畫布的元素。

Parameters
width畫布的寬度。
height畫布的高度。
fn繪製畫布的函式。

Definition at line 921 of file src/ftxui/dom/canvas.cpp.

◆ flexbox()

Element flexbox ( Elements children,
FlexboxConfig config )

一個容器,用於在行/列中顯示元素,並在滿時能夠換行到下一列/行。

Parameters
children容器中的元素
config選項
Returns
容器。

範例

text("element 1"),
text("element 2"),
text("element 3"),
}, FlexboxConfig()
.Set(FlexboxConfig::Direction::Column)
.Set(FlexboxConfig::Wrap::WrapInversed)
.SetGapMainAxis(1)
.SetGapCrossAxis(1)
)
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
一個容器,用於在行/列中顯示元素,並在滿時能夠換行到下一列/行。
Definition flexbox.cpp:251

Definition at line 251 of file flexbox.cpp.

◆ hflow()

Element hflow ( Elements children)

一個容器,用於從左到右在行中顯示元素。當填滿時,它會在下方的新行開始。

Parameters
children容器中的元素
Returns
容器。

範例

text("element 1"),
text("element 2"),
text("element 3"),
});
FTXUI_EXPORT(DOM) Element gridbox(std Element hflow(Elements)
一個容器,用於從左到右在行中顯示元素。當填滿時,它會在下方的新行開始。
Definition flexbox.cpp:268

Definition at line 268 of file flexbox.cpp.

◆ vflow()

Element vflow ( Elements children)

一個容器,用於從上到下在行中顯示元素。當填滿時,它會在右側的新列開始。 filled, it starts on a new row. is full, it starts a new row.

Parameters
children容器中的元素
Returns
容器。

範例

text("element 1"),
text("element 2"),
text("element 3"),
});
Element vflow(Elements)
一個容器,用於從上到下在行中顯示元素。當填滿時,它會在右側的新列開始。 filled, it starts on a new row. is full, it starts a new row.
Definition flexbox.cpp:287

Definition at line 287 of file flexbox.cpp.

◆ Render()

void Render ( Screen & screen,
Node * node,
Selection & selection )

Definition at line 105 of file node.cpp.

◆ GetNodeSelectedContent()

std::string GetNodeSelectedContent ( Screen & screen,
Node * node,
Selection & selection )

Definition at line 179 of file node.cpp.

◆ to_wstring() [1/4]

template<typename T >
FTXUI_EXPORT(SCREEN) std FTXUI_EXPORT(SCREEN) std std::wstring to_wstring ( T s)

Definition at line 18 of file string.hpp.

◆ to_wstring() [2/4]

std::wstring to_wstring ( const std::string & s)
inline

Definition at line 21 of file string.hpp.

◆ to_wstring() [3/4]

template<>
std::wstring to_wstring ( const char * s)
inline

Definition at line 25 of file string.hpp.

◆ Utf8ToGlyphs()

std::vector< std::string > Utf8ToGlyphs ( std::string_view input)

Definition at line 348 of file string.cpp.

◆ CellToGlyphIndex()

std::vector< int > CellToGlyphIndex ( std::string_view input)

Definition at line 455 of file string.cpp.

◆ canvas() [2/3]

Element canvas ( ConstRef< Canvas > canvas)

從 Canvas 或對 Canvas 的參考中產生一個元素。

Definition at line 897 of file src/ftxui/dom/canvas.cpp.

◆ canvas() [3/3]

Element canvas ( std::function< void(Canvas &)> fn)

從繪製畫布的函式中產生一個元素。

Parameters
fn繪製畫布的函式。

Definition at line 951 of file src/ftxui/dom/canvas.cpp.

◆ flex_factor()

Decorator flex_factor ( int grow,
int shrink )

Definition at line 152 of file flex.cpp.

◆ flex_grow_factor()

Decorator flex_grow_factor ( int grow)

Definition at line 158 of file flex.cpp.

◆ flex_shrink_factor()

Decorator flex_shrink_factor ( int shrink)

Definition at line 164 of file flex.cpp.

◆ xflex_factor()

Decorator xflex_factor ( int grow,
int shrink )

Definition at line 170 of file flex.cpp.

◆ xflex_grow_factor()

Decorator xflex_grow_factor ( int grow)

Definition at line 176 of file flex.cpp.

◆ xflex_shrink_factor()

Decorator xflex_shrink_factor ( int shrink)

Definition at line 182 of file flex.cpp.

◆ yflex_factor()

Decorator yflex_factor ( int grow,
int shrink )

Definition at line 188 of file flex.cpp.

◆ yflex_grow_factor()

Decorator yflex_grow_factor ( int grow)

Definition at line 194 of file flex.cpp.

◆ yflex_shrink_factor()

Decorator yflex_shrink_factor ( int shrink)

Definition at line 200 of file flex.cpp.

◆ select()

Element select ( Element e)

將 child 設為其兄弟元素中被聚焦的那一個。

這已經被棄用。請改用 focus。

Parameters
e要被聚焦的元素。

Definition at line 108 of file frame.cpp.

◆ frame()

Element frame ( Element child)

允許元素顯示在「虛擬」區域內。其大小可以大於其容器。在這種情況下,只會顯示較小的一部分。視圖可滾動以使聚焦元素可見。

See also
frame
xframe
yframe

Definition at line 116 of file frame.cpp.

◆ xframe()

Element xframe ( Element child)

與 frame 相同,但僅限於 x 軸。

See also
frame
xframe
yframe

Definition at line 124 of file frame.cpp.

◆ yframe()

Element yframe ( Element child)

與 frame 相同,但僅限於 y 軸。

See also
frame
xframe
yframe

Definition at line 132 of file frame.cpp.

◆ graph()

Element graph ( GraphFunction graph_function)

使用 GraphFunction 繪製圖形。

Parameters
graph_function用於獲取數據的函數。

Definition at line 79 of file src/ftxui/dom/graph.cpp.

◆ gridbox()

Element gridbox ( std::vector< Elements > lines)

A container displaying a grid of elements.

Parameters
linesA list of lines, each line being a list of elements.
Returns
The container.

Example

auto cell = [](const char* t) { return text(t) | border; };
auto document = gridbox({
{cell("north-west") , cell("north") , cell("north-east")} ,
{cell("west") , cell("center") , cell("east")} ,
{cell("south-west") , cell("south") , cell("south-east")} ,
});
Element border(Element child)
在元素周圍繪製邊框。
Element gridbox(std::vector< Elements > lines)
A container displaying a grid of elements.

Output:

╭──────────╮╭──────╮╭──────────╮
│north-west││north ││north-east│
╰──────────╯╰──────╯╰──────────╯
╭──────────╮╭──────╮╭──────────╮
│west ││center││east │
╰──────────╯╰──────╯╰──────────╯
╭──────────╮╭──────╮╭──────────╮
│south-west││south ││south-east│
╰──────────╯╰──────╯╰──────────╯

Definition at line 178 of file src/ftxui/dom/gridbox.cpp.

◆ hbox()

Element hbox ( Elements children)

一個逐一水平顯示元素的容器。

Parameters
children容器中的元素
Returns
容器。

範例

text("Left"),
text("Right"),
});
Element hbox(Elements children)
一個逐一水平顯示元素的容器。
Definition hbox.cpp:94

Definition at line 94 of file hbox.cpp.

◆ reflect()

Decorator reflect ( Box & box)

Definition at line 43 of file reflect.cpp.

◆ selectionStyleReset()

Element selectionStyleReset ( Element child)

重設元素的選取樣式。

Parameters
child輸入元素。
Returns
具有重設選取樣式的輸出元素。

Definition at line 55 of file selection_style.cpp.

◆ selectionBackgroundColor()

Decorator selectionBackgroundColor ( Color foreground)

設定元素被選取時的背景顏色。 請注意,此樣式會應用在現有樣式之上。

Definition at line 61 of file selection_style.cpp.

◆ selectionForegroundColor()

Decorator selectionForegroundColor ( Color foreground)

設定元素被選取時的前景顏色。 請注意,此樣式會應用在現有樣式之上。

Definition at line 69 of file selection_style.cpp.

◆ selectionColor()

Decorator selectionColor ( Color foreground)

設定元素被選取時的顏色。

Parameters
foreground要套用的顏色。 請注意,此樣式會應用在現有樣式之上。

Definition at line 78 of file selection_style.cpp.

◆ selectionStyle()

Decorator selectionStyle ( std::function< void(Cell &)> style)

設定元素被選取時的樣式。

Parameters
style要套用的樣式。 請注意,此樣式會應用在現有樣式之上。

Definition at line 86 of file selection_style.cpp.

◆ GetColorInfo() [1/2]

ColorInfo GetColorInfo ( Color::Palette256 index)

Definition at line 273 of file color_info.cpp.

◆ GetColorInfo() [2/2]

ColorInfo GetColorInfo ( Color::Palette16 index)

Definition at line 277 of file color_info.cpp.

◆ ColorInfoSorted2D()

std::vector< std::vector< ColorInfo > > ColorInfoSorted2D ( )

Definition at line 282 of file color_info.cpp.

◆ EatCodePoint() [1/2]

bool EatCodePoint ( std::string_view input,
size_t start,
size_t * end,
uint32_t * ucs )

Definition at line 137 of file string.cpp.

◆ EatCodePoint() [2/2]

bool EatCodePoint ( std::wstring_view input,
size_t start,
size_t * end,
uint32_t * ucs )

Definition at line 206 of file string.cpp.

◆ IsCombining()

bool IsCombining ( uint32_t ucs)

Definition at line 244 of file string.cpp.

◆ IsFullWidth()

bool IsFullWidth ( uint32_t ucs)

Definition at line 248 of file string.cpp.

◆ IsControl()

bool IsControl ( uint32_t ucs)

Definition at line 256 of file string.cpp.

◆ CodepointToWordBreakProperty()

WordBreakProperty CodepointToWordBreakProperty ( uint32_t codepoint)

Definition at line 270 of file string.cpp.

◆ wchar_width()

int wchar_width ( wchar_t ucs)

Definition at line 276 of file string.cpp.

◆ wstring_width()

int wstring_width ( const std::wstring & text)

Definition at line 280 of file string.cpp.

◆ string_width()

int string_width ( std::string_view input)

Definition at line 298 of file string.cpp.

◆ GlyphPrevious()

size_t GlyphPrevious ( std::string_view input,
size_t start )

Definition at line 390 of file string.cpp.

◆ GlyphNext()

size_t GlyphNext ( std::string_view input,
size_t start )

Definition at line 415 of file string.cpp.

◆ GlyphIterate()

size_t GlyphIterate ( std::string_view input,
int glyph_offset,
size_t start )

Definition at line 441 of file string.cpp.

◆ GlyphCount()

int GlyphCount ( std::string_view input)

Definition at line 496 of file string.cpp.

◆ Utf8ToWordBreakProperty()

std::vector< WordBreakProperty > Utf8ToWordBreakProperty ( std::string_view input)

Definition at line 524 of file string.cpp.

◆ to_string()

std::string to_string ( std::wstring_view s)

將 std::wstring 轉換為 UTF8 std::string。

Definition at line 555 of file string.cpp.

◆ to_wstring() [4/4]

std::wstring to_wstring ( std::string_view s)

將 UTF8 std::string 轉換為 std::wstring。

Definition at line 627 of file string.cpp.

◆ IsWordBreakingCharacter()

bool IsWordBreakingCharacter ( std::string_view input,
size_t glyph_index )

Variable Documentation

◆ show

const bool* show

Definition at line 159 of file component.hpp.

◆ direction

Direction direction

Definition at line 80 of file elements.hpp.

◆ Color

Color
default

建立一個透明的顏色。

從 RGB 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model

使用 Palette256 顏色建立一個顏色。

使用 Palette16 顏色建立一個顏色。

Parameters
red紅色的量 [0,255]
green綠色的量 [0,255]
blue藍色的量 [0,255]
alphaalpha 的量 [0,255]

Definition at line 96 of file elements.hpp.

◆ image_index

size_t image_index

Definition at line 101 of file elements.hpp.

◆ y

float y

Definition at line 131 of file elements.hpp.

◆ shrink

int shrink

Definition at line 162 of file elements.hpp.

◆ Constraint

Definition at line 192 of file elements.hpp.

◆ value

int value

Definition at line 192 of file elements.hpp.

◆ element

const Element& element

Definition at line 92 of file node.hpp.

◆ node

Node* node

Definition at line 93 of file node.hpp.

◆ g_uniformize

const std::map<std::string, std::string> g_uniformize

Definition at line 19 of file terminal_input_parser.cpp.

◆ palette256

const std::array<ColorInfo, 256> palette256

Definition at line 14 of file color_info.cpp.