diff options
| author | Michael <[email protected]> | 2017-07-04 09:52:49 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-04 09:52:49 -0400 |
| commit | 3e65bf26fd69ed5cd9ed9c49b20ab5182c098430 (patch) | |
| tree | 4f3b0d26fba385bf6080db01ccfaa9bc73345276 /ShiftOS.Frontend/Desktop/WindowManager.cs | |
| parent | d23c5cc29dc47537d1cf6069f27009750fd80919 (diff) | |
| download | shiftos_thereturn-3e65bf26fd69ed5cd9ed9c49b20ab5182c098430.tar.gz shiftos_thereturn-3e65bf26fd69ed5cd9ed9c49b20ab5182c098430.tar.bz2 shiftos_thereturn-3e65bf26fd69ed5cd9ed9c49b20ab5182c098430.zip | |
Port over the Terminal
Diffstat (limited to 'ShiftOS.Frontend/Desktop/WindowManager.cs')
| -rw-r--r-- | ShiftOS.Frontend/Desktop/WindowManager.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ShiftOS.Frontend/Desktop/WindowManager.cs b/ShiftOS.Frontend/Desktop/WindowManager.cs index 4f99a05..1fa5cfb 100644 --- a/ShiftOS.Frontend/Desktop/WindowManager.cs +++ b/ShiftOS.Frontend/Desktop/WindowManager.cs @@ -60,6 +60,20 @@ namespace ShiftOS.Frontend.Desktop win.OnSkinLoad(); } + private int MaxCount + { + get + { + if (Shiftorium.UpgradeInstalled("wm_unlimited_windows")) + return int.MaxValue; + if (Shiftorium.UpgradeInstalled("wm_4_windows")) + return 4; + if (Shiftorium.UpgradeInstalled("wm_2_windows")) + return 2; + return 1; + } + } + public override void SetupWindow(IShiftOSWindow win) { if (!Shiftorium.UpgradeAttributesUnlocked(win.GetType())) @@ -67,6 +81,11 @@ namespace ShiftOS.Frontend.Desktop Console.WriteLine("Application not found on system."); return; } + while(AppearanceManager.OpenForms.Count > MaxCount) + { + AppearanceManager.OpenForms[0].Close(); + AppearanceManager.OpenForms.RemoveAt(0); + } var wb = new WindowBorder(); wb.Width = (win as GUI.Control).Width + LoadedSkin.LeftBorderWidth + LoadedSkin.RightBorderWidth; wb.Height = (win as GUI.Control).Height + LoadedSkin.TitlebarHeight + LoadedSkin.BottomBorderWidth; @@ -78,7 +97,23 @@ namespace ShiftOS.Frontend.Desktop win.OnLoad(); win.OnUpgrade(); win.OnSkinLoad(); + if (!Shiftorium.UpgradeInstalled("wm_free_placement")) + { + TileWindows(); + } + } + public void TileWindows() + { + if (AppearanceManager.OpenForms.Count == 0) + return; + else if(AppearanceManager.OpenForms.Count == 1) + { + var wb = (WindowBorder)AppearanceManager.OpenForms[0]; + wb.X = 0; + wb.Y = 0; + wb.ResizeWindow(UIManager.Viewport.Width, UIManager.Viewport.Height); + } } } @@ -87,6 +122,19 @@ namespace ShiftOS.Frontend.Desktop private string _text = "ShiftOS window"; private GUI.Control _hostedwindow = null; + public void ResizeWindow(int width, int height) + { + int titleheight = Shiftorium.UpgradeInstalled("wm_titlebar") ? LoadedSkin.TitlebarHeight : 0; + int leftwidth = Shiftorium.UpgradeInstalled("window_borders") ? LoadedSkin.LeftBorderWidth : 0; + int bottomheight = Shiftorium.UpgradeInstalled("window_borders") ? LoadedSkin.BottomBorderWidth : 0; + int rightwidth = Shiftorium.UpgradeInstalled("window_borders") ? LoadedSkin.RightBorderWidth : 0; + _hostedwindow.Width = width - leftwidth - rightwidth; + _hostedwindow.Height = width - bottomheight - titleheight; + Width = width; + Height = height; + + } + public WindowBorder() { X = 720; |
