revert to using popups

This commit is contained in:
buzz-lightsnack-2007 2024-04-28 16:55:27 +08:00
parent 89848bad7a
commit 3b332b6045

View file

@ -3,7 +3,7 @@
import Tabs from "/scripts/GUI/tabs.js"; import Tabs from "/scripts/GUI/tabs.js";
import Window from "/scripts/GUI/window.js"; import Window from "/scripts/GUI/window.js";
import MenuEntry from "./menu.js"; import MenuEntry from "./menu.js";
import ManagedPopup from "./popup.js"; import ManagedWindow from "./ManagedWindow.js";
import IconIndicator from "./icons.js"; import IconIndicator from "./icons.js";
import check from "/scripts/external/check.js"; import check from "/scripts/external/check.js";
import {read} from "/scripts/secretariat.js"; import {read} from "/scripts/secretariat.js";
@ -12,18 +12,22 @@ export default class EntryManager {
constructor () { constructor () {
// Initialize the entries. // Initialize the entries.
this.instances = {}; this.instances = {};
this.instances.popup = new ManagedPopup(); this.instances.popup = new ManagedWindow();
this.instances.menu = new MenuEntry(); this.instances.menu = new MenuEntry();
// Add the action listeners. // Add the action listeners.
this.#listen(); this.#listen();
} }
/* Add the action listeners when running this. */ /* Add the action listeners. */
#listen() { #listen() {
Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()}); Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()});
Tabs.addActionListener(`onUpdated`, (data) => {this.onRefresh()}); Tabs.addActionListener(`onUpdated`, (data) => {this.onRefresh()});
Window.addActionListener(`onFocusChanged`, (data) => {this.onRefresh()}); Window.addActionListener(`onFocusChanged`, (data) => {this.onRefresh()});
// Add the context menu event.
IconIndicator.set(this.instances.popup.show());
this.instances.menu.menu.onclick(() => {this.instances.popup.show()});
} }
onRefresh() { onRefresh() {
@ -42,7 +46,6 @@ export default class EntryManager {
enable () { enable () {
this.instances.menu.enable(); this.instances.menu.enable();
IconIndicator.enable(); IconIndicator.enable();
this.instances.popup.enable();
} }
/* /*
@ -50,7 +53,6 @@ export default class EntryManager {
*/ */
disable () { disable () {
this.instances.menu.disable(); this.instances.menu.disable();
this.instances.popup.disable();
IconIndicator.disable(); IconIndicator.disable();
} }
} }