Improve the documentation.

This commit is contained in:
ArthurSonzogni
2021-07-10 14:23:46 +02:00
committed by Arthur Sonzogni
parent 5c4cd1add1
commit 9820832fea
23 changed files with 79 additions and 133 deletions

View File

@@ -50,6 +50,10 @@ Component Toggle(const std::vector<std::wstring>* entries,
Ref<ToggleOption> option = {});
template <class T> // T = {int, float, long}
Component Slider(StringRef label, T* value, T min, T max, T increment);
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()>);
Component Renderer(std::function<Element()>);
Component CatchEvent(Component child, std::function<bool(Event)>);
@@ -63,11 +67,6 @@ Component Tab(Components children, int* selector);
} // namespace Container
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);
} // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_HPP */

View File

@@ -7,6 +7,7 @@
namespace ftxui {
/// @brief Option for the Menu component.
/// @ingroup component
struct MenuOption {
Decorator style_normal = nothing; /// style.
Decorator style_focused = inverted; /// Style when focused.
@@ -23,12 +24,14 @@ struct MenuOption {
};
/// @brief Option for the Button component.
/// @ingroup component
struct ButtonOption {
/// Whether to show a border around the button.
bool border = true;
};
/// @brief Option for the Checkbox component.
/// @ingroup component
struct CheckboxOption {
std::wstring style_checked = L""; /// Prefix for a "checked" state.
std::wstring style_unchecked = L""; /// Prefix for a "unchecked" state.
@@ -40,6 +43,7 @@ struct CheckboxOption {
};
/// @brief Option for the Input component.
/// @ingroup component
struct InputOption {
/// Called when the content changes.
std::function<void()> on_change = [] {};
@@ -50,6 +54,7 @@ struct InputOption {
};
/// @brief Option for the Radiobox component.
/// @ingroup component
struct RadioboxOption {
std::wstring style_checked = L""; /// Prefix for a "checked" state.
std::wstring style_unchecked = L""; /// Prefix for a "unchecked" state.
@@ -63,6 +68,7 @@ struct RadioboxOption {
};
/// @brief Option for the Toggle component.
/// @ingroup component
struct ToggleOption {
Decorator style_normal = nothing; /// style.
Decorator style_focused = inverted; /// Style when focused.
@@ -78,7 +84,7 @@ struct ToggleOption {
Ref<int> focused_entry = 0;
};
}; // namespace ftxui
} // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */

View File

@@ -102,15 +102,11 @@ Element nothing(Element element);
// combinaison with dbox.
Element clear_under(Element element);
// Make container able to take any number of children as input.
#include "take_any_args.hpp"
TAKE_ANY_ARGS(vbox)
TAKE_ANY_ARGS(hbox)
TAKE_ANY_ARGS(dbox)
TAKE_ANY_ARGS(hflow)
} // namespace ftxui
// Make container able to take any number of children as input.
#include "ftxui/dom/take_any_args.hpp"
#endif /* end of include guard: FTXUI_DOM_ELEMENTS_HPP */
// Copyright 2020 Arthur Sonzogni. All rights reserved.

View File

@@ -1,6 +1,8 @@
// IWYU pragma: private, include "ftxui/dom/elements.hpp"
#include <type_traits>
namespace ftxui {
template <class T>
void Merge(Elements&, T) {}
@@ -30,6 +32,12 @@ Elements unpack(Args... args) {
return container(unpack(std::forward<Args>(children)...)); \
}
TAKE_ANY_ARGS(vbox)
TAKE_ANY_ARGS(hbox)
TAKE_ANY_ARGS(dbox)
TAKE_ANY_ARGS(hflow)
} // namespace ftxui
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.