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