mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 08:04:21 +08:00
Add more documentation.
This commit is contained in:

committed by
Arthur Sonzogni

parent
f2dc080a35
commit
114ab4ae2a
@@ -7,27 +7,29 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief A Checkbox. It can be checked or unchecked.Display an element on a ftxui::Screen.
|
||||
/// @ingroup dom
|
||||
class CheckBox : public Component {
|
||||
public:
|
||||
// Constructor.
|
||||
CheckBox() = default;
|
||||
~CheckBox() override = default;
|
||||
|
||||
bool state = false;
|
||||
std::wstring label = L"label";
|
||||
bool state = false; // The current state. true=checked, false:unchecked.
|
||||
std::wstring label = L"label"; // The CheckBox label.
|
||||
|
||||
#if defined(_WIN32)
|
||||
std::wstring checked = L"[X] ";
|
||||
std::wstring unchecked = L"[ ] ";
|
||||
std::wstring checked = L"[X] "; /// Prefix for a "checked" state.
|
||||
std::wstring unchecked = L"[ ] "; /// Prefix for an "unchecked" state.
|
||||
#else
|
||||
std::wstring checked = L"▣ ";
|
||||
std::wstring unchecked = L"☐ ";
|
||||
std::wstring checked = L"▣ "; /// Prefix for a "checked" state.
|
||||
std::wstring unchecked = L"☐ "; /// Prefix for a "unchecked" state.
|
||||
#endif
|
||||
|
||||
Decorator focused_style = inverted;
|
||||
Decorator unfocused_style = nothing;
|
||||
Decorator focused_style = inverted; /// Decorator used when focused.
|
||||
Decorator unfocused_style = nothing; /// Decorator used when unfocused.
|
||||
|
||||
// State update callback.
|
||||
/// Called when the user change the state of the CheckBox.
|
||||
std::function<void()> on_change = []() {};
|
||||
|
||||
// Component implementation.
|
||||
|
@@ -9,6 +9,9 @@ namespace ftxui {
|
||||
class Delegate;
|
||||
class Focus;
|
||||
|
||||
/// @brief It implement rendering itself as ftxui::Element. It implement
|
||||
/// keyboard navigation by responding to ftxui::Event.
|
||||
/// @ingroup component
|
||||
class Component {
|
||||
public:
|
||||
// Constructor/Destructor.
|
||||
@@ -16,7 +19,7 @@ class Component {
|
||||
virtual ~Component();
|
||||
|
||||
// Component hierarchy.
|
||||
Component* Parent() { return parent_; }
|
||||
Component* Parent();
|
||||
void Add(Component* children);
|
||||
|
||||
// Renders the component.
|
||||
|
@@ -5,10 +5,7 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
// A component where focus and events are automatically handled for you.
|
||||
// List of container:
|
||||
//
|
||||
// Please use HorizontalContainer or VerticalContainer.
|
||||
/// @brief A component where focus and events are automatically handled for you.
|
||||
class Container : public Component {
|
||||
public:
|
||||
static Container Vertical();
|
||||
|
@@ -9,6 +9,9 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief Represent an event. It can be key press event, a terminal resize, or
|
||||
/// more ...
|
||||
//
|
||||
// Documentation:
|
||||
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||
//
|
||||
|
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief An input box. The user can type text into it.
|
||||
/// @ingroup component.
|
||||
class Input : public Component {
|
||||
public:
|
||||
// Constructor.
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief A list of items. The user can navigate through them.
|
||||
/// @ingroup component
|
||||
class Menu : public Component {
|
||||
public:
|
||||
// Constructor.
|
||||
|
@@ -7,6 +7,9 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief A list of selectable element. One and only one can be selected at
|
||||
/// the same time.
|
||||
/// @ingroup component
|
||||
class RadioBox : public Component {
|
||||
public:
|
||||
// Constructor.
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief An horizontal list of elements. The user can navigate through them.
|
||||
/// @ingroup component
|
||||
class Toggle : public Component {
|
||||
public:
|
||||
// Constructor.
|
||||
|
Reference in New Issue
Block a user