mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-06-24 16:21:12 +08:00
Remove @ingroup from class member definitions
This commit is contained in:
parent
a86d8f32d7
commit
b751e50851
@ -35,26 +35,22 @@ ComponentBase::~ComponentBase() {
|
|||||||
/// @brief Return the parent ComponentBase, or nul if any.
|
/// @brief Return the parent ComponentBase, or nul if any.
|
||||||
/// @see Detach
|
/// @see Detach
|
||||||
/// @see Parent
|
/// @see Parent
|
||||||
/// @ingroup component
|
|
||||||
ComponentBase* ComponentBase::Parent() const {
|
ComponentBase* ComponentBase::Parent() const {
|
||||||
return parent_;
|
return parent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Access the child at index `i`.
|
/// @brief Access the child at index `i`.
|
||||||
/// @ingroup component
|
|
||||||
Component& ComponentBase::ChildAt(size_t i) {
|
Component& ComponentBase::ChildAt(size_t i) {
|
||||||
assert(i < ChildCount()); // NOLINT
|
assert(i < ChildCount()); // NOLINT
|
||||||
return children_[i];
|
return children_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Returns the number of children.
|
/// @brief Returns the number of children.
|
||||||
/// @ingroup component
|
|
||||||
size_t ComponentBase::ChildCount() const {
|
size_t ComponentBase::ChildCount() const {
|
||||||
return children_.size();
|
return children_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Return index of the component in its parent. -1 if no parent.
|
/// @brief Return index of the component in its parent. -1 if no parent.
|
||||||
/// @ingroup component
|
|
||||||
int ComponentBase::Index() const {
|
int ComponentBase::Index() const {
|
||||||
if (parent_ == nullptr) {
|
if (parent_ == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -71,7 +67,6 @@ int ComponentBase::Index() const {
|
|||||||
|
|
||||||
/// @brief Add a child.
|
/// @brief Add a child.
|
||||||
/// @@param child The child to be attached.
|
/// @@param child The child to be attached.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::Add(Component child) {
|
void ComponentBase::Add(Component child) {
|
||||||
child->Detach();
|
child->Detach();
|
||||||
child->parent_ = this;
|
child->parent_ = this;
|
||||||
@ -81,7 +76,6 @@ void ComponentBase::Add(Component child) {
|
|||||||
/// @brief Detach this child from its parent.
|
/// @brief Detach this child from its parent.
|
||||||
/// @see Detach
|
/// @see Detach
|
||||||
/// @see Parent
|
/// @see Parent
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::Detach() {
|
void ComponentBase::Detach() {
|
||||||
if (parent_ == nullptr) {
|
if (parent_ == nullptr) {
|
||||||
return;
|
return;
|
||||||
@ -97,7 +91,6 @@ void ComponentBase::Detach() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Remove all children.
|
/// @brief Remove all children.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::DetachAllChildren() {
|
void ComponentBase::DetachAllChildren() {
|
||||||
while (!children_.empty()) {
|
while (!children_.empty()) {
|
||||||
children_[0]->Detach();
|
children_[0]->Detach();
|
||||||
@ -107,7 +100,6 @@ void ComponentBase::DetachAllChildren() {
|
|||||||
/// @brief Draw the component.
|
/// @brief Draw the component.
|
||||||
/// Build a ftxui::Element to be drawn on the ftxui::Screen representing this
|
/// Build a ftxui::Element to be drawn on the ftxui::Screen representing this
|
||||||
/// ftxui::ComponentBase. Please override OnRender() to modify the rendering.
|
/// ftxui::ComponentBase. Please override OnRender() to modify the rendering.
|
||||||
/// @ingroup component
|
|
||||||
Element ComponentBase::Render() {
|
Element ComponentBase::Render() {
|
||||||
// Some users might call `ComponentBase::Render()` from
|
// Some users might call `ComponentBase::Render()` from
|
||||||
// `T::OnRender()`. To avoid infinite recursion, we use a flag.
|
// `T::OnRender()`. To avoid infinite recursion, we use a flag.
|
||||||
@ -143,7 +135,6 @@ Element ComponentBase::Render() {
|
|||||||
/// @brief Draw the component.
|
/// @brief Draw the component.
|
||||||
/// Build a ftxui::Element to be drawn on the ftxi::Screen representing this
|
/// Build a ftxui::Element to be drawn on the ftxi::Screen representing this
|
||||||
/// ftxui::ComponentBase. This function is means to be overridden.
|
/// ftxui::ComponentBase. This function is means to be overridden.
|
||||||
/// @ingroup component
|
|
||||||
Element ComponentBase::OnRender() {
|
Element ComponentBase::OnRender() {
|
||||||
if (children_.size() == 1) {
|
if (children_.size() == 1) {
|
||||||
return children_.front()->Render();
|
return children_.front()->Render();
|
||||||
@ -157,7 +148,6 @@ Element ComponentBase::OnRender() {
|
|||||||
/// @return True when the event has been handled.
|
/// @return True when the event has been handled.
|
||||||
/// The default implementation called OnEvent on every child until one return
|
/// The default implementation called OnEvent on every child until one return
|
||||||
/// true. If none returns true, return false.
|
/// true. If none returns true, return false.
|
||||||
/// @ingroup component
|
|
||||||
bool ComponentBase::OnEvent(Event event) { // NOLINT
|
bool ComponentBase::OnEvent(Event event) { // NOLINT
|
||||||
for (Component& child : children_) { // NOLINT
|
for (Component& child : children_) { // NOLINT
|
||||||
if (child->OnEvent(event)) {
|
if (child->OnEvent(event)) {
|
||||||
@ -170,7 +160,6 @@ bool ComponentBase::OnEvent(Event event) { // NOLINT
|
|||||||
/// @brief Called in response to an animation event.
|
/// @brief Called in response to an animation event.
|
||||||
/// @param params the parameters of the animation
|
/// @param params the parameters of the animation
|
||||||
/// The default implementation dispatch the event to every child.
|
/// The default implementation dispatch the event to every child.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::OnAnimation(animation::Params& params) {
|
void ComponentBase::OnAnimation(animation::Params& params) {
|
||||||
for (const Component& child : children_) {
|
for (const Component& child : children_) {
|
||||||
child->OnAnimation(params);
|
child->OnAnimation(params);
|
||||||
@ -179,7 +168,6 @@ void ComponentBase::OnAnimation(animation::Params& params) {
|
|||||||
|
|
||||||
/// @brief Return the currently Active child.
|
/// @brief Return the currently Active child.
|
||||||
/// @return the currently Active child.
|
/// @return the currently Active child.
|
||||||
/// @ingroup component
|
|
||||||
Component ComponentBase::ActiveChild() {
|
Component ComponentBase::ActiveChild() {
|
||||||
for (auto& child : children_) {
|
for (auto& child : children_) {
|
||||||
if (child->Focusable()) {
|
if (child->Focusable()) {
|
||||||
@ -192,7 +180,6 @@ Component ComponentBase::ActiveChild() {
|
|||||||
/// @brief Return true when the component contains focusable elements.
|
/// @brief Return true when the component contains focusable elements.
|
||||||
/// The non focusable Components will be skipped when navigating using the
|
/// The non focusable Components will be skipped when navigating using the
|
||||||
/// keyboard.
|
/// keyboard.
|
||||||
/// @ingroup component
|
|
||||||
bool ComponentBase::Focusable() const {
|
bool ComponentBase::Focusable() const {
|
||||||
for (const Component& child : children_) { // NOLINT
|
for (const Component& child : children_) { // NOLINT
|
||||||
if (child->Focusable()) {
|
if (child->Focusable()) {
|
||||||
@ -203,7 +190,6 @@ bool ComponentBase::Focusable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Returns if the element if the currently active child of its parent.
|
/// @brief Returns if the element if the currently active child of its parent.
|
||||||
/// @ingroup component
|
|
||||||
bool ComponentBase::Active() const {
|
bool ComponentBase::Active() const {
|
||||||
return parent_ == nullptr || parent_->ActiveChild().get() == this;
|
return parent_ == nullptr || parent_->ActiveChild().get() == this;
|
||||||
}
|
}
|
||||||
@ -212,7 +198,6 @@ bool ComponentBase::Active() const {
|
|||||||
/// True when the ComponentBase is focused by the user. An element is Focused
|
/// True when the ComponentBase is focused by the user. An element is Focused
|
||||||
/// when it is with all its ancestors the ActiveChild() of their parents, and it
|
/// when it is with all its ancestors the ActiveChild() of their parents, and it
|
||||||
/// Focusable().
|
/// Focusable().
|
||||||
/// @ingroup component
|
|
||||||
bool ComponentBase::Focused() const {
|
bool ComponentBase::Focused() const {
|
||||||
const auto* current = this;
|
const auto* current = this;
|
||||||
while (current && current->Active()) {
|
while (current && current->Active()) {
|
||||||
@ -223,18 +208,15 @@ bool ComponentBase::Focused() const {
|
|||||||
|
|
||||||
/// @brief Make the |child| to be the "active" one.
|
/// @brief Make the |child| to be the "active" one.
|
||||||
/// @param child the child to become active.
|
/// @param child the child to become active.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::SetActiveChild([[maybe_unused]] ComponentBase* child) {}
|
void ComponentBase::SetActiveChild([[maybe_unused]] ComponentBase* child) {}
|
||||||
|
|
||||||
/// @brief Make the |child| to be the "active" one.
|
/// @brief Make the |child| to be the "active" one.
|
||||||
/// @param child the child to become active.
|
/// @param child the child to become active.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::SetActiveChild(Component child) { // NOLINT
|
void ComponentBase::SetActiveChild(Component child) { // NOLINT
|
||||||
SetActiveChild(child.get());
|
SetActiveChild(child.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Configure all the ancestors to give focus to this component.
|
/// @brief Configure all the ancestors to give focus to this component.
|
||||||
/// @ingroup component
|
|
||||||
void ComponentBase::TakeFocus() {
|
void ComponentBase::TakeFocus() {
|
||||||
ComponentBase* child = this;
|
ComponentBase* child = this;
|
||||||
while (ComponentBase* parent = child->parent_) {
|
while (ComponentBase* parent = child->parent_) {
|
||||||
@ -246,7 +228,6 @@ void ComponentBase::TakeFocus() {
|
|||||||
/// @brief Take the CapturedMouse if available. There is only one component of
|
/// @brief Take the CapturedMouse if available. There is only one component of
|
||||||
/// them. It represents a component taking priority over others.
|
/// them. It represents a component taking priority over others.
|
||||||
/// @param event The event
|
/// @param event The event
|
||||||
/// @ingroup component
|
|
||||||
CapturedMouse ComponentBase::CaptureMouse(const Event& event) { // NOLINT
|
CapturedMouse ComponentBase::CaptureMouse(const Event& event) { // NOLINT
|
||||||
if (event.screen_) {
|
if (event.screen_) {
|
||||||
return event.screen_->CaptureMouse();
|
return event.screen_->CaptureMouse();
|
||||||
|
@ -17,7 +17,6 @@ namespace ftxui {
|
|||||||
/// @params _active The color when the component is active.
|
/// @params _active The color when the component is active.
|
||||||
/// @params _duration The duration of the animation.
|
/// @params _duration The duration of the animation.
|
||||||
/// @params _function The easing function of the animation.
|
/// @params _function The easing function of the animation.
|
||||||
/// @ingroup component
|
|
||||||
void AnimatedColorOption::Set(Color _inactive,
|
void AnimatedColorOption::Set(Color _inactive,
|
||||||
Color _active,
|
Color _active,
|
||||||
animation::Duration _duration,
|
animation::Duration _duration,
|
||||||
@ -32,7 +31,6 @@ void AnimatedColorOption::Set(Color _inactive,
|
|||||||
/// @brief Set how the underline should animate.
|
/// @brief Set how the underline should animate.
|
||||||
/// @param d The duration of the animation.
|
/// @param d The duration of the animation.
|
||||||
/// @param f The easing function of the animation.
|
/// @param f The easing function of the animation.
|
||||||
/// @ingroup component
|
|
||||||
void UnderlineOption::SetAnimation(animation::Duration d,
|
void UnderlineOption::SetAnimation(animation::Duration d,
|
||||||
animation::easing::Function f) {
|
animation::easing::Function f) {
|
||||||
SetAnimationDuration(d);
|
SetAnimationDuration(d);
|
||||||
@ -41,7 +39,6 @@ void UnderlineOption::SetAnimation(animation::Duration d,
|
|||||||
|
|
||||||
/// @brief Set how the underline should animate.
|
/// @brief Set how the underline should animate.
|
||||||
/// @param d The duration of the animation.
|
/// @param d The duration of the animation.
|
||||||
/// @ingroup component
|
|
||||||
void UnderlineOption::SetAnimationDuration(animation::Duration d) {
|
void UnderlineOption::SetAnimationDuration(animation::Duration d) {
|
||||||
leader_duration = d;
|
leader_duration = d;
|
||||||
follower_duration = d;
|
follower_duration = d;
|
||||||
@ -49,7 +46,6 @@ void UnderlineOption::SetAnimationDuration(animation::Duration d) {
|
|||||||
|
|
||||||
/// @brief Set how the underline should animate.
|
/// @brief Set how the underline should animate.
|
||||||
/// @param f The easing function of the animation.
|
/// @param f The easing function of the animation.
|
||||||
/// @ingroup component
|
|
||||||
void UnderlineOption::SetAnimationFunction(animation::easing::Function f) {
|
void UnderlineOption::SetAnimationFunction(animation::easing::Function f) {
|
||||||
leader_function = f;
|
leader_function = f;
|
||||||
follower_function = std::move(f);
|
follower_function = std::move(f);
|
||||||
@ -60,7 +56,6 @@ void UnderlineOption::SetAnimationFunction(animation::easing::Function f) {
|
|||||||
/// follower.
|
/// follower.
|
||||||
/// @param f_leader The duration of the animation for the leader.
|
/// @param f_leader The duration of the animation for the leader.
|
||||||
/// @param f_follower The duration of the animation for the follower.
|
/// @param f_follower The duration of the animation for the follower.
|
||||||
/// @ingroup component
|
|
||||||
void UnderlineOption::SetAnimationFunction(
|
void UnderlineOption::SetAnimationFunction(
|
||||||
animation::easing::Function f_leader,
|
animation::easing::Function f_leader,
|
||||||
animation::easing::Function f_follower) {
|
animation::easing::Function f_follower) {
|
||||||
@ -70,7 +65,6 @@ void UnderlineOption::SetAnimationFunction(
|
|||||||
|
|
||||||
/// @brief Standard options for a horizontal menu.
|
/// @brief Standard options for a horizontal menu.
|
||||||
/// This can be useful to implement a tab bar.
|
/// This can be useful to implement a tab bar.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
MenuOption MenuOption::Horizontal() {
|
MenuOption MenuOption::Horizontal() {
|
||||||
MenuOption option;
|
MenuOption option;
|
||||||
@ -95,7 +89,6 @@ MenuOption MenuOption::Horizontal() {
|
|||||||
|
|
||||||
/// @brief Standard options for an animated horizontal menu.
|
/// @brief Standard options for an animated horizontal menu.
|
||||||
/// This can be useful to implement a tab bar.
|
/// This can be useful to implement a tab bar.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
MenuOption MenuOption::HorizontalAnimated() {
|
MenuOption MenuOption::HorizontalAnimated() {
|
||||||
auto option = Horizontal();
|
auto option = Horizontal();
|
||||||
@ -105,7 +98,6 @@ MenuOption MenuOption::HorizontalAnimated() {
|
|||||||
|
|
||||||
/// @brief Standard options for a vertical menu.
|
/// @brief Standard options for a vertical menu.
|
||||||
/// This can be useful to implement a list of selectable items.
|
/// This can be useful to implement a list of selectable items.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
MenuOption MenuOption::Vertical() {
|
MenuOption MenuOption::Vertical() {
|
||||||
MenuOption option;
|
MenuOption option;
|
||||||
@ -127,7 +119,6 @@ MenuOption MenuOption::Vertical() {
|
|||||||
|
|
||||||
/// @brief Standard options for an animated vertical menu.
|
/// @brief Standard options for an animated vertical menu.
|
||||||
/// This can be useful to implement a list of selectable items.
|
/// This can be useful to implement a list of selectable items.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
MenuOption MenuOption::VerticalAnimated() {
|
MenuOption MenuOption::VerticalAnimated() {
|
||||||
auto option = MenuOption::Vertical();
|
auto option = MenuOption::Vertical();
|
||||||
@ -150,7 +141,6 @@ MenuOption MenuOption::VerticalAnimated() {
|
|||||||
|
|
||||||
/// @brief Standard options for a horizontal menu with some separator.
|
/// @brief Standard options for a horizontal menu with some separator.
|
||||||
/// This can be useful to implement a tab bar.
|
/// This can be useful to implement a tab bar.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
MenuOption MenuOption::Toggle() {
|
MenuOption MenuOption::Toggle() {
|
||||||
auto option = MenuOption::Horizontal();
|
auto option = MenuOption::Horizontal();
|
||||||
@ -159,7 +149,6 @@ MenuOption MenuOption::Toggle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, highlighted using [] characters.
|
/// @brief Create a ButtonOption, highlighted using [] characters.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Ascii() {
|
ButtonOption ButtonOption::Ascii() {
|
||||||
ButtonOption option;
|
ButtonOption option;
|
||||||
@ -172,7 +161,6 @@ ButtonOption ButtonOption::Ascii() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, inverted when focused.
|
/// @brief Create a ButtonOption, inverted when focused.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Simple() {
|
ButtonOption ButtonOption::Simple() {
|
||||||
ButtonOption option;
|
ButtonOption option;
|
||||||
@ -188,7 +176,6 @@ ButtonOption ButtonOption::Simple() {
|
|||||||
|
|
||||||
/// @brief Create a ButtonOption. The button is shown using a border, inverted
|
/// @brief Create a ButtonOption. The button is shown using a border, inverted
|
||||||
/// when focused. This is the current default.
|
/// when focused. This is the current default.
|
||||||
/// @ingroup component
|
|
||||||
ButtonOption ButtonOption::Border() {
|
ButtonOption ButtonOption::Border() {
|
||||||
ButtonOption option;
|
ButtonOption option;
|
||||||
option.transform = [](const EntryState& s) {
|
option.transform = [](const EntryState& s) {
|
||||||
@ -205,7 +192,6 @@ ButtonOption ButtonOption::Border() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Animated() {
|
ButtonOption ButtonOption::Animated() {
|
||||||
return Animated(Color::Black, Color::GrayLight, //
|
return Animated(Color::Black, Color::GrayLight, //
|
||||||
@ -213,7 +199,6 @@ ButtonOption ButtonOption::Animated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Animated(Color color) {
|
ButtonOption ButtonOption::Animated(Color color) {
|
||||||
return ButtonOption::Animated(
|
return ButtonOption::Animated(
|
||||||
@ -224,7 +209,6 @@ ButtonOption ButtonOption::Animated(Color color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
|
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
|
||||||
// NOLINTBEGIN
|
// NOLINTBEGIN
|
||||||
@ -237,7 +221,6 @@ ButtonOption ButtonOption::Animated(Color background, Color foreground) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Animated(Color background,
|
ButtonOption ButtonOption::Animated(Color background,
|
||||||
Color foreground,
|
Color foreground,
|
||||||
@ -257,7 +240,6 @@ ButtonOption ButtonOption::Animated(Color background,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Option for standard Checkbox.
|
/// @brief Option for standard Checkbox.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
CheckboxOption CheckboxOption::Simple() {
|
CheckboxOption CheckboxOption::Simple() {
|
||||||
auto option = CheckboxOption();
|
auto option = CheckboxOption();
|
||||||
@ -282,7 +264,6 @@ CheckboxOption CheckboxOption::Simple() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Option for standard Radiobox
|
/// @brief Option for standard Radiobox
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
RadioboxOption RadioboxOption::Simple() {
|
RadioboxOption RadioboxOption::Simple() {
|
||||||
auto option = RadioboxOption();
|
auto option = RadioboxOption();
|
||||||
@ -307,7 +288,6 @@ RadioboxOption RadioboxOption::Simple() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Standard options for the input component.
|
/// @brief Standard options for the input component.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
InputOption InputOption::Default() {
|
InputOption InputOption::Default() {
|
||||||
InputOption option;
|
InputOption option;
|
||||||
@ -330,7 +310,6 @@ InputOption InputOption::Default() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Standard options for a more beautiful input component.
|
/// @brief Standard options for a more beautiful input component.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
InputOption InputOption::Spacious() {
|
InputOption InputOption::Spacious() {
|
||||||
InputOption option;
|
InputOption option;
|
||||||
|
@ -24,7 +24,6 @@ namespace ftxui {
|
|||||||
|
|
||||||
/// @brief An event corresponding to a given typed character.
|
/// @brief An event corresponding to a given typed character.
|
||||||
/// @param input The character typed by the user.
|
/// @param input The character typed by the user.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
Event Event::Character(std::string input) {
|
Event Event::Character(std::string input) {
|
||||||
Event event;
|
Event event;
|
||||||
@ -35,7 +34,6 @@ Event Event::Character(std::string input) {
|
|||||||
|
|
||||||
/// @brief An event corresponding to a given typed character.
|
/// @brief An event corresponding to a given typed character.
|
||||||
/// @param c The character typed by the user.
|
/// @param c The character typed by the user.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
Event Event::Character(char c) {
|
Event Event::Character(char c) {
|
||||||
return Event::Character(std::string{c});
|
return Event::Character(std::string{c});
|
||||||
@ -43,7 +41,6 @@ Event Event::Character(char c) {
|
|||||||
|
|
||||||
/// @brief An event corresponding to a given typed character.
|
/// @brief An event corresponding to a given typed character.
|
||||||
/// @param c The character typed by the user.
|
/// @param c The character typed by the user.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
Event Event::Character(wchar_t c) {
|
Event Event::Character(wchar_t c) {
|
||||||
return Event::Character(to_string(std::wstring{c}));
|
return Event::Character(to_string(std::wstring{c}));
|
||||||
@ -52,7 +49,6 @@ Event Event::Character(wchar_t c) {
|
|||||||
/// @brief An event corresponding to a given typed character.
|
/// @brief An event corresponding to a given typed character.
|
||||||
/// @param input The sequence of character send by the terminal.
|
/// @param input The sequence of character send by the terminal.
|
||||||
/// @param mouse The mouse state.
|
/// @param mouse The mouse state.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
Event Event::Mouse(std::string input, struct Mouse mouse) {
|
Event Event::Mouse(std::string input, struct Mouse mouse) {
|
||||||
Event event;
|
Event event;
|
||||||
@ -74,7 +70,6 @@ Event Event::CursorShape(std::string input, int shape) {
|
|||||||
|
|
||||||
/// @brief An custom event whose meaning is defined by the user of the library.
|
/// @brief An custom event whose meaning is defined by the user of the library.
|
||||||
/// @param input An arbitrary sequence of character defined by the developer.
|
/// @param input An arbitrary sequence of character defined by the developer.
|
||||||
/// @ingroup component
|
|
||||||
// static
|
// static
|
||||||
Event Event::Special(std::string input) {
|
Event Event::Special(std::string input) {
|
||||||
Event event;
|
Event event;
|
||||||
|
@ -11,7 +11,6 @@ namespace ftxui {
|
|||||||
|
|
||||||
/// @brief A Loop is a wrapper around a Component and a ScreenInteractive.
|
/// @brief A Loop is a wrapper around a Component and a ScreenInteractive.
|
||||||
/// It is used to run a Component in a terminal.
|
/// It is used to run a Component in a terminal.
|
||||||
/// @ingroup component
|
|
||||||
/// @see Component, ScreenInteractive.
|
/// @see Component, ScreenInteractive.
|
||||||
/// @see ScreenInteractive::Loop().
|
/// @see ScreenInteractive::Loop().
|
||||||
/// @see ScreenInteractive::ExitLoop().
|
/// @see ScreenInteractive::ExitLoop().
|
||||||
@ -28,7 +27,6 @@ Loop::~Loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Whether the loop has quitted.
|
/// @brief Whether the loop has quitted.
|
||||||
/// @ingroup component
|
|
||||||
bool Loop::HasQuitted() {
|
bool Loop::HasQuitted() {
|
||||||
return screen_->HasQuitted();
|
return screen_->HasQuitted();
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,6 @@ ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @ingroup component
|
|
||||||
/// Create a ScreenInteractive taking the full terminal size. This is using the
|
/// Create a ScreenInteractive taking the full terminal size. This is using the
|
||||||
/// alternate screen buffer to avoid messing with the terminal content.
|
/// alternate screen buffer to avoid messing with the terminal content.
|
||||||
/// @note This is the same as `ScreenInteractive::FullscreenAlternateScreen()`
|
/// @note This is the same as `ScreenInteractive::FullscreenAlternateScreen()`
|
||||||
@ -375,7 +374,6 @@ ScreenInteractive ScreenInteractive::Fullscreen() {
|
|||||||
return FullscreenAlternateScreen();
|
return FullscreenAlternateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @ingroup component
|
|
||||||
/// Create a ScreenInteractive taking the full terminal size. The primary screen
|
/// Create a ScreenInteractive taking the full terminal size. The primary screen
|
||||||
/// buffer is being used. It means if the terminal is resized, the previous
|
/// buffer is being used. It means if the terminal is resized, the previous
|
||||||
/// content might mess up with the terminal content.
|
/// content might mess up with the terminal content.
|
||||||
@ -389,7 +387,6 @@ ScreenInteractive ScreenInteractive::FullscreenPrimaryScreen() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @ingroup component
|
|
||||||
/// Create a ScreenInteractive taking the full terminal size. This is using the
|
/// Create a ScreenInteractive taking the full terminal size. This is using the
|
||||||
/// alternate screen buffer to avoid messing with the terminal content.
|
/// alternate screen buffer to avoid messing with the terminal content.
|
||||||
// static
|
// static
|
||||||
@ -422,7 +419,6 @@ ScreenInteractive ScreenInteractive::FitComponent() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @ingroup component
|
|
||||||
/// @brief Set whether mouse is tracked and events reported.
|
/// @brief Set whether mouse is tracked and events reported.
|
||||||
/// called outside of the main loop. E.g `ScreenInteractive::Loop(...)`.
|
/// called outside of the main loop. E.g `ScreenInteractive::Loop(...)`.
|
||||||
/// @param enable Whether to enable mouse event tracking.
|
/// @param enable Whether to enable mouse event tracking.
|
||||||
@ -444,7 +440,6 @@ void ScreenInteractive::TrackMouse(bool enable) {
|
|||||||
|
|
||||||
/// @brief Add a task to the main loop.
|
/// @brief Add a task to the main loop.
|
||||||
/// It will be executed later, after every other scheduled tasks.
|
/// It will be executed later, after every other scheduled tasks.
|
||||||
/// @ingroup component
|
|
||||||
void ScreenInteractive::Post(Task task) {
|
void ScreenInteractive::Post(Task task) {
|
||||||
// Task/Events sent toward inactive screen or screen waiting to become
|
// Task/Events sent toward inactive screen or screen waiting to become
|
||||||
// inactive are dropped.
|
// inactive are dropped.
|
||||||
@ -457,7 +452,6 @@ void ScreenInteractive::Post(Task task) {
|
|||||||
|
|
||||||
/// @brief Add an event to the main loop.
|
/// @brief Add an event to the main loop.
|
||||||
/// It will be executed later, after every other scheduled events.
|
/// It will be executed later, after every other scheduled events.
|
||||||
/// @ingroup component
|
|
||||||
void ScreenInteractive::PostEvent(Event event) {
|
void ScreenInteractive::PostEvent(Event event) {
|
||||||
Post(event);
|
Post(event);
|
||||||
}
|
}
|
||||||
@ -479,7 +473,6 @@ void ScreenInteractive::RequestAnimationFrame() {
|
|||||||
/// @brief Try to get the unique lock about behing able to capture the mouse.
|
/// @brief Try to get the unique lock about behing able to capture the mouse.
|
||||||
/// @return A unique lock if the mouse is not already captured, otherwise a
|
/// @return A unique lock if the mouse is not already captured, otherwise a
|
||||||
/// null.
|
/// null.
|
||||||
/// @ingroup component
|
|
||||||
CapturedMouse ScreenInteractive::CaptureMouse() {
|
CapturedMouse ScreenInteractive::CaptureMouse() {
|
||||||
if (mouse_captured) {
|
if (mouse_captured) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -491,14 +484,12 @@ CapturedMouse ScreenInteractive::CaptureMouse() {
|
|||||||
|
|
||||||
/// @brief Execute the main loop.
|
/// @brief Execute the main loop.
|
||||||
/// @param component The component to draw.
|
/// @param component The component to draw.
|
||||||
/// @ingroup component
|
|
||||||
void ScreenInteractive::Loop(Component component) { // NOLINT
|
void ScreenInteractive::Loop(Component component) { // NOLINT
|
||||||
class Loop loop(this, std::move(component));
|
class Loop loop(this, std::move(component));
|
||||||
loop.Run();
|
loop.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Return whether the main loop has been quit.
|
/// @brief Return whether the main loop has been quit.
|
||||||
/// @ingroup component
|
|
||||||
bool ScreenInteractive::HasQuitted() {
|
bool ScreenInteractive::HasQuitted() {
|
||||||
return task_receiver_->HasQuitted();
|
return task_receiver_->HasQuitted();
|
||||||
}
|
}
|
||||||
@ -1022,13 +1013,11 @@ void ScreenInteractive::ResetCursorPosition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Return a function to exit the main loop.
|
/// @brief Return a function to exit the main loop.
|
||||||
/// @ingroup component
|
|
||||||
Closure ScreenInteractive::ExitLoopClosure() {
|
Closure ScreenInteractive::ExitLoopClosure() {
|
||||||
return [this] { Exit(); };
|
return [this] { Exit(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Exit the main loop.
|
/// @brief Exit the main loop.
|
||||||
/// @ingroup component
|
|
||||||
void ScreenInteractive::Exit() {
|
void ScreenInteractive::Exit() {
|
||||||
Post([this] { ExitNow(); });
|
Post([this] { ExitNow(); });
|
||||||
}
|
}
|
||||||
|
@ -6,42 +6,36 @@
|
|||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
/// @brief Set the flexbox direction.
|
/// @brief Set the flexbox direction.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::Direction d) {
|
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::Direction d) {
|
||||||
this->direction = d;
|
this->direction = d;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set the flexbox wrap.
|
/// @brief Set the flexbox wrap.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::Wrap w) {
|
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::Wrap w) {
|
||||||
this->wrap = w;
|
this->wrap = w;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set the flexbox justify content.
|
/// @brief Set the flexbox justify content.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::JustifyContent j) {
|
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::JustifyContent j) {
|
||||||
this->justify_content = j;
|
this->justify_content = j;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set the flexbox align items.
|
/// @brief Set the flexbox align items.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::AlignItems a) {
|
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::AlignItems a) {
|
||||||
this->align_items = a;
|
this->align_items = a;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set the flexbox align content.
|
/// @brief Set the flexbox align content.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::AlignContent a) {
|
FlexboxConfig& FlexboxConfig::Set(FlexboxConfig::AlignContent a) {
|
||||||
this->align_content = a;
|
this->align_content = a;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set the flexbox flex direction.
|
/// @brief Set the flexbox flex direction.
|
||||||
/// @ingroup dom
|
|
||||||
FlexboxConfig& FlexboxConfig::SetGap(int x, int y) {
|
FlexboxConfig& FlexboxConfig::SetGap(int x, int y) {
|
||||||
this->gap_x = x;
|
this->gap_x = x;
|
||||||
this->gap_y = y;
|
this->gap_y = y;
|
||||||
|
@ -189,13 +189,11 @@ class LinearGradientColor : public NodeDecorator {
|
|||||||
/// .Stop(Color::Green, 0.5)
|
/// .Stop(Color::Green, 0.5)
|
||||||
/// .Stop(Color::Blue, 1.0);;
|
/// .Stop(Color::Blue, 1.0);;
|
||||||
/// ```
|
/// ```
|
||||||
/// @ingroup dom
|
|
||||||
LinearGradient::LinearGradient() = default;
|
LinearGradient::LinearGradient() = default;
|
||||||
|
|
||||||
/// @brief Build a gradient with two colors.
|
/// @brief Build a gradient with two colors.
|
||||||
/// @param begin The color at the beginning of the gradient.
|
/// @param begin The color at the beginning of the gradient.
|
||||||
/// @param end The color at the end of the gradient.
|
/// @param end The color at the end of the gradient.
|
||||||
/// @ingroup dom
|
|
||||||
LinearGradient::LinearGradient(Color begin, Color end)
|
LinearGradient::LinearGradient(Color begin, Color end)
|
||||||
: LinearGradient(0, begin, end) {}
|
: LinearGradient(0, begin, end) {}
|
||||||
|
|
||||||
@ -203,7 +201,6 @@ LinearGradient::LinearGradient(Color begin, Color end)
|
|||||||
/// @param a The angle of the gradient.
|
/// @param a The angle of the gradient.
|
||||||
/// @param begin The color at the beginning of the gradient.
|
/// @param begin The color at the beginning of the gradient.
|
||||||
/// @param end The color at the end of the gradient.
|
/// @param end The color at the end of the gradient.
|
||||||
/// @ingroup dom
|
|
||||||
LinearGradient::LinearGradient(float a, Color begin, Color end) : angle(a) {
|
LinearGradient::LinearGradient(float a, Color begin, Color end) : angle(a) {
|
||||||
stops.push_back({begin, {}});
|
stops.push_back({begin, {}});
|
||||||
stops.push_back({end, {}});
|
stops.push_back({end, {}});
|
||||||
@ -212,7 +209,6 @@ LinearGradient::LinearGradient(float a, Color begin, Color end) : angle(a) {
|
|||||||
/// @brief Set the angle of the gradient.
|
/// @brief Set the angle of the gradient.
|
||||||
/// @param a The angle of the gradient.
|
/// @param a The angle of the gradient.
|
||||||
/// @return The gradient.
|
/// @return The gradient.
|
||||||
/// @ingroup dom
|
|
||||||
LinearGradient& LinearGradient::Angle(float a) {
|
LinearGradient& LinearGradient::Angle(float a) {
|
||||||
angle = a;
|
angle = a;
|
||||||
return *this;
|
return *this;
|
||||||
@ -221,7 +217,6 @@ LinearGradient& LinearGradient::Angle(float a) {
|
|||||||
/// @brief Add a color stop to the gradient.
|
/// @brief Add a color stop to the gradient.
|
||||||
/// @param c The color of the stop.
|
/// @param c The color of the stop.
|
||||||
/// @param p The position of the stop.
|
/// @param p The position of the stop.
|
||||||
/// @return The gradient.
|
|
||||||
LinearGradient& LinearGradient::Stop(Color c, float p) {
|
LinearGradient& LinearGradient::Stop(Color c, float p) {
|
||||||
stops.push_back({c, p});
|
stops.push_back({c, p});
|
||||||
return *this;
|
return *this;
|
||||||
@ -230,7 +225,6 @@ LinearGradient& LinearGradient::Stop(Color c, float p) {
|
|||||||
/// @brief Add a color stop to the gradient.
|
/// @brief Add a color stop to the gradient.
|
||||||
/// @param c The color of the stop.
|
/// @param c The color of the stop.
|
||||||
/// @return The gradient.
|
/// @return The gradient.
|
||||||
/// @ingroup dom
|
|
||||||
/// @note The position of the stop is interpolated from nearby stops.
|
/// @note The position of the stop is interpolated from nearby stops.
|
||||||
LinearGradient& LinearGradient::Stop(Color c) {
|
LinearGradient& LinearGradient::Stop(Color c) {
|
||||||
stops.push_back({c, {}});
|
stops.push_back({c, {}});
|
||||||
|
@ -17,7 +17,6 @@ Node::Node(Elements children) : children_(std::move(children)) {}
|
|||||||
Node::~Node() = default;
|
Node::~Node() = default;
|
||||||
|
|
||||||
/// @brief Compute how much space an element needs.
|
/// @brief Compute how much space an element needs.
|
||||||
/// @ingroup dom
|
|
||||||
void Node::ComputeRequirement() {
|
void Node::ComputeRequirement() {
|
||||||
if (children_.empty()) {
|
if (children_.empty()) {
|
||||||
return;
|
return;
|
||||||
@ -39,13 +38,11 @@ void Node::ComputeRequirement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Assign a position and a dimension to an element for drawing.
|
/// @brief Assign a position and a dimension to an element for drawing.
|
||||||
/// @ingroup dom
|
|
||||||
void Node::SetBox(Box box) {
|
void Node::SetBox(Box box) {
|
||||||
box_ = box;
|
box_ = box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Compute the selection of an element.
|
/// @brief Compute the selection of an element.
|
||||||
/// @ingroup dom
|
|
||||||
void Node::Select(Selection& selection) {
|
void Node::Select(Selection& selection) {
|
||||||
// If this Node box_ doesn't intersect with the selection, then no selection.
|
// If this Node box_ doesn't intersect with the selection, then no selection.
|
||||||
if (Box::Intersection(selection.GetBox(), box_).IsEmpty()) {
|
if (Box::Intersection(selection.GetBox(), box_).IsEmpty()) {
|
||||||
@ -59,7 +56,6 @@ void Node::Select(Selection& selection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Display an element on a ftxui::Screen.
|
/// @brief Display an element on a ftxui::Screen.
|
||||||
/// @ingroup dom
|
|
||||||
void Node::Render(Screen& screen) {
|
void Node::Render(Screen& screen) {
|
||||||
for (auto& child : children_) {
|
for (auto& child : children_) {
|
||||||
child->Render(screen);
|
child->Render(screen);
|
||||||
|
@ -44,14 +44,12 @@ void Order(int& a, int& b) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
/// @brief Create an empty table.
|
/// @brief Create an empty table.
|
||||||
/// @ingroup dom
|
|
||||||
Table::Table() {
|
Table::Table() {
|
||||||
Initialize({});
|
Initialize({});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a table from a vector of vector of string.
|
/// @brief Create a table from a vector of vector of string.
|
||||||
/// @param input The input data.
|
/// @param input The input data.
|
||||||
/// @ingroup dom
|
|
||||||
Table::Table(std::vector<std::vector<std::string>> input) {
|
Table::Table(std::vector<std::vector<std::string>> input) {
|
||||||
std::vector<std::vector<Element>> output;
|
std::vector<std::vector<Element>> output;
|
||||||
output.reserve(input.size());
|
output.reserve(input.size());
|
||||||
@ -68,14 +66,12 @@ Table::Table(std::vector<std::vector<std::string>> input) {
|
|||||||
|
|
||||||
/// @brief Create a table from a vector of vector of Element
|
/// @brief Create a table from a vector of vector of Element
|
||||||
/// @param input The input elements.
|
/// @param input The input elements.
|
||||||
/// @ingroup dom
|
|
||||||
Table::Table(std::vector<std::vector<Element>> input) {
|
Table::Table(std::vector<std::vector<Element>> input) {
|
||||||
Initialize(std::move(input));
|
Initialize(std::move(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @brief Create a table from a list of list of string.
|
// @brief Create a table from a list of list of string.
|
||||||
// @param init The input data.
|
// @param init The input data.
|
||||||
// @ingroup dom
|
|
||||||
Table::Table(std::initializer_list<std::vector<std::string>> init) {
|
Table::Table(std::initializer_list<std::vector<std::string>> init) {
|
||||||
std::vector<std::vector<Element>> input;
|
std::vector<std::vector<Element>> input;
|
||||||
for (const auto& row : init) {
|
for (const auto& row : init) {
|
||||||
@ -139,7 +135,6 @@ void Table::Initialize(std::vector<std::vector<Element>> input) {
|
|||||||
/// @brief Select a row of the table.
|
/// @brief Select a row of the table.
|
||||||
/// @param index The index of the row to select.
|
/// @param index The index of the row to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectRow(int index) {
|
TableSelection Table::SelectRow(int index) {
|
||||||
return SelectRectangle(0, -1, index, index);
|
return SelectRectangle(0, -1, index, index);
|
||||||
}
|
}
|
||||||
@ -148,7 +143,6 @@ TableSelection Table::SelectRow(int index) {
|
|||||||
/// @param row_min The first row to select.
|
/// @param row_min The first row to select.
|
||||||
/// @param row_max The last row to select.
|
/// @param row_max The last row to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectRows(int row_min, int row_max) {
|
TableSelection Table::SelectRows(int row_min, int row_max) {
|
||||||
return SelectRectangle(0, -1, row_min, row_max);
|
return SelectRectangle(0, -1, row_min, row_max);
|
||||||
}
|
}
|
||||||
@ -156,7 +150,6 @@ TableSelection Table::SelectRows(int row_min, int row_max) {
|
|||||||
/// @brief Select a column of the table.
|
/// @brief Select a column of the table.
|
||||||
/// @param index The index of the column to select.
|
/// @param index The index of the column to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectColumn(int index) {
|
TableSelection Table::SelectColumn(int index) {
|
||||||
return SelectRectangle(index, index, 0, -1);
|
return SelectRectangle(index, index, 0, -1);
|
||||||
}
|
}
|
||||||
@ -165,7 +158,6 @@ TableSelection Table::SelectColumn(int index) {
|
|||||||
/// @param column_min The first column to select.
|
/// @param column_min The first column to select.
|
||||||
/// @param column_max The last column to select.
|
/// @param column_max The last column to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectColumns(int column_min, int column_max) {
|
TableSelection Table::SelectColumns(int column_min, int column_max) {
|
||||||
return SelectRectangle(column_min, column_max, 0, -1);
|
return SelectRectangle(column_min, column_max, 0, -1);
|
||||||
}
|
}
|
||||||
@ -174,7 +166,6 @@ TableSelection Table::SelectColumns(int column_min, int column_max) {
|
|||||||
/// @param column The column of the cell to select.
|
/// @param column The column of the cell to select.
|
||||||
/// @param row The row of the cell to select.
|
/// @param row The row of the cell to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectCell(int column, int row) {
|
TableSelection Table::SelectCell(int column, int row) {
|
||||||
return SelectRectangle(column, column, row, row);
|
return SelectRectangle(column, column, row, row);
|
||||||
}
|
}
|
||||||
@ -185,7 +176,6 @@ TableSelection Table::SelectCell(int column, int row) {
|
|||||||
/// @param row_min The first row to select.
|
/// @param row_min The first row to select.
|
||||||
/// @param row_max The last row to select.
|
/// @param row_max The last row to select.
|
||||||
/// @note You can use negative index to select from the end.
|
/// @note You can use negative index to select from the end.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectRectangle(int column_min,
|
TableSelection Table::SelectRectangle(int column_min,
|
||||||
int column_max,
|
int column_max,
|
||||||
int row_min,
|
int row_min,
|
||||||
@ -207,7 +197,6 @@ TableSelection Table::SelectRectangle(int column_min,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Select all the table.
|
/// @brief Select all the table.
|
||||||
/// @ingroup dom
|
|
||||||
TableSelection Table::SelectAll() {
|
TableSelection Table::SelectAll() {
|
||||||
TableSelection output; // NOLINT
|
TableSelection output; // NOLINT
|
||||||
output.table_ = this;
|
output.table_ = this;
|
||||||
@ -220,7 +209,6 @@ TableSelection Table::SelectAll() {
|
|||||||
|
|
||||||
/// @brief Render the table.
|
/// @brief Render the table.
|
||||||
/// @return The rendered table. This is an element you can draw.
|
/// @return The rendered table. This is an element you can draw.
|
||||||
/// @ingroup dom
|
|
||||||
Element Table::Render() {
|
Element Table::Render() {
|
||||||
for (int y = 0; y < dim_y_; ++y) {
|
for (int y = 0; y < dim_y_; ++y) {
|
||||||
for (int x = 0; x < dim_x_; ++x) {
|
for (int x = 0; x < dim_x_; ++x) {
|
||||||
@ -250,7 +238,6 @@ Element Table::Render() {
|
|||||||
/// @brief Apply the `decorator` to the selection.
|
/// @brief Apply the `decorator` to the selection.
|
||||||
/// This decorate both the cells, the lines and the corners.
|
/// This decorate both the cells, the lines and the corners.
|
||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::Decorate(Decorator decorator) {
|
void TableSelection::Decorate(Decorator decorator) {
|
||||||
for (int y = y_min_; y <= y_max_; ++y) {
|
for (int y = y_min_; y <= y_max_; ++y) {
|
||||||
@ -264,7 +251,6 @@ void TableSelection::Decorate(Decorator decorator) {
|
|||||||
/// @brief Apply the `decorator` to the selection.
|
/// @brief Apply the `decorator` to the selection.
|
||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// This decorate only the cells.
|
/// This decorate only the cells.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::DecorateCells(Decorator decorator) {
|
void TableSelection::DecorateCells(Decorator decorator) {
|
||||||
for (int y = y_min_; y <= y_max_; ++y) {
|
for (int y = y_min_; y <= y_max_; ++y) {
|
||||||
@ -282,7 +268,6 @@ void TableSelection::DecorateCells(Decorator decorator) {
|
|||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// @param modulo The modulo of the lines to decorate.
|
/// @param modulo The modulo of the lines to decorate.
|
||||||
/// @param shift The shift of the lines to decorate.
|
/// @param shift The shift of the lines to decorate.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::DecorateAlternateColumn(Decorator decorator,
|
void TableSelection::DecorateAlternateColumn(Decorator decorator,
|
||||||
int modulo,
|
int modulo,
|
||||||
@ -302,7 +287,6 @@ void TableSelection::DecorateAlternateColumn(Decorator decorator,
|
|||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// @param modulo The modulo of the lines to decorate.
|
/// @param modulo The modulo of the lines to decorate.
|
||||||
/// @param shift The shift of the lines to decorate.
|
/// @param shift The shift of the lines to decorate.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::DecorateAlternateRow(Decorator decorator,
|
void TableSelection::DecorateAlternateRow(Decorator decorator,
|
||||||
int modulo,
|
int modulo,
|
||||||
@ -322,7 +306,6 @@ void TableSelection::DecorateAlternateRow(Decorator decorator,
|
|||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// @param modulo The modulo of the corners to decorate.
|
/// @param modulo The modulo of the corners to decorate.
|
||||||
/// @param shift The shift of the corners to decorate.
|
/// @param shift The shift of the corners to decorate.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::DecorateCellsAlternateColumn(Decorator decorator,
|
void TableSelection::DecorateCellsAlternateColumn(Decorator decorator,
|
||||||
int modulo,
|
int modulo,
|
||||||
@ -342,7 +325,6 @@ void TableSelection::DecorateCellsAlternateColumn(Decorator decorator,
|
|||||||
/// @param decorator The decorator to apply.
|
/// @param decorator The decorator to apply.
|
||||||
/// @param modulo The modulo of the corners to decorate.
|
/// @param modulo The modulo of the corners to decorate.
|
||||||
/// @param shift The shift of the corners to decorate.
|
/// @param shift The shift of the corners to decorate.
|
||||||
/// @ingroup dom
|
|
||||||
// NOLINTNEXTLINE
|
// NOLINTNEXTLINE
|
||||||
void TableSelection::DecorateCellsAlternateRow(Decorator decorator,
|
void TableSelection::DecorateCellsAlternateRow(Decorator decorator,
|
||||||
int modulo,
|
int modulo,
|
||||||
@ -359,7 +341,6 @@ void TableSelection::DecorateCellsAlternateRow(Decorator decorator,
|
|||||||
|
|
||||||
/// @brief Apply a `border` around the selection.
|
/// @brief Apply a `border` around the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::Border(BorderStyle border) {
|
void TableSelection::Border(BorderStyle border) {
|
||||||
BorderLeft(border);
|
BorderLeft(border);
|
||||||
BorderRight(border);
|
BorderRight(border);
|
||||||
@ -378,7 +359,6 @@ void TableSelection::Border(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some separator lines in the selection.
|
/// @brief Draw some separator lines in the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::Separator(BorderStyle border) {
|
void TableSelection::Separator(BorderStyle border) {
|
||||||
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
||||||
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
||||||
@ -394,7 +374,6 @@ void TableSelection::Separator(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some vertical separator lines in the selection.
|
/// @brief Draw some vertical separator lines in the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::SeparatorVertical(BorderStyle border) {
|
void TableSelection::SeparatorVertical(BorderStyle border) {
|
||||||
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
||||||
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
||||||
@ -408,7 +387,6 @@ void TableSelection::SeparatorVertical(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some horizontal separator lines in the selection.
|
/// @brief Draw some horizontal separator lines in the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::SeparatorHorizontal(BorderStyle border) {
|
void TableSelection::SeparatorHorizontal(BorderStyle border) {
|
||||||
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
for (int y = y_min_ + 1; y <= y_max_ - 1; ++y) {
|
||||||
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
for (int x = x_min_ + 1; x <= x_max_ - 1; ++x) {
|
||||||
@ -422,7 +400,6 @@ void TableSelection::SeparatorHorizontal(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some separator lines to the left side of the selection.
|
/// @brief Draw some separator lines to the left side of the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::BorderLeft(BorderStyle border) {
|
void TableSelection::BorderLeft(BorderStyle border) {
|
||||||
for (int y = y_min_; y <= y_max_; y++) {
|
for (int y = y_min_; y <= y_max_; y++) {
|
||||||
table_->elements_[y][x_min_] =
|
table_->elements_[y][x_min_] =
|
||||||
@ -432,7 +409,6 @@ void TableSelection::BorderLeft(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some separator lines to the right side of the selection.
|
/// @brief Draw some separator lines to the right side of the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::BorderRight(BorderStyle border) {
|
void TableSelection::BorderRight(BorderStyle border) {
|
||||||
for (int y = y_min_; y <= y_max_; y++) {
|
for (int y = y_min_; y <= y_max_; y++) {
|
||||||
table_->elements_[y][x_max_] =
|
table_->elements_[y][x_max_] =
|
||||||
@ -442,7 +418,6 @@ void TableSelection::BorderRight(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some separator lines to the top side of the selection.
|
/// @brief Draw some separator lines to the top side of the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::BorderTop(BorderStyle border) {
|
void TableSelection::BorderTop(BorderStyle border) {
|
||||||
for (int x = x_min_; x <= x_max_; x++) {
|
for (int x = x_min_; x <= x_max_; x++) {
|
||||||
table_->elements_[y_min_][x] =
|
table_->elements_[y_min_][x] =
|
||||||
@ -452,7 +427,6 @@ void TableSelection::BorderTop(BorderStyle border) {
|
|||||||
|
|
||||||
/// @brief Draw some separator lines to the bottom side of the selection.
|
/// @brief Draw some separator lines to the bottom side of the selection.
|
||||||
/// @param border The border style to apply.
|
/// @param border The border style to apply.
|
||||||
/// @ingroup dom
|
|
||||||
void TableSelection::BorderBottom(BorderStyle border) {
|
void TableSelection::BorderBottom(BorderStyle border) {
|
||||||
for (int x = x_min_; x <= x_max_; x++) {
|
for (int x = x_min_; x <= x_max_; x++) {
|
||||||
table_->elements_[y_max_][x] =
|
table_->elements_[y_max_][x] =
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
/// @return the biggest Box contained in both |a| and |b|.
|
/// @return the biggest Box contained in both |a| and |b|.
|
||||||
/// @ingroup screen
|
|
||||||
// static
|
// static
|
||||||
Box Box::Intersection(Box a, Box b) {
|
Box Box::Intersection(Box a, Box b) {
|
||||||
return Box{
|
return Box{
|
||||||
@ -19,7 +18,6 @@ Box Box::Intersection(Box a, Box b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @return the smallest Box containing both |a| and |b|.
|
/// @return the smallest Box containing both |a| and |b|.
|
||||||
/// @ingroup screen
|
|
||||||
// static
|
// static
|
||||||
Box Box::Union(Box a, Box b) {
|
Box Box::Union(Box a, Box b) {
|
||||||
return Box{
|
return Box{
|
||||||
@ -33,7 +31,6 @@ Box Box::Union(Box a, Box b) {
|
|||||||
/// Shift the box by (x,y).
|
/// Shift the box by (x,y).
|
||||||
/// @param x horizontal shift.
|
/// @param x horizontal shift.
|
||||||
/// @param y vertical shift.
|
/// @param y vertical shift.
|
||||||
/// @ingroup screen
|
|
||||||
void Box::Shift(int x, int y) {
|
void Box::Shift(int x, int y) {
|
||||||
x_min += x;
|
x_min += x;
|
||||||
x_max += x;
|
x_max += x;
|
||||||
@ -42,7 +39,6 @@ void Box::Shift(int x, int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @return whether (x,y) is contained inside the box.
|
/// @return whether (x,y) is contained inside the box.
|
||||||
/// @ingroup screen
|
|
||||||
bool Box::Contain(int x, int y) const {
|
bool Box::Contain(int x, int y) const {
|
||||||
return x_min <= x && //
|
return x_min <= x && //
|
||||||
x_max >= x && //
|
x_max >= x && //
|
||||||
@ -51,20 +47,17 @@ bool Box::Contain(int x, int y) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @return whether the box is empty.
|
/// @return whether the box is empty.
|
||||||
/// @ingroup screen
|
|
||||||
bool Box::IsEmpty() const {
|
bool Box::IsEmpty() const {
|
||||||
return x_min > x_max || y_min > y_max;
|
return x_min > x_max || y_min > y_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return whether |other| is the same as |this|
|
/// @return whether |other| is the same as |this|
|
||||||
/// @ingroup screen
|
|
||||||
bool Box::operator==(const Box& other) const {
|
bool Box::operator==(const Box& other) const {
|
||||||
return (x_min == other.x_min) && (x_max == other.x_max) &&
|
return (x_min == other.x_min) && (x_max == other.x_max) &&
|
||||||
(y_min == other.y_min) && (y_max == other.y_max);
|
(y_min == other.y_min) && (y_max == other.y_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return whether |other| and |this| are different.
|
/// @return whether |other| and |this| are different.
|
||||||
/// @ingroup screen
|
|
||||||
bool Box::operator!=(const Box& other) const {
|
bool Box::operator!=(const Box& other) const {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
@ -74,20 +74,16 @@ std::string Color::Print(bool is_background_color) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Build a transparent color.
|
/// @brief Build a transparent color.
|
||||||
/// @ingroup screen
|
|
||||||
Color::Color() = default;
|
Color::Color() = default;
|
||||||
|
|
||||||
/// @brief Build a transparent color.
|
/// @brief Build a transparent color.
|
||||||
/// @ingroup screen
|
|
||||||
Color::Color(Palette1 /*value*/) : Color() {}
|
Color::Color(Palette1 /*value*/) : Color() {}
|
||||||
|
|
||||||
/// @brief Build a color using the Palette16 colors.
|
/// @brief Build a color using the Palette16 colors.
|
||||||
/// @ingroup screen
|
|
||||||
Color::Color(Palette16 index)
|
Color::Color(Palette16 index)
|
||||||
: type_(ColorType::Palette16), red_(index), alpha_(255) {}
|
: type_(ColorType::Palette16), red_(index), alpha_(255) {}
|
||||||
|
|
||||||
/// @brief Build a color using Palette256 colors.
|
/// @brief Build a color using Palette256 colors.
|
||||||
/// @ingroup screen
|
|
||||||
Color::Color(Palette256 index)
|
Color::Color(Palette256 index)
|
||||||
: type_(ColorType::Palette256), red_(index), alpha_(255) {
|
: type_(ColorType::Palette256), red_(index), alpha_(255) {
|
||||||
if (Terminal::ColorSupport() >= Terminal::Color::Palette256) {
|
if (Terminal::ColorSupport() >= Terminal::Color::Palette256) {
|
||||||
@ -104,7 +100,6 @@ Color::Color(Palette256 index)
|
|||||||
/// @param green The quantity of green [0,255]
|
/// @param green The quantity of green [0,255]
|
||||||
/// @param blue The quantity of blue [0,255]
|
/// @param blue The quantity of blue [0,255]
|
||||||
/// @param alpha The quantity of alpha [0,255]
|
/// @param alpha The quantity of alpha [0,255]
|
||||||
/// @ingroup screen
|
|
||||||
Color::Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
|
Color::Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
|
||||||
: type_(ColorType::TrueColor),
|
: type_(ColorType::TrueColor),
|
||||||
red_(red),
|
red_(red),
|
||||||
@ -148,7 +143,6 @@ Color::Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
|
|||||||
/// @param red The quantity of red [0,255]
|
/// @param red The quantity of red [0,255]
|
||||||
/// @param green The quantity of green [0,255]
|
/// @param green The quantity of green [0,255]
|
||||||
/// @param blue The quantity of blue [0,255]
|
/// @param blue The quantity of blue [0,255]
|
||||||
/// @ingroup screen
|
|
||||||
// static
|
// static
|
||||||
Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
|
Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
|
||||||
return RGBA(red, green, blue, 255);
|
return RGBA(red, green, blue, 255);
|
||||||
@ -160,7 +154,6 @@ Color Color::RGB(uint8_t red, uint8_t green, uint8_t blue) {
|
|||||||
/// @param green The quantity of green [0,255]
|
/// @param green The quantity of green [0,255]
|
||||||
/// @param blue The quantity of blue [0,255]
|
/// @param blue The quantity of blue [0,255]
|
||||||
/// @param alpha The quantity of alpha [0,255]
|
/// @param alpha The quantity of alpha [0,255]
|
||||||
/// @ingroup screen
|
|
||||||
/// @see Color::RGB
|
/// @see Color::RGB
|
||||||
// static
|
// static
|
||||||
Color Color::RGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
|
Color Color::RGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
|
||||||
@ -174,7 +167,6 @@ Color Color::RGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
|
|||||||
/// @param s The "colorfulness" [0,255].
|
/// @param s The "colorfulness" [0,255].
|
||||||
/// @param v The "Lightness" [0,255]
|
/// @param v The "Lightness" [0,255]
|
||||||
/// @param alpha The quantity of alpha [0,255]
|
/// @param alpha The quantity of alpha [0,255]
|
||||||
/// @ingroup screen
|
|
||||||
// static
|
// static
|
||||||
Color Color::HSVA(uint8_t h, uint8_t s, uint8_t v, uint8_t alpha) {
|
Color Color::HSVA(uint8_t h, uint8_t s, uint8_t v, uint8_t alpha) {
|
||||||
uint8_t region = h / 43; // NOLINT
|
uint8_t region = h / 43; // NOLINT
|
||||||
@ -202,7 +194,6 @@ Color Color::HSVA(uint8_t h, uint8_t s, uint8_t v, uint8_t alpha) {
|
|||||||
/// @param h The hue of the color [0,255]
|
/// @param h The hue of the color [0,255]
|
||||||
/// @param s The "colorfulness" [0,255].
|
/// @param s The "colorfulness" [0,255].
|
||||||
/// @param v The "Lightness" [0,255]
|
/// @param v The "Lightness" [0,255]
|
||||||
/// @ingroup screen
|
|
||||||
// static
|
// static
|
||||||
Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
|
Color Color::HSV(uint8_t h, uint8_t s, uint8_t v) {
|
||||||
return HSVA(h, s, v, 255);
|
return HSVA(h, s, v, 255);
|
||||||
|
Loading…
Reference in New Issue
Block a user