X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fmenu%2FTSubMenu.java;h=88094daa155b0ba46e9f758084510a352c8c0415;hb=d36057dfab8def933a64be042b039d76708ac5ba;hp=7b5f80c911e6e402dbf69dd9dc92c0e1a23b5b35;hpb=eb29bbb5ec70c43895dd0f053630c7e3cd402cba;p=nikiroo-utils.git diff --git a/src/jexer/menu/TSubMenu.java b/src/jexer/menu/TSubMenu.java index 7b5f80c..88094da 100644 --- a/src/jexer/menu/TSubMenu.java +++ b/src/jexer/menu/TSubMenu.java @@ -40,11 +40,19 @@ import static jexer.TKeypress.*; */ public final class TSubMenu extends TMenuItem { + // ------------------------------------------------------------------------ + // Variables -------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * The menu window. Note package private access. */ TMenu menu; + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * Package private constructor. * @@ -67,28 +75,9 @@ public final class TSubMenu extends TMenuItem { this.menu.isSubMenu = true; } - /** - * Draw the menu title. - */ - @Override - public void draw() { - super.draw(); - - CellAttributes menuColor; - if (isAbsoluteActive()) { - menuColor = getTheme().getColor("tmenu.highlighted"); - } else { - if (isEnabled()) { - menuColor = getTheme().getColor("tmenu"); - } else { - menuColor = getTheme().getColor("tmenu.disabled"); - } - } - - // Add the arrow - getScreen().putCharXY(getWidth() - 2, 0, GraphicsChars.CP437[0x10], - menuColor); - } + // ------------------------------------------------------------------------ + // Event handlers --------------------------------------------------------- + // ------------------------------------------------------------------------ /** * Handle keystrokes. @@ -151,6 +140,33 @@ public final class TSubMenu extends TMenuItem { } } + // ------------------------------------------------------------------------ + // TMenuItem -------------------------------------------------------------- + // ------------------------------------------------------------------------ + + /** + * Draw the menu title. + */ + @Override + public void draw() { + super.draw(); + + CellAttributes menuColor; + if (isAbsoluteActive()) { + menuColor = getTheme().getColor("tmenu.highlighted"); + } else { + if (isEnabled()) { + menuColor = getTheme().getColor("tmenu"); + } else { + menuColor = getTheme().getColor("tmenu.disabled"); + } + } + + // Add the arrow + getScreen().putCharXY(getWidth() - 2, 0, GraphicsChars.CP437[0x10], + menuColor); + } + /** * Override dispatch() to do nothing. */ @@ -179,6 +195,10 @@ public final class TSubMenu extends TMenuItem { return this; } + // ------------------------------------------------------------------------ + // TSubMenu --------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * Convenience function to add a custom menu item. * @@ -233,5 +253,4 @@ public final class TSubMenu extends TMenuItem { return menu.addSubMenu(title); } - }