mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 08:04:21 +08:00
feat: Dropdown select menu. (#214)
Dom - `vscroll_indicator`. Show a scrollback indicator on the right. Component - `Maybe`: Display an component conditionnally based on a boolean. - `Dropdown`: A dropdown select list. This address: https://github.com/ArthurSonzogni/FTXUI/issues/204
This commit is contained in:
@@ -39,6 +39,7 @@ Component Menu(ConstStringListRef entries,
|
||||
int* selected_,
|
||||
Ref<MenuOption> = {});
|
||||
Component MenuEntry(ConstStringRef label, Ref<MenuEntryOption> = {});
|
||||
Component Dropdown(ConstStringListRef entries, int* selected);
|
||||
Component Radiobox(ConstStringListRef entries,
|
||||
int* selected_,
|
||||
Ref<RadioboxOption> option = {});
|
||||
@@ -55,6 +56,7 @@ Component Renderer(Component child, std::function<Element()>);
|
||||
Component Renderer(std::function<Element()>);
|
||||
Component Renderer(std::function<Element(bool /* focused */)>);
|
||||
Component CatchEvent(Component child, std::function<bool(Event)>);
|
||||
Component Maybe(Component, bool* show);
|
||||
|
||||
namespace Container {
|
||||
Component Vertical(Components children);
|
||||
|
@@ -74,6 +74,7 @@ struct Event {
|
||||
bool operator!=(const Event& other) const { return !operator==(other); }
|
||||
|
||||
//--- State section ----------------------------------------------------------
|
||||
ScreenInteractive* screen_ = nullptr;
|
||||
private:
|
||||
friend ComponentBase;
|
||||
friend ScreenInteractive;
|
||||
@@ -95,8 +96,6 @@ struct Event {
|
||||
struct Cursor cursor_;
|
||||
};
|
||||
std::string input_;
|
||||
|
||||
ScreenInteractive* screen_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ftxui
|
||||
|
@@ -104,6 +104,8 @@ Element yframe(Element);
|
||||
Element focus(Element);
|
||||
Element select(Element);
|
||||
|
||||
Element vscroll_indicator(Element);
|
||||
|
||||
// --- Util --------------------------------------------------------------------
|
||||
Element hcenter(Element);
|
||||
Element vcenter(Element);
|
||||
|
Reference in New Issue
Block a user