Separating safe window area from window area

This commit is contained in:
Yousef Khadadeh 2026-04-26 15:47:28 +03:00
parent 97d299a346
commit b1f6f04d37
18 changed files with 121 additions and 102 deletions

View file

@ -128,7 +128,7 @@ void FileSelectScreen::main_display() {
main_menu();
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_FIXED(gui.io.windowSize.x()), .height = CLAY_SIZING_GROW(0)},
.sizing = {.width = CLAY_SIZING_FIXED(gui.io.safeWindowRect.width()), .height = CLAY_SIZING_GROW(0)},
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
.layoutDirection = CLAY_TOP_TO_BOTTOM,
},

View file

@ -22,35 +22,39 @@ void PhoneDrawingProgramScreen::gui_layout_run() {
}
void PhoneDrawingProgramScreen::main_display() {
auto& gui = main.g.gui;
auto& io = gui.io;
CLAY_AUTO_ID({
.layout = {
.sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
.layoutDirection = CLAY_TOP_TO_BOTTOM
},
}) {
gui.element<LayoutElement>("top toolbar", [&](LayoutElement* l, const Clay_ElementId& lId) {
CLAY(lId, {
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
.layoutDirection = CLAY_LEFT_TO_RIGHT
},
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor0),
.border = {
.color = convert_vec4<Clay_Color>(io.theme->frontColor1),
.width = {.bottom = 1}
}
}) {
svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.onClick = [&] {
main.set_tab_to_close(main.world.get());
main.screen = std::make_unique<FileSelectScreen>(main);
}
});
}
});
top_toolbar();
}
}
void PhoneDrawingProgramScreen::top_toolbar() {
auto& gui = main.g.gui;
auto& io = gui.io;
gui.element<LayoutElement>("top toolbar", [&](LayoutElement* l, const Clay_ElementId& lId) {
CLAY(lId, {
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
.layoutDirection = CLAY_LEFT_TO_RIGHT
},
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor0),
.border = {
.color = convert_vec4<Clay_Color>(io.theme->frontColor1),
.width = {.bottom = 1}
}
}) {
svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
.onClick = [&] {
main.set_tab_to_close(main.world.get());
main.screen = std::make_unique<FileSelectScreen>(main);
}
});
}
});
}

View file

@ -8,5 +8,6 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
virtual void update() override;
virtual void gui_layout_run() override;
private:
void top_toolbar();
void main_display();
};