Using unsafe area toolbars in file selector
This commit is contained in:
parent
667fefa3b4
commit
33e4b57d79
5 changed files with 159 additions and 133 deletions
|
|
@ -72,13 +72,12 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
float paddingElementWidth = (gui.io.windowSize.x() - gui.io.safeWindowRect.width()) / 2.0f;
|
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(paddingElementWidth), .height = CLAY_SIZING_FIT(0)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(gui.io.safeWindowRect.min.x()), .height = CLAY_SIZING_FIT(0)}}
|
||||||
}) {}
|
}) {}
|
||||||
innerContent();
|
innerContent();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(paddingElementWidth), .height = CLAY_SIZING_FIT(0)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(gui.io.windowSize.x() - gui.io.safeWindowRect.max.x()), .height = CLAY_SIZING_FIT(0)}}
|
||||||
}) {}
|
}) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,13 +98,12 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
float paddingElementWidth = (gui.io.windowSize.x() - gui.io.safeWindowRect.width()) / 2.0f;
|
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(paddingElementWidth), .height = CLAY_SIZING_FIT(0)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(gui.io.safeWindowRect.min.x()), .height = CLAY_SIZING_FIT(0)}}
|
||||||
}) {}
|
}) {}
|
||||||
innerContent();
|
innerContent();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(paddingElementWidth), .height = CLAY_SIZING_FIT(0)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIXED(gui.io.windowSize.x() - gui.io.safeWindowRect.max.x()), .height = CLAY_SIZING_FIT(0)}}
|
||||||
}) {}
|
}) {}
|
||||||
}
|
}
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
|
|
@ -132,13 +130,12 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
float paddingElementHeight = (gui.io.windowSize.y() - gui.io.safeWindowRect.height()) / 2.0f;
|
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(paddingElementHeight)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(gui.io.safeWindowRect.min.y())}}
|
||||||
}) {}
|
}) {}
|
||||||
innerContent();
|
innerContent();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(paddingElementHeight)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(gui.io.windowSize.y() - gui.io.safeWindowRect.max.y())}}
|
||||||
}) {}
|
}) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,13 +156,12 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
float paddingElementHeight = (gui.io.windowSize.y() - gui.io.safeWindowRect.height()) / 2.0f;
|
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(paddingElementHeight)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(gui.io.safeWindowRect.min.y())}}
|
||||||
}) {}
|
}) {}
|
||||||
innerContent();
|
innerContent();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(paddingElementHeight)}}
|
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIXED(gui.io.windowSize.y() - gui.io.safeWindowRect.max.y())}}
|
||||||
}) {}
|
}) {}
|
||||||
}
|
}
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
|
|
@ -178,4 +174,10 @@ void window_fill_side_bar(GUIManager& gui, const char* id, const WindowFillSideB
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void window_safe_area_layout(GUIManager& gui, const char* id, const std::function<void()>& innerContent) {
|
||||||
|
gui.element<LayoutElement>(id, [&] (LayoutElement* l, const Clay_ElementId& lId) {
|
||||||
|
innerContent();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,6 @@ struct WindowFillSideBarConfig {
|
||||||
};
|
};
|
||||||
|
|
||||||
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 char* id, const WindowFillSideBarConfig& config, const std::function<void()>& innerContent);
|
||||||
|
void window_safe_area_layout(GUIManager& gui, const char* id, const std::function<void()>& innerContent);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ void PositionAdjustingPopupMenu::layout(const Clay_ElementId& id, Vector2f popup
|
||||||
auto& bb = layoutElement->get_bb().value();
|
auto& bb = layoutElement->get_bb().value();
|
||||||
if((popupPos.y() + bb.height()) > gui.io.windowSize.y())
|
if((popupPos.y() + bb.height()) > gui.io.windowSize.y())
|
||||||
popupPos.y() -= bb.height();
|
popupPos.y() -= bb.height();
|
||||||
if((popupPos.x() + bb.width()) > gui.io.windowSize.y())
|
if((popupPos.x() + bb.width()) > gui.io.windowSize.x())
|
||||||
popupPos.x() -= bb.width();
|
popupPos.x() -= bb.width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../GUIStuff/Elements/LayoutElement.hpp"
|
#include "../GUIStuff/Elements/LayoutElement.hpp"
|
||||||
#include "../GUIStuff/Elements/SVGIcon.hpp"
|
#include "../GUIStuff/Elements/SVGIcon.hpp"
|
||||||
#include "../GUIStuff/Elements/TextParagraph.hpp"
|
#include "../GUIStuff/Elements/TextParagraph.hpp"
|
||||||
|
#include "../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
|
||||||
#include "../GUIStuff/Elements/PositionAdjustingPopupMenu.hpp"
|
#include "../GUIStuff/Elements/PositionAdjustingPopupMenu.hpp"
|
||||||
#include "../World.hpp"
|
#include "../World.hpp"
|
||||||
#include "Helpers/StringHelpers.hpp"
|
#include "Helpers/StringHelpers.hpp"
|
||||||
|
|
@ -128,7 +129,7 @@ void FileSelectScreen::main_display() {
|
||||||
main_menu();
|
main_menu();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIXED(gui.io.safeWindowRect.width()), .height = CLAY_SIZING_GROW(0)},
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
|
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
},
|
},
|
||||||
|
|
@ -154,18 +155,30 @@ void FileSelectScreen::main_display() {
|
||||||
actionBarOpenAnim->animation_trigger_reverse();
|
actionBarOpenAnim->animation_trigger_reverse();
|
||||||
title_bar();
|
title_bar();
|
||||||
}
|
}
|
||||||
switch(selectedMenu) {
|
window_safe_area_layout(gui, "center area element", [&] {
|
||||||
case SelectedMenu::FILES:
|
CLAY_AUTO_ID({
|
||||||
file_view();
|
.layout = {
|
||||||
if(!editMode)
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||||
create_file_button();
|
.padding = CLAY_PADDING_ALL(gui.io.theme->padding1),
|
||||||
break;
|
.childGap = gui.io.theme->childGap1,
|
||||||
case SelectedMenu::TRASH:
|
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
|
||||||
file_view();
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
break;
|
},
|
||||||
case SelectedMenu::SETTINGS:
|
}) {
|
||||||
break;
|
switch(selectedMenu) {
|
||||||
}
|
case SelectedMenu::FILES:
|
||||||
|
file_view();
|
||||||
|
if(!editMode)
|
||||||
|
create_file_button();
|
||||||
|
break;
|
||||||
|
case SelectedMenu::TRASH:
|
||||||
|
file_view();
|
||||||
|
break;
|
||||||
|
case SelectedMenu::SETTINGS:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
menu_black_box();
|
menu_black_box();
|
||||||
}
|
}
|
||||||
edit_action_bar();
|
edit_action_bar();
|
||||||
|
|
@ -186,7 +199,7 @@ void FileSelectScreen::create_file_button() {
|
||||||
.element = CLAY_ATTACH_POINT_RIGHT_BOTTOM,
|
.element = CLAY_ATTACH_POINT_RIGHT_BOTTOM,
|
||||||
.parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM
|
.parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM
|
||||||
},
|
},
|
||||||
.attachTo = CLAY_ATTACH_TO_PARENT
|
.attachTo = CLAY_ATTACH_TO_ROOT
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
svg_icon_button(gui, "add button", "data/icons/plus.svg", {
|
svg_icon_button(gui, "add button", "data/icons/plus.svg", {
|
||||||
|
|
@ -376,94 +389,99 @@ void FileSelectScreen::edit_title_bar() {
|
||||||
|
|
||||||
void FileSelectScreen::title_bar() {
|
void FileSelectScreen::title_bar() {
|
||||||
auto& gui = main.g.gui;
|
auto& gui = main.g.gui;
|
||||||
CLAY_AUTO_ID({
|
window_fill_side_bar(gui, "top toolbar", {
|
||||||
.layout = {
|
.dir = WindowFillSideBarConfig::Direction::TOP,
|
||||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0)},
|
.backgroundColor = gui.io.theme->backColor0
|
||||||
.childGap = gui.io.theme->childGap1,
|
}, [&] {
|
||||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER },
|
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
svg_icon_button(gui, "main settings button", "data/icons/menu.svg", {
|
|
||||||
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
|
||||||
.onClick = [&] {
|
|
||||||
mainMenuOpenAnim->animation_trigger();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
switch(selectedMenu) {
|
|
||||||
case SelectedMenu::FILES:
|
|
||||||
mutable_text_label(gui, "main screen header text", "Files");
|
|
||||||
break;
|
|
||||||
case SelectedMenu::TRASH:
|
|
||||||
mutable_text_label(gui, "main screen header text", "Trash");
|
|
||||||
break;
|
|
||||||
case SelectedMenu::SETTINGS:
|
|
||||||
mutable_text_label(gui, "main screen header text", "Settings");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
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)},
|
||||||
|
.childGap = gui.io.theme->childGap1,
|
||||||
|
.childAlignment = {.x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
|
||||||
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
}
|
}
|
||||||
}) {}
|
}) {
|
||||||
if(selectedMenu == SelectedMenu::FILES || selectedMenu == SelectedMenu::TRASH) {
|
svg_icon_button(gui, "main settings button", "data/icons/menu.svg", {
|
||||||
SelectableButton* moreButton = svg_icon_button(gui, "more settings button", "data/icons/RemixIcon/more-2-fill.svg", {
|
|
||||||
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||||
.onClick = [&] {
|
.onClick = [&] {
|
||||||
moreOptionsMenu = MoreOptionsMenu::MAIN;
|
mainMenuOpenAnim->animation_trigger();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(moreButton->get_bb().has_value() && moreOptionsMenu != MoreOptionsMenu::CLOSED) {
|
switch(selectedMenu) {
|
||||||
gui.set_z_index(gui.get_z_index() + 10, [&] {
|
case SelectedMenu::FILES:
|
||||||
gui.element<PositionAdjustingPopupMenu>("more options popup", moreButton->get_bb().value().top_right(), [&] {
|
mutable_text_label(gui, "main screen header text", "Files");
|
||||||
CLAY_AUTO_ID({
|
break;
|
||||||
.layout = {
|
case SelectedMenu::TRASH:
|
||||||
.sizing = {.width = CLAY_SIZING_FIT(200), .height = CLAY_SIZING_FIT(0)},
|
mutable_text_label(gui, "main screen header text", "Trash");
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
break;
|
||||||
},
|
case SelectedMenu::SETTINGS:
|
||||||
.backgroundColor = convert_vec4<Clay_Color>(gui.io.theme->backColor1),
|
mutable_text_label(gui, "main screen header text", "Settings");
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
break;
|
||||||
}) {
|
}
|
||||||
if(moreOptionsMenu == MoreOptionsMenu::MAIN) {
|
CLAY_AUTO_ID({
|
||||||
text_transparent_option_button("Edit", "Edit", [&] {
|
.layout = {
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||||
start_edit_mode();
|
}
|
||||||
});
|
}) {}
|
||||||
text_transparent_option_button("View", "View", [&] {
|
if(selectedMenu == SelectedMenu::FILES || selectedMenu == SelectedMenu::TRASH) {
|
||||||
moreOptionsMenu = MoreOptionsMenu::VIEW;
|
SelectableButton* moreButton = svg_icon_button(gui, "more settings button", "data/icons/RemixIcon/more-2-fill.svg", {
|
||||||
});
|
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||||
}
|
.onClick = [&] {
|
||||||
else if(moreOptionsMenu == MoreOptionsMenu::VIEW) {
|
moreOptionsMenu = MoreOptionsMenu::MAIN;
|
||||||
text_transparent_option_button("Large Grid", "Large Grid", [&] {
|
}
|
||||||
fileViewType = FileViewType::LARGE_GRID;
|
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
|
||||||
});
|
|
||||||
text_transparent_option_button("Medium Grid", "Medium Grid", [&] {
|
|
||||||
fileViewType = FileViewType::MEDIUM_GRID;
|
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
|
||||||
});
|
|
||||||
text_transparent_option_button("Small Grid", "Small Grid", [&] {
|
|
||||||
fileViewType = FileViewType::SMALL_GRID;
|
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
|
||||||
});
|
|
||||||
text_transparent_option_button("List", "List", [&] {
|
|
||||||
fileViewType = FileViewType::LIST;
|
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, LayoutElement::Callbacks{
|
|
||||||
.mouseButton = [&](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& m) {
|
|
||||||
if(!l->mouseHovering && m.down) {
|
|
||||||
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
|
||||||
main.g.gui.set_to_layout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
if(moreButton->get_bb().has_value() && moreOptionsMenu != MoreOptionsMenu::CLOSED) {
|
||||||
|
gui.set_z_index(gui.get_z_index() + 10, [&] {
|
||||||
|
gui.element<PositionAdjustingPopupMenu>("more options popup", moreButton->get_bb().value().top_right(), [&] {
|
||||||
|
CLAY_AUTO_ID({
|
||||||
|
.layout = {
|
||||||
|
.sizing = {.width = CLAY_SIZING_FIT(200), .height = CLAY_SIZING_FIT(0)},
|
||||||
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
|
},
|
||||||
|
.backgroundColor = convert_vec4<Clay_Color>(gui.io.theme->backColor1),
|
||||||
|
.cornerRadius = CLAY_CORNER_RADIUS(4)
|
||||||
|
}) {
|
||||||
|
if(moreOptionsMenu == MoreOptionsMenu::MAIN) {
|
||||||
|
text_transparent_option_button("Edit", "Edit", [&] {
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
start_edit_mode();
|
||||||
|
});
|
||||||
|
text_transparent_option_button("View", "View", [&] {
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::VIEW;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if(moreOptionsMenu == MoreOptionsMenu::VIEW) {
|
||||||
|
text_transparent_option_button("Large Grid", "Large Grid", [&] {
|
||||||
|
fileViewType = FileViewType::LARGE_GRID;
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
});
|
||||||
|
text_transparent_option_button("Medium Grid", "Medium Grid", [&] {
|
||||||
|
fileViewType = FileViewType::MEDIUM_GRID;
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
});
|
||||||
|
text_transparent_option_button("Small Grid", "Small Grid", [&] {
|
||||||
|
fileViewType = FileViewType::SMALL_GRID;
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
});
|
||||||
|
text_transparent_option_button("List", "List", [&] {
|
||||||
|
fileViewType = FileViewType::LIST;
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, LayoutElement::Callbacks{
|
||||||
|
.mouseButton = [&](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& m) {
|
||||||
|
if(!l->mouseHovering && m.down) {
|
||||||
|
moreOptionsMenu = MoreOptionsMenu::CLOSED;
|
||||||
|
main.g.gui.set_to_layout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|
@ -490,32 +508,37 @@ 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;
|
||||||
gui.element<LayoutElement>("main menu popup", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
window_fill_side_bar(gui, "main menu popup", {
|
||||||
CLAY(lId, {
|
.dir = WindowFillSideBarConfig::Direction::LEFT,
|
||||||
.layout = {
|
.backgroundColor = gui.io.theme->backColor0
|
||||||
.sizing = {.width = CLAY_SIZING_FIXED(300.0f * mainMenuOpenAnim->get_val()), .height = CLAY_SIZING_GROW(0)},
|
}, [&] {
|
||||||
.padding = CLAY_PADDING_ALL(gui.io.theme->padding1),
|
gui.element<LayoutElement>("inner main menu element", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
||||||
.childGap = 0,
|
CLAY(lId, {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layout = {
|
||||||
},
|
.sizing = {.width = CLAY_SIZING_FIXED(300.0f * mainMenuOpenAnim->get_val()), .height = CLAY_SIZING_GROW(0)},
|
||||||
}) {
|
.padding = CLAY_PADDING_ALL(gui.io.theme->padding1),
|
||||||
if(mainMenuOpenAnim->is_at_end()) {
|
.childGap = 0,
|
||||||
icon_text_transparent_option_selected_button("Files", "data/icons/folder.svg", "Files", selectedMenu == SelectedMenu::FILES, [&] {
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
selectedMenu = SelectedMenu::FILES;
|
},
|
||||||
update_file_list(fileList, savePath, false);
|
}) {
|
||||||
mainMenuOpenAnim->animation_trigger_reverse();
|
if(mainMenuOpenAnim->is_at_end()) {
|
||||||
});
|
icon_text_transparent_option_selected_button("Files", "data/icons/folder.svg", "Files", selectedMenu == SelectedMenu::FILES, [&] {
|
||||||
icon_text_transparent_option_selected_button("Trash", "data/icons/trash.svg", "Trash", selectedMenu == SelectedMenu::TRASH, [&] {
|
selectedMenu = SelectedMenu::FILES;
|
||||||
selectedMenu = SelectedMenu::TRASH;
|
update_file_list(fileList, savePath, false);
|
||||||
update_file_list(fileList, trashPath, true);
|
mainMenuOpenAnim->animation_trigger_reverse();
|
||||||
mainMenuOpenAnim->animation_trigger_reverse();
|
});
|
||||||
});
|
icon_text_transparent_option_selected_button("Trash", "data/icons/trash.svg", "Trash", selectedMenu == SelectedMenu::TRASH, [&] {
|
||||||
icon_text_transparent_option_selected_button("Settings", "data/icons/RemixIcon/settings-3-line.svg", "Settings", selectedMenu == SelectedMenu::SETTINGS, [&] {
|
selectedMenu = SelectedMenu::TRASH;
|
||||||
selectedMenu = SelectedMenu::SETTINGS;
|
update_file_list(fileList, trashPath, true);
|
||||||
mainMenuOpenAnim->animation_trigger_reverse();
|
mainMenuOpenAnim->animation_trigger_reverse();
|
||||||
});
|
});
|
||||||
|
icon_text_transparent_option_selected_button("Settings", "data/icons/RemixIcon/settings-3-line.svg", "Settings", selectedMenu == SelectedMenu::SETTINGS, [&] {
|
||||||
|
selectedMenu = SelectedMenu::SETTINGS;
|
||||||
|
mainMenuOpenAnim->animation_trigger_reverse();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -526,12 +526,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
|
||||||
mS.m->window.canCreateSurfaces = true;
|
mS.m->window.canCreateSurfaces = true;
|
||||||
resize_window(mS);
|
resize_window(mS);
|
||||||
|
|
||||||
mS.m->screen = std::make_unique<PhoneDrawingProgramScreen>(*mS.m);
|
mS.m->screen = std::make_unique<FileSelectScreen>(*mS.m);
|
||||||
|
|
||||||
if(listOfFilesToOpenFromCommand.empty()) {
|
if(listOfFilesToOpenFromCommand.empty()) {
|
||||||
mS.m->create_new_tab({
|
//mS.m->create_new_tab({
|
||||||
.isClient = false
|
// .isClient = false
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(std::filesystem::path& f : listOfFilesToOpenFromCommand) {
|
for(std::filesystem::path& f : listOfFilesToOpenFromCommand) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue