4#ifndef FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
5#define FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
24struct FTXUI_EXPORT(COMPONENT) EntryState {
34struct FTXUI_EXPORT(COMPONENT) UnderlineOption {
37 Color color_active = Color::White;
38 Color color_inactive = Color::GrayDark;
40 animation::easing::Function leader_function =
41 animation::easing::QuadraticInOut;
42 animation::easing::Function follower_function =
43 animation::easing::QuadraticInOut;
45 animation::Duration leader_duration = std::chrono::milliseconds(250);
46 animation::Duration leader_delay = std::chrono::milliseconds(0);
47 animation::Duration follower_duration = std::chrono::milliseconds(250);
48 animation::Duration follower_delay = std::chrono::milliseconds(0);
50 void SetAnimation(animation::Duration d, animation::easing::Function f);
51 void SetAnimationDuration(animation::Duration d);
52 void SetAnimationFunction(animation::easing::Function f);
53 void SetAnimationFunction(animation::easing::Function f_leader,
54 animation::easing::Function f_follower);
59struct FTXUI_EXPORT(COMPONENT) AnimatedColorOption {
63 animation::Duration duration = std::chrono::milliseconds(250),
64 animation::easing::Function function = animation::easing::QuadraticInOut);
69 animation::Duration duration = std::chrono::milliseconds(250);
70 animation::easing::Function function = animation::easing::QuadraticInOut;
73struct FTXUI_EXPORT(COMPONENT) AnimatedColorsOption {
74 AnimatedColorOption background;
75 AnimatedColorOption foreground;
80struct FTXUI_EXPORT(COMPONENT) MenuEntryOption {
81 ConstStringRef label =
"MenuEntry";
82 std::function<
Element(
const EntryState& state)> transform;
83 AnimatedColorsOption animated_colors;
88struct FTXUI_EXPORT(COMPONENT) MenuOption {
90 static MenuOption Horizontal();
91 static MenuOption HorizontalAnimated();
92 static MenuOption Vertical();
93 static MenuOption VerticalAnimated();
94 static MenuOption Toggle();
96 ConstStringListRef entries;
97 Ref<int> selected = 0;
100 UnderlineOption underline;
101 MenuEntryOption entries_option;
103 std::function<
Element()> elements_prefix;
104 std::function<
Element()> elements_infix;
105 std::function<
Element()> elements_postfix;
108 std::function<void()> on_change;
109 std::function<void()> on_enter;
110 Ref<int> focused_entry = 0;
115struct FTXUI_EXPORT(COMPONENT) ButtonOption {
117 static ButtonOption Ascii();
118 static ButtonOption Simple();
119 static ButtonOption Border();
120 static ButtonOption Animated();
121 static ButtonOption Animated(Color color);
122 static ButtonOption Animated(Color background, Color foreground);
123 static ButtonOption Animated(Color background,
125 Color background_active,
126 Color foreground_active);
128 ConstStringRef label =
"Button";
129 std::function<void()> on_click = [] {};
132 std::function<
Element(
const EntryState&)> transform;
133 AnimatedColorsOption animated_colors;
138struct FTXUI_EXPORT(COMPONENT) CheckboxOption {
140 static CheckboxOption Simple();
142 ConstStringRef label =
"Checkbox";
144 Ref<bool> checked =
false;
147 std::function<
Element(
const EntryState&)> transform;
151 std::function<void()> on_change = [] {};
155struct FTXUI_EXPORT(COMPONENT) InputState {
165struct FTXUI_EXPORT(COMPONENT) InputOption {
169 static InputOption Default();
171 static InputOption Spacious();
174 StringRef content =
"";
177 StringRef placeholder =
"";
180 std::function<
Element(InputState)> transform;
181 Ref<bool> password =
false;
182 Ref<bool> multiline =
true;
183 Ref<bool> insert =
true;
186 std::function<void()> on_change = [] {};
188 std::function<void()> on_enter = [] {};
191 Ref<int> cursor_position = 0;
196struct FTXUI_EXPORT(COMPONENT) RadioboxOption {
198 static RadioboxOption Simple();
201 ConstStringListRef entries;
202 Ref<int> selected = 0;
205 std::function<
Element(
const EntryState&)> transform;
209 std::function<void()> on_change = [] {};
210 Ref<int> focused_entry = 0;
213struct FTXUI_EXPORT(COMPONENT) ResizableSplitOption {
216 Ref<Direction>
direction = Direction::Left;
220 std::function<
Element()> separator_func = [] { return ::ftxui::separator(); };
224 Ref<int> max = std::numeric_limits<int>::max();
236 Color color_active = Color::White;
237 Color color_inactive = Color::GrayDark;
243struct FTXUI_EXPORT(COMPONENT) WindowRenderState {
245 const std::string& title;
249 bool hover_left =
false;
250 bool hover_right =
false;
251 bool hover_top =
false;
252 bool hover_down =
false;
257struct FTXUI_EXPORT(COMPONENT) WindowOptions {
259 ConstStringRef title =
"";
264 Ref<int> height = 10;
266 Ref<bool> resize_left =
true;
267 Ref<bool> resize_right =
true;
268 Ref<bool> resize_top =
true;
269 Ref<bool> resize_down =
true;
272 std::function<Element(
const WindowRenderState&)> render;
278struct FTXUI_EXPORT(COMPONENT) DropdownOption {
280 Ref<bool> open =
false;
282 CheckboxOption checkbox;
284 RadioboxOption radiobox;
286 std::function<
Element(
bool open, Element checkbox, Element radiobox)>
アダプター。不変オブジェクトを所有または参照します。
アダプター。可変オブジェクトを所有または参照します。
Direction
Directionは、東西南北の4つの基本方向を表す列挙型です。
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component
std::function< void()> on_change