Fixed app callback events

This commit is contained in:
Willem Cazander 2022-10-10 00:12:52 +02:00
parent 9fda57b191
commit 76f3da5da7
4 changed files with 14 additions and 0 deletions

View file

@ -42,6 +42,11 @@ public class TosAmpDeskApp extends AbstractDeskApp implements DeskAppRenderer {
return bundle.getString(TosAmpDeskApp.class.getSimpleName()+"."+key); return bundle.getString(TosAmpDeskApp.class.getSimpleName()+"."+key);
} }
@Override
public void exit() {
music.stop();
}
public void create() { public void create() {
getContours().setTitle(getTxt("title")); getContours().setTitle(getTxt("title"));
getContours().registrateContour(DeskAppContourSection.MAIN, this); getContours().registrateContour(DeskAppContourSection.MAIN, this);

View file

@ -23,4 +23,8 @@ abstract public class AbstractDeskApp implements DeskApp {
@Override @Override
public void hide() { public void hide() {
} }
@Override
public void exit() {
}
} }

View file

@ -12,4 +12,6 @@ public interface DeskApp {
void show(); void show();
void hide(); void hide();
void exit();
} }

View file

@ -65,6 +65,7 @@ public class DeskTopScreenMenu {
if (ImGui.menuItem(FontAwesomeIcons.WindowClose + " Exit", "", fileCloseSelected, deskApp != null)) { if (ImGui.menuItem(FontAwesomeIcons.WindowClose + " Exit", "", fileCloseSelected, deskApp != null)) {
fileCloseSelected.set(false); fileCloseSelected.set(false);
if (deskApp != null) { if (deskApp != null) {
deskApp.exit();
appScreen.getDeskAppController().removeDeskApp(deskApp); appScreen.getDeskAppController().removeDeskApp(deskApp);
appScreen.getDeskAppController().setCurrentDeskApp(null); appScreen.getDeskAppController().setCurrentDeskApp(null);
} }
@ -155,6 +156,7 @@ public class DeskTopScreenMenu {
private void renderTOS4Menu(DeskTopScreen appScreen) { private void renderTOS4Menu(DeskTopScreen appScreen) {
if (ImGui.beginMenu("" + " TOS⁴")) { if (ImGui.beginMenu("" + " TOS⁴")) {
if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality", "", tosSelfSelected, appScreen.getDeskAppController().getCurrentDeskApp() != null)) { if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality", "", tosSelfSelected, appScreen.getDeskAppController().getCurrentDeskApp() != null)) {
appScreen.getDeskAppController().getCurrentDeskApp().hide();
appScreen.getDeskAppController().setCurrentDeskApp(null); appScreen.getDeskAppController().setCurrentDeskApp(null);
tosSelfSelected.set(false); tosSelfSelected.set(false);
} }
@ -164,6 +166,7 @@ public class DeskTopScreenMenu {
enabled = false; enabled = false;
} }
if (ImGui.menuItem(app.getContours().getTitle(), "", tosSelfSelected, enabled)) { if (ImGui.menuItem(app.getContours().getTitle(), "", tosSelfSelected, enabled)) {
app.show();
appScreen.getDeskAppController().setCurrentDeskApp(app); appScreen.getDeskAppController().setCurrentDeskApp(app);
tosSelfSelected.set(false); tosSelfSelected.set(false);
} }