retrofit from gjexer
[fanfix.git] / src / jexer / TWindow.java
index a4a9c23a815d602e2525b07f28bfbfcd921744a7..16945496e1f792d526240f3982aca67fc0f8a6a9 100644 (file)
@@ -91,6 +91,11 @@ public class TWindow extends TWidget {
      */
     public static final int HIDEONCLOSE = 0x40;
 
+    /**
+     * Menus cannot be used when this window is active (default no).
+     */
+    public static final int OVERRIDEMENU        = 0x80;
+
     // ------------------------------------------------------------------------
     // Variables --------------------------------------------------------------
     // ------------------------------------------------------------------------
@@ -185,6 +190,15 @@ public class TWindow extends TWidget {
      */
     protected TStatusBar statusBar = null;
 
+    /**
+     * A window may request that TApplication NOT draw the mouse cursor over
+     * it by setting this to true.  This is currently only used within Jexer
+     * by TTerminalWindow so that only the bottom-most instance of nested
+     * Jexer's draws the mouse within its application window.  But perhaps
+     * other applications can use it, so public getter/setter is provided.
+     */
+    private boolean hideMouse = false;
+
     // ------------------------------------------------------------------------
     // Constructors -----------------------------------------------------------
     // ------------------------------------------------------------------------
@@ -1242,6 +1256,20 @@ public class TWindow extends TWidget {
         return false;
     }
 
+    /**
+     * Returns true if this window does not want menus to work while it is
+     * visible.
+     *
+     * @return true if this window does not want menus to work while it is
+     * visible
+     */
+    public final boolean hasOverriddenMenu() {
+        if ((flags & OVERRIDEMENU) != 0) {
+            return true;
+        }
+        return false;
+    }
+
     /**
      * Retrieve the background color.
      *
@@ -1346,4 +1374,26 @@ public class TWindow extends TWidget {
         }
     }
 
+    /**
+     * Returns true if this window does not want the application-wide mouse
+     * cursor drawn over it.
+     *
+     * @return true if this window does not want the application-wide mouse
+     * cursor drawn over it
+     */
+    public final boolean hasHiddenMouse() {
+        return hideMouse;
+    }
+
+    /**
+     * Set request to prevent the application-wide mouse cursor from being
+     * drawn over this window.
+     *
+     * @param hideMouse if true, this window does not want the
+     * application-wide mouse cursor drawn over it
+     */
+    public final void setHiddenMouse(final boolean hideMouse) {
+        this.hideMouse = hideMouse;
+    }
+
 }