78 if (!state.focused && !state.active) {
93 option.underline.enabled =
true;
103 Element e =
text((state.active ?
"> " :
" ") + state.label);
110 if (!state.focused && !state.active) {
123 option.entries_option.transform = [](
const EntryState& state) {
131 if (!state.focused && !state.active) {
136 option.underline.enabled =
true;
145 option.elements_infix = [] {
return text(
"│") |
automerge; };
154 const std::string t = s.focused ?
"[" + s.label +
"]"
155 :
" " + s.label +
" ";
224 Color background_active,
225 Color foreground_active) {
244#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
246 auto prefix =
text(s.state ?
"[X] " :
"[ ] ");
248 auto prefix =
text(s.state ?
"▣ " :
"☐ ");
250 auto t =
text(s.label);
257 return hbox({prefix, t});
267#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
269 auto prefix =
text(s.state ?
"(*) " :
"( ) ");
271 auto prefix =
text(s.state ?
"◉ " :
"○ ");
273 auto t =
text(s.label);
280 return hbox({prefix, t});
292 if (state.is_placeholder) {
293 state.element |=
dim;
298 }
else if (state.hovered) {
302 return state.element;
315 if (state.is_placeholder) {
316 state.element |=
dim;
327 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 动画的持续时间。 @para...
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 dim(Element)
使用浅色字体,用于不那么重要的元素。
Element automerge(Element child)
启用字符自动与附近的其它字符合并。
Decorator color(Color)
使用前景色进行装饰。
static Color Interpolate(float t, const Color &a, const Color &b)
std::function< float(float)> Function
std::chrono::duration< float > Duration
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< Node > Element
Element borderEmpty(Element)
Element hbox(Elements)
一个按水平顺序逐一显示元素的容器。
Element borderLight(Element)
AnimatedColorOption foreground
AnimatedColorOption background
来自 |ButtonOption|、|CheckboxOption|、 |RadioboxOption|、|MenuEntryOption|、|MenuOption| 的转换参数。