Layout element is not used in toolbar screen fill
This commit is contained in:
parent
74bc17f570
commit
f1d7cbf896
5 changed files with 371 additions and 350 deletions
|
|
@ -51,11 +51,10 @@ void left_to_right_line_centered_layout(GUIManager& gui, const std::function<voi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideBarConfig& config, const std::function<void()>& innerContent) {
|
void window_fill_side_bar(GUIManager& gui, const WindowFillSideBarConfig& config, const std::function<void()>& innerContent) {
|
||||||
gui.element<LayoutElement>(id, [&](LayoutElement* l, const Clay_ElementId& lId) {
|
|
||||||
switch(config.dir) {
|
switch(config.dir) {
|
||||||
case WindowFillSideBarConfig::Direction::TOP: {
|
case WindowFillSideBarConfig::Direction::TOP: {
|
||||||
CLAY(lId, {
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
|
|
@ -88,7 +87,7 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WindowFillSideBarConfig::Direction::BOTTOM: {
|
case WindowFillSideBarConfig::Direction::BOTTOM: {
|
||||||
CLAY(lId, {
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
|
|
@ -121,7 +120,7 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WindowFillSideBarConfig::Direction::LEFT: {
|
case WindowFillSideBarConfig::Direction::LEFT: {
|
||||||
CLAY(lId, {
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_GROW(0) },
|
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_GROW(0) },
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
|
|
@ -154,7 +153,7 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WindowFillSideBarConfig::Direction::RIGHT: {
|
case WindowFillSideBarConfig::Direction::RIGHT: {
|
||||||
CLAY(lId, {
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_GROW(0) },
|
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_GROW(0) },
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
|
|
@ -187,10 +186,9 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_gap_side_bar(GUIManager& gui, const char* id, const WindowFillSideBarConfig::Direction& dir) {
|
void window_gap_side_bar(GUIManager& gui, const WindowFillSideBarConfig::Direction& dir) {
|
||||||
switch(dir) {
|
switch(dir) {
|
||||||
case WindowFillSideBarConfig::Direction::TOP:
|
case WindowFillSideBarConfig::Direction::TOP:
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ struct WindowFillSideBarConfig {
|
||||||
Clay_BorderElementConfig border;
|
Clay_BorderElementConfig border;
|
||||||
};
|
};
|
||||||
|
|
||||||
void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideBarConfig& config, const std::function<void()>& innerContent);
|
void window_fill_side_bar(GUIManager& gui, const WindowFillSideBarConfig& config, const std::function<void()>& innerContent);
|
||||||
void window_gap_side_bar(GUIManager& gui, const char* id, const WindowFillSideBarConfig::Direction& dir);
|
void window_gap_side_bar(GUIManager& gui, const WindowFillSideBarConfig::Direction& dir);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ void FileSelectScreen::main_display() {
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
window_gap_side_bar(gui, "main display left fill", WindowFillSideBarConfig::Direction::LEFT);
|
window_gap_side_bar(gui, WindowFillSideBarConfig::Direction::LEFT);
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||||
|
|
@ -175,9 +175,9 @@ void FileSelectScreen::main_display() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window_gap_side_bar(gui, "main display right fill", WindowFillSideBarConfig::Direction::RIGHT);
|
window_gap_side_bar(gui, WindowFillSideBarConfig::Direction::RIGHT);
|
||||||
}
|
}
|
||||||
window_gap_side_bar(gui, "main display bottom fill", WindowFillSideBarConfig::Direction::BOTTOM);
|
window_gap_side_bar(gui, WindowFillSideBarConfig::Direction::BOTTOM);
|
||||||
edit_action_bar();
|
edit_action_bar();
|
||||||
menu_black_box();
|
menu_black_box();
|
||||||
}
|
}
|
||||||
|
|
@ -334,7 +334,9 @@ void FileSelectScreen::edit_action_bar() {
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}},
|
.layout = { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}},
|
||||||
}) {}
|
}) {}
|
||||||
window_fill_side_bar(gui, "edit action bar bottom fill", {
|
gui.element<LayoutElement>("edit action bar bottom fill", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {}) {
|
||||||
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::BOTTOM,
|
.dir = WindowFillSideBarConfig::Direction::BOTTOM,
|
||||||
.backgroundColor = gui.io.theme->backColor1
|
.backgroundColor = gui.io.theme->backColor1
|
||||||
}, [&] {
|
}, [&] {
|
||||||
|
|
@ -378,11 +380,15 @@ void FileSelectScreen::edit_action_bar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSelectScreen::edit_title_bar() {
|
void FileSelectScreen::edit_title_bar() {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
window_fill_side_bar(gui, "edit top toolbar", {
|
gui.element<LayoutElement>("edit top toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {}) {
|
||||||
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::TOP,
|
.dir = WindowFillSideBarConfig::Direction::TOP,
|
||||||
.backgroundColor = gui.io.theme->backColor0
|
.backgroundColor = gui.io.theme->backColor0
|
||||||
}, [&] {
|
}, [&] {
|
||||||
|
|
@ -405,10 +411,14 @@ void FileSelectScreen::edit_title_bar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void FileSelectScreen::title_bar() {
|
void FileSelectScreen::title_bar() {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
window_fill_side_bar(gui, "top toolbar", {
|
gui.element<LayoutElement>("top toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {}) {
|
||||||
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::TOP,
|
.dir = WindowFillSideBarConfig::Direction::TOP,
|
||||||
.backgroundColor = gui.io.theme->backColor0
|
.backgroundColor = gui.io.theme->backColor0
|
||||||
}, [&] {
|
}, [&] {
|
||||||
|
|
@ -505,6 +515,8 @@ void FileSelectScreen::title_bar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void FileSelectScreen::text_transparent_option_button(const char* id, const char* text, const std::function<void()>& onClick) {
|
void FileSelectScreen::text_transparent_option_button(const char* id, const char* text, const std::function<void()>& onClick) {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
|
|
@ -530,7 +542,9 @@ void FileSelectScreen::icon_text_transparent_option_selected_button(const char*
|
||||||
void FileSelectScreen::main_menu() {
|
void FileSelectScreen::main_menu() {
|
||||||
if(!mainMenuOpenAnim->is_at_start()) {
|
if(!mainMenuOpenAnim->is_at_start()) {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
window_fill_side_bar(gui, "main menu popup", {
|
gui.element<LayoutElement>("main menu popup layout element", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {}) {
|
||||||
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::LEFT,
|
.dir = WindowFillSideBarConfig::Direction::LEFT,
|
||||||
.backgroundColor = gui.io.theme->backColor0
|
.backgroundColor = gui.io.theme->backColor0
|
||||||
}, [&] {
|
}, [&] {
|
||||||
|
|
@ -565,6 +579,8 @@ void FileSelectScreen::main_menu() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSelectScreen::file_view() {
|
void FileSelectScreen::file_view() {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ void PhoneDrawingProgramScreen::top_toolbar() {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
auto& io = gui.io;
|
auto& io = gui.io;
|
||||||
|
|
||||||
window_fill_side_bar(gui, "top toolbar", {
|
gui.element<LayoutElement>("top toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {}) {
|
||||||
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::TOP,
|
.dir = WindowFillSideBarConfig::Direction::TOP,
|
||||||
.backgroundColor = io.theme->backColor0,
|
.backgroundColor = io.theme->backColor0,
|
||||||
.border = {
|
.border = {
|
||||||
|
|
@ -69,14 +71,15 @@ void PhoneDrawingProgramScreen::top_toolbar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void PhoneDrawingProgramScreen::bottom_toolbar() {
|
void PhoneDrawingProgramScreen::bottom_toolbar() {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
auto& io = gui.io;
|
auto& io = gui.io;
|
||||||
auto& drawProg = main.world->drawProg;
|
auto& drawProg = main.world->drawProg;
|
||||||
window_fill_side_bar(gui, "bottom toolbar", {
|
window_fill_side_bar(gui, {
|
||||||
.dir = WindowFillSideBarConfig::Direction::BOTTOM,
|
.dir = WindowFillSideBarConfig::Direction::BOTTOM,
|
||||||
.backgroundColor = io.theme->backColor1
|
|
||||||
}, [&] {
|
}, [&] {
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
|
|
@ -85,12 +88,15 @@ void PhoneDrawingProgramScreen::bottom_toolbar() {
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
CLAY_AUTO_ID({
|
gui.element<LayoutElement>("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) }
|
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
}
|
},
|
||||||
|
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||||
|
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
||||||
}) {
|
}) {
|
||||||
gui.element<ScrollArea>("tools scroll", ScrollArea::Options{
|
gui.clipping_element<ScrollArea>("tools scroll", ScrollArea::Options{
|
||||||
.scrollHorizontal = true,
|
.scrollHorizontal = true,
|
||||||
.clipHorizontal = true,
|
.clipHorizontal = true,
|
||||||
.scrollbarX = ScrollArea::ScrollbarType::NONE,
|
.scrollbarX = ScrollArea::ScrollbarType::NONE,
|
||||||
|
|
@ -102,6 +108,7 @@ void PhoneDrawingProgramScreen::bottom_toolbar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1233,7 +1233,7 @@ void Toolbar::color_palette(const char* id, Vector4f* color, const std::function
|
||||||
gui.new_id(id, [&] {
|
gui.new_id(id, [&] {
|
||||||
auto& palette = main.conf.palettes[paletteData.selectedPalette].colors;
|
auto& palette = main.conf.palettes[paletteData.selectedPalette].colors;
|
||||||
|
|
||||||
gui.element<ScrollArea>("color palette scroll area", ScrollArea::Options{
|
gui.clipping_element<ScrollArea>("color palette scroll area", ScrollArea::Options{
|
||||||
.scrollVertical = true,
|
.scrollVertical = true,
|
||||||
.clipVertical = true,
|
.clipVertical = true,
|
||||||
.scrollbarY = ScrollArea::ScrollbarType::NORMAL,
|
.scrollbarY = ScrollArea::ScrollbarType::NORMAL,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue