Added X scrollbar to scroll area, and added toolbar for phone drawing program

This commit is contained in:
Yousef Khadadeh 2026-04-29 15:14:13 +03:00
parent 6a05026f85
commit 74bc17f570
11 changed files with 284 additions and 50 deletions

View file

@ -31,6 +31,10 @@ void PhoneDrawingProgramScreen::main_display() {
},
}) {
top_toolbar();
CLAY_AUTO_ID({
.layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}}
}) {}
bottom_toolbar();
}
}
@ -66,6 +70,42 @@ void PhoneDrawingProgramScreen::top_toolbar() {
});
}
void PhoneDrawingProgramScreen::bottom_toolbar() {
auto& gui = main.g.gui;
auto& io = gui.io;
auto& drawProg = main.world->drawProg;
window_fill_side_bar(gui, "bottom toolbar", {
.dir = WindowFillSideBarConfig::Direction::BOTTOM,
.backgroundColor = io.theme->backColor1
}, [&] {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER},
.layoutDirection = CLAY_LEFT_TO_RIGHT
}
}) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) }
}
}) {
gui.element<ScrollArea>("tools scroll", ScrollArea::Options{
.scrollHorizontal = true,
.clipHorizontal = true,
.scrollbarX = ScrollArea::ScrollbarType::NONE,
.layoutDirection = CLAY_LEFT_TO_RIGHT,
.xAlign = CLAY_ALIGN_X_LEFT,
.yAlign = CLAY_ALIGN_Y_CENTER,
.innerContent = [&](auto&) {
drawProg.phone_bottom_toolbar_gui(*this);
}
});
}
}
});
}
void PhoneDrawingProgramScreen::input_global_back_button_callback() {
main.world->save_to_file(main.world->filePath);
main.set_tab_to_close(main.world.get());

View file

@ -12,5 +12,6 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
private:
void save_files();
void top_toolbar();
void bottom_toolbar();
void main_display();
};