63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
#include <psemek/tasks/ui.hpp>
|
|
|
|
#include <psemek/ui/window.hpp>
|
|
#include <psemek/ui/grid_layout.hpp>
|
|
#include <psemek/ui/frame.hpp>
|
|
#include <psemek/ui/scroller.hpp>
|
|
#include <psemek/ui/rich_button.hpp>
|
|
|
|
#include <psemek/util/recursive.hpp>
|
|
|
|
namespace psemek::tasks
|
|
{
|
|
|
|
std::shared_ptr<ui::element> make_ui(ui::element_factory & factory, std::filesystem::path const & storage)
|
|
{
|
|
(void)storage;
|
|
auto window = factory.make_window("Task manager");
|
|
|
|
auto grid = factory.make_grid_layout();
|
|
window->set_child(grid);
|
|
|
|
grid->set_size(1, 3);
|
|
|
|
auto frame_own_style = std::make_shared<ui::style>();
|
|
frame_own_style->bevel_width = 4;
|
|
frame_own_style->bevel_type = ui::bevel_type::down;
|
|
frame_own_style->shadow_offset = {0, 0};
|
|
|
|
auto frame_style = std::make_shared<ui::style>();
|
|
frame_style->text_scale = 1;
|
|
frame_style->bevel_width = 3;
|
|
|
|
for (int i = 0; i < grid->column_count(); ++i)
|
|
{
|
|
auto frame = factory.make_frame();
|
|
auto scroller = factory.make_scroller();
|
|
auto layout = factory.make_grid_layout();
|
|
frame->set_child(scroller);
|
|
scroller->set_child(layout);
|
|
grid->set(0, i, frame);
|
|
frame->set_own_style(frame_own_style);
|
|
frame->set_style(frame_style);
|
|
|
|
if (i == 1)
|
|
{
|
|
scroller->set_vertical_scroll(false);
|
|
scroller->set_horizontal_scroll(true);
|
|
}
|
|
|
|
auto add_button = util::recursive([&factory, layout](auto && self) -> void {
|
|
auto button = factory.make_button("Test");
|
|
button->on_click(self);
|
|
layout->add_row(button);
|
|
});
|
|
|
|
for (int j = 0; j < 5; ++j)
|
|
add_button();
|
|
}
|
|
|
|
return window;
|
|
}
|
|
|
|
}
|