mirror of
https://github.com/obsqrbtz/clrsync.git
synced 2026-04-08 20:19:04 +03:00
fix: added delete confirmation dialog in color_scheme_editor
This commit is contained in:
@@ -138,10 +138,36 @@ void color_scheme_editor::render_controls()
|
|||||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.1f, 0.1f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.1f, 0.1f, 1.0f));
|
||||||
if (ImGui::Button("Delete"))
|
if (ImGui::Button("Delete"))
|
||||||
{
|
{
|
||||||
m_controller.delete_current_palette();
|
m_show_delete_confirmation = true;
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor(3);
|
ImGui::PopStyleColor(3);
|
||||||
|
|
||||||
|
if (m_show_delete_confirmation)
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup("Delete Palette?");
|
||||||
|
m_show_delete_confirmation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupModal("Delete Palette?", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
ImGui::Text("Are you sure you want to delete '%s'?", current.name().c_str());
|
||||||
|
ImGui::Text("This action cannot be undone.");
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if (ImGui::Button("Delete", ImVec2(120, 0)))
|
||||||
|
{
|
||||||
|
m_controller.delete_current_palette();
|
||||||
|
apply_themes();
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Cancel", ImVec2(120, 0)))
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Apply"))
|
if (ImGui::Button("Apply"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ private:
|
|||||||
color_table_renderer m_color_table;
|
color_table_renderer m_color_table;
|
||||||
preview_renderer m_preview;
|
preview_renderer m_preview;
|
||||||
template_editor* m_template_editor{nullptr};
|
template_editor* m_template_editor{nullptr};
|
||||||
|
bool m_show_delete_confirmation{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLRSYNC_GUI_COLOR_SCHEME_EDITOR_HPP
|
#endif // CLRSYNC_GUI_COLOR_SCHEME_EDITOR_HPP
|
||||||
Reference in New Issue
Block a user