[studio] Adjust size of NewMenu, sort items, rename Quit to Cancel

This commit is contained in:
Gary Talent 2023-12-04 21:45:59 -06:00
parent 195fd7a113
commit 54fcbb1a33

View File

@ -13,7 +13,7 @@ namespace studio {
NewMenu::NewMenu() noexcept {
setTitle(ox::String("New Item"));
setSize({225, 110});
setSize({230, 140});
}
void NewMenu::open() noexcept {
@ -51,6 +51,11 @@ void NewMenu::draw(turbine::Context *ctx) noexcept {
void NewMenu::addItemMaker(ox::UniquePtr<studio::ItemMaker> im) noexcept {
m_types.emplace_back(std::move(im));
std::sort(
m_types.begin(), m_types.end(),
[](ox::UPtr<ItemMaker> const&im1, ox::UPtr<ItemMaker> const&im2) {
return im1->name < im2->name;
});
}
void NewMenu::drawNewItemType(turbine::Context *ctx) noexcept {
@ -76,13 +81,14 @@ void NewMenu::drawNewItemName(turbine::Context *ctx) noexcept {
}
void NewMenu::drawFirstPageButtons() noexcept {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 80);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 130);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20);
if (ImGui::Button("Next")) {
auto const btnSz = ImVec2(60, 20);
if (ImGui::Button("Next", btnSz)) {
m_stage = Stage::NewItemName;
}
ImGui::SameLine();
if (ImGui::Button("Quit")) {
if (ImGui::Button("Cancel", btnSz)) {
ImGui::CloseCurrentPopup();
m_stage = Stage::Closed;
}