mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-05-06 09:13:48 +08:00
Fix: Add separator(Pixel) back.
It was removed by mistacke previously. Take the opportunity to create new documentation.
This commit is contained in:
parent
05fc866d74
commit
6dd626a79a
@ -58,24 +58,184 @@ class SeparatorWithPixel : public Separator {
|
|||||||
Pixel pixel_;
|
Pixel pixel_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @brief Draw a vertical or horizontal separator in between two elements.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separator(),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
/// ────
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
Element separator() {
|
Element separator() {
|
||||||
return std::make_shared<Separator>(LIGHT);
|
return std::make_shared<Separator>(LIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw a vertical or horizontal separator in between two elements.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separatorStyled(BorderStyle::LIGHT),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
/// ────
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
Element separatorStyled(BorderStyle style) {
|
Element separatorStyled(BorderStyle style) {
|
||||||
return std::make_shared<Separator>(style);
|
return std::make_shared<Separator>(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw a vertical or horizontal light separator in between two
|
||||||
|
/// elements.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separatorLight(),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
/// ────
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
Element separatorLight() {
|
Element separatorLight() {
|
||||||
return std::make_shared<Separator>(LIGHT);
|
return std::make_shared<Separator>(LIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw a vertical or horizontal heavy separator in between two
|
||||||
|
/// elements.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separatorHeavy(),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
/// ━━━━
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
Element separatorHeavy() {
|
Element separatorHeavy() {
|
||||||
return std::make_shared<Separator>(HEAVY);
|
return std::make_shared<Separator>(HEAVY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw a vertical or horizontal double separator in between two
|
||||||
|
/// elements.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separatorDouble(),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
/// ════
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
Element separatorDouble() {
|
Element separatorDouble() {
|
||||||
return std::make_shared<Separator>(DOUBLE);
|
return std::make_shared<Separator>(DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Draw a separator in between two element filled with a given pixel.
|
||||||
|
/// @ingroup dom
|
||||||
|
/// @see separator
|
||||||
|
/// @see separatorLight
|
||||||
|
/// @see separatorHeavy
|
||||||
|
/// @see separatorDouble
|
||||||
|
/// @see separatorStyled
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```cpp
|
||||||
|
/// Pixel empty;
|
||||||
|
/// Element document = vbox({
|
||||||
|
/// text("Up"),
|
||||||
|
/// separator(empty),
|
||||||
|
/// text("Down"),
|
||||||
|
/// })
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Output
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// Up
|
||||||
|
///
|
||||||
|
/// Down
|
||||||
|
/// ```
|
||||||
|
Element separator(Pixel pixel) {
|
||||||
|
return std::make_shared<SeparatorWithPixel>(pixel);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
|
||||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||||
|
Loading…
Reference in New Issue
Block a user