Revert "Feature resizable spilt with custom separator (#583)"

This reverts commit eb313e0f2d.
This commit is contained in:
ArthurSonzogni
2023-05-25 19:45:59 +02:00
parent 41c3d4dd52
commit 1e86587b68
15 changed files with 329 additions and 392 deletions

View File

@@ -92,7 +92,6 @@ Component ResizableSplitLeft(Component main, Component back, int* main_size);
Component ResizableSplitRight(Component main, Component back, int* main_size);
Component ResizableSplitTop(Component main, Component back, int* main_size);
Component ResizableSplitBottom(Component main, Component back, int* main_size);
Component ResizableSplit(ResizableSplitOption options);
Component Renderer(Component child, std::function<Element()>);
Component Renderer(std::function<Element()>);

View File

@@ -3,14 +3,12 @@
#include <chrono> // for milliseconds
#include <ftxui/component/animation.hpp> // for Duration, QuadraticInOut, Function
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Left, Direction::Right, Direction::Down
#include <ftxui/dom/elements.hpp> // for Element, separator
#include <ftxui/util/ref.hpp> // for Ref, ConstRef
#include <functional> // for function
#include <optional> // for optional
#include <string> // for string
#include <ftxui/dom/elements.hpp> // for Element, GaugeDirection, GaugeDirection::Right
#include <ftxui/util/ref.hpp> // for Ref, ConstRef
#include <functional> // for function
#include <optional> // for optional
#include <string> // for string
#include "ftxui/component/component_base.hpp" // for Component
#include "ftxui/screen/color.hpp" // for Color, Color::GrayDark, Color::White
namespace ftxui {
@@ -89,7 +87,8 @@ struct MenuOption {
// Style:
UnderlineOption underline;
MenuEntryOption entries;
Direction direction = Direction::Down;
enum Direction { Up, Down, Left, Right };
Direction direction = Down;
std::function<Element()> elements_prefix;
std::function<Element()> elements_infix;
std::function<Element()> elements_postfix;
@@ -165,16 +164,6 @@ struct RadioboxOption {
Ref<int> focused_entry = 0;
};
struct ResizableSplitOption {
Component main;
Component back;
Ref<Direction> direction = Direction::Left;
Ref<int> main_size =
(direction() == Direction::Left || direction() == Direction::Right) ? 20
: 10;
std::function<Element()> separator_func = [] { return ::ftxui::separator(); };
};
// @brief Option for the `Slider` component.
// @ingroup component
template <typename T>
@@ -183,7 +172,7 @@ struct SliderOption {
ConstRef<T> min = T(0);
ConstRef<T> max = T(100);
ConstRef<T> increment = (max() - min()) / 20;
Direction direction = Direction::Right;
GaugeDirection direction = GaugeDirection::Right;
Color color_active = Color::White;
Color color_inactive = Color::GrayDark;
};

View File

@@ -1,17 +0,0 @@
#ifndef FTXUI_DOM_DIRECTION_HPP
#define FTXUI_DOM_DIRECTION_HPP
namespace ftxui {
enum class Direction {
Up = 0,
Down = 1,
Left = 2,
Right = 3,
};
} // namespace ftxui
#endif // FTXUI_DOM_DIRECTION_HPP
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@@ -5,7 +5,6 @@
#include <memory>
#include "ftxui/dom/canvas.hpp"
#include "ftxui/dom/direction.hpp"
#include "ftxui/dom/flexbox_config.hpp"
#include "ftxui/dom/linear_gradient.hpp"
#include "ftxui/dom/node.hpp"
@@ -31,6 +30,8 @@ enum BorderStyle {
EMPTY,
};
enum class GaugeDirection { Left, Up, Right, Down };
// Pipe elements into decorator togethers.
// For instance the next lines are equivalents:
// -> text("ftxui") | bold | underlined
@@ -65,7 +66,7 @@ Element gaugeLeft(float progress);
Element gaugeRight(float progress);
Element gaugeUp(float progress);
Element gaugeDown(float progress);
Element gaugeDirection(float progress, Direction direction);
Element gaugeDirection(float progress, GaugeDirection);
Element border(Element);
Element borderLight(Element);
Element borderDashed(Element);
@@ -140,9 +141,9 @@ Element notflex(Element); // Reset the flex attribute.
Element filler(); // A blank expandable element.
// -- Size override;
enum WidthOrHeight { WIDTH, HEIGHT };
enum Direction { WIDTH, HEIGHT };
enum Constraint { LESS_THAN, EQUAL, GREATER_THAN };
Decorator size(WidthOrHeight, Constraint, int value);
Decorator size(Direction, Constraint, int value);
// --- Frame ---
// A frame is a scrollable area. The internal area is potentially larger than