+ /**
+ * Add a keyboard accelerator to the global hash.
+ *
+ * @param item menu item this accelerator relates to
+ * @param keypress keypress that will dispatch a TMenuEvent
+ */
+ public final void addAccelerator(final TMenuItem item,
+ final TKeypress keypress) {
+ /*
+ TODO
+ assert((keypress in accelerators) is null);
+ accelerators[keypress] = item;
+ */
+ }
+
+ /**
+ * Recompute menu x positions based on their title length.
+ */
+ public final void recomputeMenuX() {
+ int x = 0;
+ for (TMenu menu: menus) {
+ menu.setX(x);
+ x += menu.getTitle().length() + 2;
+ }
+ }
+
+ /**
+ * Post an event to process and turn off the menu.
+ *
+ * @param event new event to add to the queue
+ */
+ public final void addMenuEvent(final TInputEvent event) {
+ /*
+ TODO - synchronize correctly
+ eventQueue ~= event;
+ */
+ closeMenu();
+ }
+
+ /**
+ * Add a sub-menu to the list of open sub-menus.
+ *
+ * @param menu sub-menu
+ */
+ public final void addSubMenu(final TMenu menu) {
+ subMenus.add(menu);
+ }
+