Fix lag in TTerminalWindow
[nikiroo-utils.git] / src / jexer / menu / TMenu.java
index c4a11df23d6f38b51aa071be0dbd4ff93cf10e7d..667673b642c4f340dd91b411fe38e3904d0f5687 100644 (file)
@@ -56,6 +56,29 @@ public final class TMenu extends TWindow {
      */
     boolean isSubMenu = false;
 
+    /**
+     * The X position of the menu's title.
+     */
+    private int titleX;
+
+    /**
+     * Set the menu title X position.
+     *
+     * @param titleX the position
+     */
+    public void setTitleX(final int titleX) {
+        this.titleX = titleX;
+    }
+
+    /**
+     * Get the menu title X position.
+     *
+     * @return the position
+     */
+    public int getTitleX() {
+        return titleX;
+    }
+
     /**
      * The shortcut and title.
      */
@@ -349,6 +372,23 @@ public final class TMenu extends TWindow {
         return addItemInternal(id, label, key);
     }
 
+    /**
+     * Convenience function to add a custom menu item.
+     *
+     * @param id menu item ID.  Must be greater than 1024.
+     * @param label menu item label
+     * @param key global keyboard accelerator
+     * @param enabled default state for enabled
+     * @return the new menu item
+     */
+    public TMenuItem addItem(final int id, final String label,
+        final TKeypress key, final boolean enabled) {
+
+        TMenuItem item = addItem(id, label, key);
+        item.setEnabled(enabled);
+        return item;
+    }
+
     /**
      * Convenience function to add a custom menu item.
      *
@@ -405,7 +445,7 @@ public final class TMenu extends TWindow {
 
         case MID_OPEN_FILE:
             label = i18n.getString("menuOpen");
-            key = kbAltO;
+            key = kbF3;
             break;
 
         case MID_CUT: