package io.gitlab.jfronny.inceptum.windows; import imgui.ImGui; public class AlertWindow extends Window { private final String message; private final Runnable onOk; private final Runnable onCancel; public AlertWindow(String message) { this(message, null, null); } public AlertWindow(String message, Runnable onOk, Runnable onCancel) { super("Warning"); this.message = message; this.onOk = onOk; this.onCancel = onCancel; } @Override public void draw() { ImGui.text(message); if (ImGui.button("OK")) { close(); if (onOk != null) onOk.run(); } if (onOk != null || onCancel != null) { ImGui.sameLine(); if (ImGui.button("Cancel")) { close(); if (onCancel != null) onCancel.run(); } } } }