79 if (!state.focused && !state.active) {
94 option.underline.enabled =
true;
104 Element e =
text((state.active ?
"> " :
" ") + state.label);
111 if (!state.focused && !state.active) {
124 option.entries_option.transform = [](
const EntryState& state) {
132 if (!state.focused && !state.active) {
137 option.underline.enabled =
true;
146 option.elements_infix = [] {
return text(
"│") |
automerge; };
155 const std::string t = s.focused ?
"[" + s.label +
"]"
156 :
" " + s.label +
" ";
226 Color background_active,
227 Color foreground_active) {
246#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
249 auto prefix =
text(s.state ?
"[X] " :
"[ ] ");
251 auto prefix =
text(s.state ?
"▣ " :
"☐ ");
253 auto t =
text(s.label);
260 return hbox({prefix, t});
270#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
273 auto prefix =
text(s.state ?
"(*) " :
"( ) ");
275 auto prefix =
text(s.state ?
"◉ " :
"○ ");
277 auto t =
text(s.label);
284 return hbox({prefix, t});
296 if (state.is_placeholder) {
297 state.element |=
dim;
302 }
else if (state.hovered) {
306 return state.element;
319 if (state.is_placeholder) {
320 state.element |=
dim;
331 return state.element;
static ButtonOption Animated()
創建一個 ButtonOption,使用動畫顏色。
static MenuOption Toggle()
帶有分隔線的水平選單標準選項。 這對於實現一個標籤頁列很有用。
animation::Duration follower_duration
animation::easing::Function leader_function
MenuEntryOption entries_option
static InputOption Default()
建立預設輸入樣式:
animation::easing::Function function
static ButtonOption Border()
創建一個 ButtonOption。按鈕使用邊框顯示,聚焦時反轉。 這是目前的預設值。
void SetAnimationFunction(animation::easing::Function f)
設定下劃線的動畫方式。
static InputOption Spacious()
具有高邊距的黑底白字樣式:
static CheckboxOption Simple()
標準Checkbox的選項。
static ButtonOption Simple()
創建一個 ButtonOption,在聚焦時反轉。
std::function< Element(const EntryState &state)> transform
static MenuOption Horizontal()
水平選單的標準選項。 這對於實現一個標籤頁列很有用。
static MenuOption VerticalAnimated()
動畫垂直選單的標準選項。 這對於實現一個可選項目列表很有用。
animation::Duration leader_duration
static MenuOption Vertical()
垂直選單的標準選項。 這對於實現一個可選項目列表很有用。
static ButtonOption Ascii()
創建一個 ButtonOption,使用 [] 字元突出顯示。
animation::Duration duration
void SetAnimation(animation::Duration d, animation::easing::Function f)
設定下劃線的動畫方式。
void SetAnimationDuration(animation::Duration d)
設定下劃線的動畫方式。
animation::easing::Function follower_function
std::function< Element(InputState)> transform
std::function< Element()> elements_infix
AnimatedColorsOption animated_colors
void Set(Color inactive, Color active, animation::Duration duration=std::chrono::milliseconds(250), animation::easing::Function function=animation::easing::QuadraticInOut)
可動畫的顏色選項。 @params _inactive 當組件不活動時的顏色。 @params _active 當組件活動時的顏色。 @params _duration 動畫的持續時間。 @params...
static MenuOption HorizontalAnimated()
動畫水平選單的標準選項。 這對於實現一個標籤頁列很有用。
static RadioboxOption Simple()
標準Radiobox的選項。
std::function< Element(const EntryState &)> transform
Decorator bgcolor(Color)
使用背景顏色進行裝飾。
Element bold(Element)
使用粗體字型,用於需要更多強調的元素。
Element inverted(Element)
添加一個濾鏡,它將反轉前景和背景 顏色。
Element text(std::wstring text)
顯示一段 Unicode 文字。
Element borderLight(Element)
在元素周圍繪製細邊框。
Element dim(Element)
使用淺色字體,適用於不那麼強調的元素。
Element automerge(Element child)
啟用字符自動與附近其他字符合併。
Element border(Element)
在元素周圍繪製邊框。
Element borderEmpty(Element)
在元素周圍繪製空邊框。
Decorator color(Color)
使用前景顏色進行裝飾。
static Color Interpolate(float t, const Color &a, const Color &b)
Color 是一個在終端使用者介面中表示顏色的類別。
std::function< float(float)> Function
std::chrono::duration< float > Duration
std::shared_ptr< Node > Element
Element hbox(Elements)
一個逐一水平顯示元素的容器。
AnimatedColorOption foreground
AnimatedColorOption background
來自 |ButtonOption|、|CheckboxOption|、 |RadioboxOption|、|MenuEntryOption|、|MenuOption| 的轉換參數。