|
23 | 23 | #include "tuikit/widgets/TUIForm.h" |
24 | 24 | #include "tuikit/widgets/TUIStatusBar.h" |
25 | 25 | #include "tuikit/widgets/TUIToolbar.h" |
| 26 | +#include "tuikit/widgets/TUITreeView.h" |
| 27 | +#include "tuikit/widgets/TUITextArea.h" |
| 28 | +#include "tuikit/widgets/TUIProgressBar.h" |
| 29 | +#include "tuikit/widgets/TUIScrollableContainer.h" |
| 30 | + |
| 31 | + |
| 32 | +#include <memory> |
| 33 | +#include <string> |
| 34 | +#include <vector> |
| 35 | + |
| 36 | +namespace TUIKIT { |
| 37 | + |
| 38 | + // Widget Aliases |
| 39 | + using Widget = std::shared_ptr<TUIWidget>; |
| 40 | + using Button = std::shared_ptr<TUIButton>; |
| 41 | + using CheckBox = std::shared_ptr<TUICheckBox>; |
| 42 | + using Collapsible = std::shared_ptr<TUICollapsible>; |
| 43 | + using ComboBox = std::shared_ptr<TUIComboBox>; |
| 44 | + using Form = std::shared_ptr<TUIForm>; |
| 45 | + using GroupBox = std::shared_ptr<TUIGroupBox>; |
| 46 | + using Label = std::shared_ptr<TUILabel>; |
| 47 | + using Menu = std::shared_ptr<TUIMenu>; |
| 48 | + using ProgressBar = std::shared_ptr<TUIProgressBar>; |
| 49 | + using RadioBox = std::shared_ptr<TUIRadioBox>; |
| 50 | + using ResizableSplit = std::shared_ptr<TUIResizableSplit>; |
| 51 | + using ScrollableContainer = std::shared_ptr<TUIScrollableContainer>; |
| 52 | + using Slider = std::shared_ptr<TUISlider>; |
| 53 | + using StatusBar = std::shared_ptr<TUIStatusBar>; |
| 54 | + using TabWidget = std::shared_ptr<TUITabWidget>; |
| 55 | + using TextArea = std::shared_ptr<TUITextArea>; |
| 56 | + using TextField = std::shared_ptr<TUITextField>; |
| 57 | + using Toolbar = std::shared_ptr<TUIToolbar>; |
| 58 | + using TreeView = std::shared_ptr<TUITreeView>; |
| 59 | + |
| 60 | + // Layout Aliases |
| 61 | + using Layout = std::shared_ptr<TUILayout>; |
| 62 | + using HBoxLayout = std::shared_ptr<TUIHBoxLayout>; |
| 63 | + using VBoxLayout = std::shared_ptr<TUIVBoxLayout>; |
| 64 | + |
| 65 | + // Factory Functions |
| 66 | + inline Button button(const std::string& text) { |
| 67 | + return std::make_shared<TUIButton>(text); |
| 68 | + } |
| 69 | + |
| 70 | + inline CheckBox checkbox(const std::string& text, bool initial_checked = false) { |
| 71 | + return std::make_shared<TUICheckBox>(text, initial_checked); |
| 72 | + } |
| 73 | + |
| 74 | + inline Collapsible collapsible(const std::string& title, Widget content) { |
| 75 | + return std::make_shared<TUICollapsible>(title, content); |
| 76 | + } |
| 77 | + |
| 78 | + inline ComboBox combobox(const std::vector<std::string>& options, int initial_selected = 0) { |
| 79 | + return std::make_shared<TUIComboBox>(options, initial_selected); |
| 80 | + } |
| 81 | + |
| 82 | + inline Form form() { |
| 83 | + return std::make_shared<TUIForm>(); |
| 84 | + } |
| 85 | + |
| 86 | + inline GroupBox groupbox(const std::string& title, Widget content, bool show_border = true) { |
| 87 | + return std::make_shared<TUIGroupBox>(title, content, show_border); |
| 88 | + } |
| 89 | + |
| 90 | + inline Label label(const std::string& text = "") { |
| 91 | + return std::make_shared<TUILabel>(text); |
| 92 | + } |
| 93 | + |
| 94 | + inline Menu menu(const std::vector<std::string>& options) { |
| 95 | + return std::make_shared<TUIMenu>(options); |
| 96 | + } |
| 97 | + |
| 98 | + inline ProgressBar progressbar(float initial_value = 0.0f, const std::string& label = "") { |
| 99 | + return std::make_shared<TUIProgressBar>(initial_value, label); |
| 100 | + } |
| 101 | + |
| 102 | + inline RadioBox radiobox(const std::vector<std::string>& options, int initial_selected = 0) { |
| 103 | + return std::make_shared<TUIRadioBox>(options, initial_selected); |
| 104 | + } |
| 105 | + |
| 106 | + inline ResizableSplit resizable_split(Widget first, Widget second, TUIResizableSplit::Orientation orientation = TUIResizableSplit::Horizontal) { |
| 107 | + return std::make_shared<TUIResizableSplit>(first, second, orientation); |
| 108 | + } |
| 109 | + |
| 110 | + inline ScrollableContainer scrollable_container(Widget content, int height) { |
| 111 | + return std::make_shared<TUIScrollableContainer>(content, height); |
| 112 | + } |
| 113 | + |
| 114 | + inline Slider slider(const std::string& label, float initial_value, float min_value, float max_value, float increment) { |
| 115 | + return std::make_shared<TUISlider>(label, initial_value, min_value, max_value, increment); |
| 116 | + } |
| 117 | + |
| 118 | + inline StatusBar statusbar(const std::string& message = "") { |
| 119 | + return std::make_shared<TUIStatusBar>(message); |
| 120 | + } |
| 121 | + |
| 122 | + inline TabWidget tabwidget() { |
| 123 | + return std::make_shared<TUITabWidget>(); |
| 124 | + } |
| 125 | + |
| 126 | + inline TextArea textarea(const std::string& placeholder = "", const std::string& label = "", int height = 5) { |
| 127 | + return std::make_shared<TUITextArea>(placeholder, label, height); |
| 128 | + } |
| 129 | + |
| 130 | + inline TextField textfield(const std::string& placeholder = "") { |
| 131 | + return std::make_shared<TUITextField>(placeholder); |
| 132 | + } |
| 133 | + |
| 134 | + inline Toolbar toolbar() { |
| 135 | + return std::make_shared<TUIToolbar>(); |
| 136 | + } |
| 137 | + |
| 138 | + inline TreeView treeview(TreeNode root_node) { |
| 139 | + return std::make_shared<TUITreeView>(root_node); |
| 140 | + } |
| 141 | + |
| 142 | + // Layout Factories |
| 143 | + inline HBoxLayout hbox() { |
| 144 | + return std::make_shared<TUIHBoxLayout>(); |
| 145 | + } |
| 146 | + |
| 147 | + inline VBoxLayout vbox() { |
| 148 | + return std::make_shared<TUIVBoxLayout>(); |
| 149 | + } |
| 150 | +} |
0 commit comments