X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fmenu%2FTMenu.java;h=667673b642c4f340dd91b411fe38e3904d0f5687;hb=b2d49e0f15810a35a206e88c9bad11b053ed65fc;hp=c4a11df23d6f38b51aa071be0dbd4ff93cf10e7d;hpb=1c19fdeaff911aa6e9e028f3ad4db06c8d0597dd;p=fanfix.git diff --git a/src/jexer/menu/TMenu.java b/src/jexer/menu/TMenu.java index c4a11df..667673b 100644 --- a/src/jexer/menu/TMenu.java +++ b/src/jexer/menu/TMenu.java @@ -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: