1. Steve Losh
  2. lanterna

Commits

mabe02  committed acd99cc

Adding the solo window functionality

  • Participants
  • Parent commits 2ca2d63
  • Branches default

Comments (0)

Files changed (2)

File src/org/lantern/gui/GUIScreen.java

View file
 
         //Go through the windows
         for(WindowPlacement windowPlacement: windowStack) {
-            if(windowPlacement.getWindow().isHideWhenNotTopLevel() && windowPlacement != windowStack.getLast())
+            if(hasSoloWindowAbove(windowPlacement))
                 continue;
             
             TerminalPosition topLeft = windowPlacement.getTopLeft();
         CENTER
     }
 
+    private boolean hasSoloWindowAbove(WindowPlacement windowPlacement)
+    {
+        int index = windowStack.indexOf(windowPlacement);
+        for(int i = index + 1; i < windowStack.size(); i++) {
+            if(windowStack.get(i).window.isSoloWindow())
+                return true;
+        }
+        return false;
+    }
+
     private class WindowPlacement
     {
         private Window window;

File src/org/lantern/gui/Window.java

View file
     private GUIScreen owner;
     private final Panel contentPane;
     private Interactable currentlyInFocus;
-    private boolean hideWhenNotTopLevel;
+    private boolean soloWindow;
 
     public Window(String title)
     {
         this.contentPane = new Panel(title);
         this.contentPane.setParent(this);
         this.currentlyInFocus = null;
-        this.hideWhenNotTopLevel = false;
+        this.soloWindow = false;
     }
 
     public void addWindowListener(WindowListener listener)
         }
     }
 
-    public boolean isHideWhenNotTopLevel()
+    public boolean isSoloWindow()
     {
-        return hideWhenNotTopLevel;
+        return soloWindow;
     }
 
-    public void setHideWhenNotTopLevel(boolean hideWhenNotTopLevel)
+    public void setSoloWindow(boolean soloWindow)
     {
-        this.hideWhenNotTopLevel = hideWhenNotTopLevel;
+        this.soloWindow = soloWindow;
     }
 
     boolean maximisesVertically()