mirror of
https://github.com/Alee14/shiftos-challenge.git
synced 2025-01-22 18:12:15 +00:00
Windows are now forms. Minimizing works. Useful panel buttons work. Desktop is less fucking flickery.
This commit is contained in:
parent
0f7902b802
commit
c8c32ad8d2
8 changed files with 128 additions and 123 deletions
124
ShiftOS/ShiftOS/Desktop.Designer.cs
generated
124
ShiftOS/ShiftOS/Desktop.Designer.cs
generated
|
@ -30,18 +30,17 @@
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.DesktopPanel = new System.Windows.Forms.Panel();
|
this.DesktopPanel = new System.Windows.Forms.Panel();
|
||||||
this.CurrentTime = new System.Windows.Forms.Label();
|
this.PanelButtonList = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
|
this.AppLauncherHolder = new System.Windows.Forms.Panel();
|
||||||
this.Workspace = new System.Windows.Forms.Panel();
|
|
||||||
this.AppLauncherStrip = new System.Windows.Forms.MenuStrip();
|
this.AppLauncherStrip = new System.Windows.Forms.MenuStrip();
|
||||||
this.AppLauncherMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.AppLauncherMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.PanelButtonList = new System.Windows.Forms.FlowLayoutPanel();
|
|
||||||
this.TimePanel = new System.Windows.Forms.Panel();
|
this.TimePanel = new System.Windows.Forms.Panel();
|
||||||
this.AppLauncherHolder = new System.Windows.Forms.Panel();
|
this.CurrentTime = new System.Windows.Forms.Label();
|
||||||
|
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.DesktopPanel.SuspendLayout();
|
this.DesktopPanel.SuspendLayout();
|
||||||
|
this.AppLauncherHolder.SuspendLayout();
|
||||||
this.AppLauncherStrip.SuspendLayout();
|
this.AppLauncherStrip.SuspendLayout();
|
||||||
this.TimePanel.SuspendLayout();
|
this.TimePanel.SuspendLayout();
|
||||||
this.AppLauncherHolder.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// DesktopPanel
|
// DesktopPanel
|
||||||
|
@ -57,6 +56,55 @@
|
||||||
this.DesktopPanel.Size = new System.Drawing.Size(800, 24);
|
this.DesktopPanel.Size = new System.Drawing.Size(800, 24);
|
||||||
this.DesktopPanel.TabIndex = 0;
|
this.DesktopPanel.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// PanelButtonList
|
||||||
|
//
|
||||||
|
this.PanelButtonList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.PanelButtonList.Location = new System.Drawing.Point(88, 0);
|
||||||
|
this.PanelButtonList.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.PanelButtonList.Name = "PanelButtonList";
|
||||||
|
this.PanelButtonList.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
||||||
|
this.PanelButtonList.Size = new System.Drawing.Size(605, 24);
|
||||||
|
this.PanelButtonList.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// AppLauncherHolder
|
||||||
|
//
|
||||||
|
this.AppLauncherHolder.BackColor = System.Drawing.Color.Gray;
|
||||||
|
this.AppLauncherHolder.Controls.Add(this.AppLauncherStrip);
|
||||||
|
this.AppLauncherHolder.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
|
this.AppLauncherHolder.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.AppLauncherHolder.Name = "AppLauncherHolder";
|
||||||
|
this.AppLauncherHolder.Size = new System.Drawing.Size(88, 24);
|
||||||
|
this.AppLauncherHolder.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// AppLauncherStrip
|
||||||
|
//
|
||||||
|
this.AppLauncherStrip.GripMargin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.AppLauncherStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.AppLauncherMenu});
|
||||||
|
this.AppLauncherStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.AppLauncherStrip.Name = "AppLauncherStrip";
|
||||||
|
this.AppLauncherStrip.Padding = new System.Windows.Forms.Padding(0);
|
||||||
|
this.AppLauncherStrip.Size = new System.Drawing.Size(88, 24);
|
||||||
|
this.AppLauncherStrip.TabIndex = 1;
|
||||||
|
this.AppLauncherStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// AppLauncherMenu
|
||||||
|
//
|
||||||
|
this.AppLauncherMenu.AutoSize = false;
|
||||||
|
this.AppLauncherMenu.Name = "AppLauncherMenu";
|
||||||
|
this.AppLauncherMenu.Padding = new System.Windows.Forms.Padding(0);
|
||||||
|
this.AppLauncherMenu.Size = new System.Drawing.Size(77, 24);
|
||||||
|
this.AppLauncherMenu.Text = "Applications";
|
||||||
|
//
|
||||||
|
// TimePanel
|
||||||
|
//
|
||||||
|
this.TimePanel.Controls.Add(this.CurrentTime);
|
||||||
|
this.TimePanel.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
|
this.TimePanel.Location = new System.Drawing.Point(693, 0);
|
||||||
|
this.TimePanel.Name = "TimePanel";
|
||||||
|
this.TimePanel.Size = new System.Drawing.Size(107, 24);
|
||||||
|
this.TimePanel.TabIndex = 3;
|
||||||
|
//
|
||||||
// CurrentTime
|
// CurrentTime
|
||||||
//
|
//
|
||||||
this.CurrentTime.AutoSize = true;
|
this.CurrentTime.AutoSize = true;
|
||||||
|
@ -73,71 +121,12 @@
|
||||||
this.UpdateTimer.Interval = 10;
|
this.UpdateTimer.Interval = 10;
|
||||||
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
|
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
|
||||||
//
|
//
|
||||||
// Workspace
|
|
||||||
//
|
|
||||||
this.Workspace.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.Workspace.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.Workspace.Location = new System.Drawing.Point(0, 24);
|
|
||||||
this.Workspace.Name = "Workspace";
|
|
||||||
this.Workspace.Size = new System.Drawing.Size(800, 426);
|
|
||||||
this.Workspace.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// AppLauncherStrip
|
|
||||||
//
|
|
||||||
this.AppLauncherStrip.GripMargin = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
|
||||||
this.AppLauncherStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.AppLauncherMenu});
|
|
||||||
this.AppLauncherStrip.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.AppLauncherStrip.Name = "AppLauncherStrip";
|
|
||||||
this.AppLauncherStrip.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
|
||||||
this.AppLauncherStrip.Size = new System.Drawing.Size(88, 24);
|
|
||||||
this.AppLauncherStrip.TabIndex = 1;
|
|
||||||
this.AppLauncherStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// AppLauncherMenu
|
|
||||||
//
|
|
||||||
this.AppLauncherMenu.AutoSize = false;
|
|
||||||
this.AppLauncherMenu.Name = "AppLauncherMenu";
|
|
||||||
this.AppLauncherMenu.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
|
||||||
this.AppLauncherMenu.Size = new System.Drawing.Size(77, 24);
|
|
||||||
this.AppLauncherMenu.Text = "Applications";
|
|
||||||
//
|
|
||||||
// PanelButtonList
|
|
||||||
//
|
|
||||||
this.PanelButtonList.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.PanelButtonList.Location = new System.Drawing.Point(88, 0);
|
|
||||||
this.PanelButtonList.Margin = new System.Windows.Forms.Padding(0);
|
|
||||||
this.PanelButtonList.Name = "PanelButtonList";
|
|
||||||
this.PanelButtonList.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
|
||||||
this.PanelButtonList.Size = new System.Drawing.Size(605, 24);
|
|
||||||
this.PanelButtonList.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// TimePanel
|
|
||||||
//
|
|
||||||
this.TimePanel.Controls.Add(this.CurrentTime);
|
|
||||||
this.TimePanel.Dock = System.Windows.Forms.DockStyle.Right;
|
|
||||||
this.TimePanel.Location = new System.Drawing.Point(693, 0);
|
|
||||||
this.TimePanel.Name = "TimePanel";
|
|
||||||
this.TimePanel.Size = new System.Drawing.Size(107, 24);
|
|
||||||
this.TimePanel.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// AppLauncherHolder
|
|
||||||
//
|
|
||||||
this.AppLauncherHolder.BackColor = System.Drawing.Color.Gray;
|
|
||||||
this.AppLauncherHolder.Controls.Add(this.AppLauncherStrip);
|
|
||||||
this.AppLauncherHolder.Dock = System.Windows.Forms.DockStyle.Left;
|
|
||||||
this.AppLauncherHolder.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.AppLauncherHolder.Name = "AppLauncherHolder";
|
|
||||||
this.AppLauncherHolder.Size = new System.Drawing.Size(88, 24);
|
|
||||||
this.AppLauncherHolder.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// Desktop
|
// Desktop
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = System.Drawing.Color.Black;
|
this.BackColor = System.Drawing.Color.Black;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
this.Controls.Add(this.Workspace);
|
|
||||||
this.Controls.Add(this.DesktopPanel);
|
this.Controls.Add(this.DesktopPanel);
|
||||||
this.ForeColor = System.Drawing.Color.White;
|
this.ForeColor = System.Drawing.Color.White;
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
|
@ -149,12 +138,12 @@
|
||||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Desktop_KeyDown);
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Desktop_KeyDown);
|
||||||
this.DesktopPanel.ResumeLayout(false);
|
this.DesktopPanel.ResumeLayout(false);
|
||||||
|
this.AppLauncherHolder.ResumeLayout(false);
|
||||||
|
this.AppLauncherHolder.PerformLayout();
|
||||||
this.AppLauncherStrip.ResumeLayout(false);
|
this.AppLauncherStrip.ResumeLayout(false);
|
||||||
this.AppLauncherStrip.PerformLayout();
|
this.AppLauncherStrip.PerformLayout();
|
||||||
this.TimePanel.ResumeLayout(false);
|
this.TimePanel.ResumeLayout(false);
|
||||||
this.TimePanel.PerformLayout();
|
this.TimePanel.PerformLayout();
|
||||||
this.AppLauncherHolder.ResumeLayout(false);
|
|
||||||
this.AppLauncherHolder.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -164,7 +153,6 @@
|
||||||
private System.Windows.Forms.Panel DesktopPanel;
|
private System.Windows.Forms.Panel DesktopPanel;
|
||||||
private System.Windows.Forms.Label CurrentTime;
|
private System.Windows.Forms.Label CurrentTime;
|
||||||
private System.Windows.Forms.Timer UpdateTimer;
|
private System.Windows.Forms.Timer UpdateTimer;
|
||||||
private System.Windows.Forms.Panel Workspace;
|
|
||||||
private System.Windows.Forms.MenuStrip AppLauncherStrip;
|
private System.Windows.Forms.MenuStrip AppLauncherStrip;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AppLauncherMenu;
|
private System.Windows.Forms.ToolStripMenuItem AppLauncherMenu;
|
||||||
private System.Windows.Forms.FlowLayoutPanel PanelButtonList;
|
private System.Windows.Forms.FlowLayoutPanel PanelButtonList;
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace ShiftOS
|
||||||
this.CurrentSystem = InSystem;
|
this.CurrentSystem = InSystem;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ResetAppLauncher();
|
ResetAppLauncher();
|
||||||
|
this.DoubleBuffered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetPanelButtons()
|
private void ResetPanelButtons()
|
||||||
|
@ -34,18 +35,13 @@ namespace ShiftOS
|
||||||
// Clear the panel button list.
|
// Clear the panel button list.
|
||||||
this.PanelButtonList.Controls.Clear();
|
this.PanelButtonList.Controls.Clear();
|
||||||
|
|
||||||
// Go through every control in the workspace.
|
foreach (var window in CurrentSystem.GetWindows())
|
||||||
foreach(Control ctrl in Workspace.Controls)
|
|
||||||
{
|
{
|
||||||
// Check if it's a Window.
|
// Create a panel button for the window.
|
||||||
if(ctrl is Window)
|
var panelButton = new PanelButton(this, window);
|
||||||
{
|
|
||||||
// Create a panel button for the window.
|
|
||||||
var panelButton = new PanelButton(this, ctrl as Window);
|
|
||||||
|
|
||||||
// Add it to our UI.
|
// Add it to our UI.
|
||||||
this.PanelButtonList.Controls.Add(panelButton);
|
this.PanelButtonList.Controls.Add(panelButton);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +59,8 @@ namespace ShiftOS
|
||||||
// then we become transparent.
|
// then we become transparent.
|
||||||
this.BackgroundImage = null;
|
this.BackgroundImage = null;
|
||||||
this.BackColor = this.TransparencyKey;
|
this.BackColor = this.TransparencyKey;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -225,10 +223,10 @@ namespace ShiftOS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has the amount of children (windows) in the workspace changed?
|
// Has the amount of children (windows) in the workspace changed?
|
||||||
if(_lastWorkspaceChildCount != this.Workspace.Controls.Count)
|
if(_lastWorkspaceChildCount != CurrentSystem.GetWindows().Count)
|
||||||
{
|
{
|
||||||
// Update it.
|
// Update it.
|
||||||
_lastWorkspaceChildCount = this.Workspace.Controls.Count;
|
_lastWorkspaceChildCount = CurrentSystem.GetWindows().Count;
|
||||||
|
|
||||||
// Reset panel buttons.
|
// Reset panel buttons.
|
||||||
this.ResetPanelButtons();
|
this.ResetPanelButtons();
|
||||||
|
@ -238,11 +236,6 @@ namespace ShiftOS
|
||||||
this.CurrentSystem.UpdateDesktop();
|
this.CurrentSystem.UpdateDesktop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Panel GetWorkspace()
|
|
||||||
{
|
|
||||||
return this.Workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetAppLauncher()
|
public void ResetAppLauncher()
|
||||||
{
|
{
|
||||||
// Clear out the existing app launcher items, if any.
|
// Clear out the existing app launcher items, if any.
|
||||||
|
|
|
@ -120,6 +120,9 @@
|
||||||
<metadata name="AppLauncherStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="AppLauncherStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>139, 17</value>
|
<value>139, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="AppLauncherStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>139, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="UpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="UpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
5
ShiftOS/ShiftOS/PanelButton.Designer.cs
generated
5
ShiftOS/ShiftOS/PanelButton.Designer.cs
generated
|
@ -42,6 +42,7 @@
|
||||||
this.IconBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.IconBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.IconBox.TabIndex = 0;
|
this.IconBox.TabIndex = 0;
|
||||||
this.IconBox.TabStop = false;
|
this.IconBox.TabStop = false;
|
||||||
|
this.IconBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelButton_MouseClick);
|
||||||
//
|
//
|
||||||
// TitleText
|
// TitleText
|
||||||
//
|
//
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
this.TitleText.Size = new System.Drawing.Size(89, 15);
|
this.TitleText.Size = new System.Drawing.Size(89, 15);
|
||||||
this.TitleText.TabIndex = 1;
|
this.TitleText.TabIndex = 1;
|
||||||
this.TitleText.Text = "Window Title";
|
this.TitleText.Text = "Window Title";
|
||||||
|
this.TitleText.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelButton_MouseClick);
|
||||||
//
|
//
|
||||||
// PanelButton
|
// PanelButton
|
||||||
//
|
//
|
||||||
|
@ -62,9 +64,10 @@
|
||||||
this.Controls.Add(this.IconBox);
|
this.Controls.Add(this.IconBox);
|
||||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
|
||||||
this.ForeColor = System.Drawing.Color.White;
|
this.ForeColor = System.Drawing.Color.White;
|
||||||
this.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
this.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.Name = "PanelButton";
|
this.Name = "PanelButton";
|
||||||
this.Size = new System.Drawing.Size(204, 20);
|
this.Size = new System.Drawing.Size(204, 20);
|
||||||
|
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelButton_MouseClick);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.IconBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.IconBox)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
|
@ -82,5 +82,19 @@ namespace ShiftOS
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PanelButton_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if(_window.Enabled == false)
|
||||||
|
{
|
||||||
|
_window.Enabled = true;
|
||||||
|
_window.Opacity = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_window.Opacity = 0;
|
||||||
|
_window.Enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ShiftOS
|
||||||
private SkinContext _skinContext = null;
|
private SkinContext _skinContext = null;
|
||||||
private FilesystemContext _filesystem = null;
|
private FilesystemContext _filesystem = null;
|
||||||
private int _codepoints = 0;
|
private int _codepoints = 0;
|
||||||
|
private List<Window> _windows = new List<Window>();
|
||||||
private Dictionary<string, Type> _programTypeMap = new Dictionary<string, Type>();
|
private Dictionary<string, Type> _programTypeMap = new Dictionary<string, Type>();
|
||||||
private List<ProgramAttribute> _programMetadata = new List<ProgramAttribute>();
|
private List<ProgramAttribute> _programMetadata = new List<ProgramAttribute>();
|
||||||
|
|
||||||
|
@ -50,18 +50,15 @@ namespace ShiftOS
|
||||||
|
|
||||||
// Set the system context of the window.
|
// Set the system context of the window.
|
||||||
window.SetSystemContext(this);
|
window.SetSystemContext(this);
|
||||||
|
_windows.Add(window);
|
||||||
// Add the window to the desktop's workspace.
|
|
||||||
var work = _desktop.GetWorkspace();
|
|
||||||
work.Controls.Add(window);
|
|
||||||
|
|
||||||
// Center the window on the workspace.
|
|
||||||
window.Left = (work.Width - window.Width) / 2;
|
|
||||||
window.Top = (work.Height - window.Height) / 2;
|
|
||||||
|
|
||||||
// Ensure the window is visible.
|
|
||||||
window.Show();
|
window.Show();
|
||||||
|
|
||||||
|
window.FormClosed += (o, a) =>
|
||||||
|
{
|
||||||
|
_windows.Remove(window);
|
||||||
|
Console.WriteLine(" --> Closed {0}", window.WindowTitle);
|
||||||
|
};
|
||||||
|
|
||||||
// Program was successfully launched.
|
// Program was successfully launched.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +72,11 @@ namespace ShiftOS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Window> GetWindows()
|
||||||
|
{
|
||||||
|
return _windows;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetProgramName(string InExecutableName)
|
public string GetProgramName(string InExecutableName)
|
||||||
{
|
{
|
||||||
// TODO: Check if the program is installed or unlocked.
|
// TODO: Check if the program is installed or unlocked.
|
||||||
|
|
33
ShiftOS/ShiftOS/Windowing/Window.Designer.cs
generated
33
ShiftOS/ShiftOS/Windowing/Window.Designer.cs
generated
|
@ -59,7 +59,7 @@
|
||||||
this.TitleBarHolder.Dock = System.Windows.Forms.DockStyle.Top;
|
this.TitleBarHolder.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.TitleBarHolder.Location = new System.Drawing.Point(0, 0);
|
this.TitleBarHolder.Location = new System.Drawing.Point(0, 0);
|
||||||
this.TitleBarHolder.Name = "TitleBarHolder";
|
this.TitleBarHolder.Name = "TitleBarHolder";
|
||||||
this.TitleBarHolder.Size = new System.Drawing.Size(601, 30);
|
this.TitleBarHolder.Size = new System.Drawing.Size(585, 30);
|
||||||
this.TitleBarHolder.TabIndex = 0;
|
this.TitleBarHolder.TabIndex = 0;
|
||||||
this.TitleBarHolder.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
this.TitleBarHolder.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
||||||
//
|
//
|
||||||
|
@ -72,6 +72,7 @@
|
||||||
this.IconBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.IconBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.IconBox.TabIndex = 8;
|
this.IconBox.TabIndex = 8;
|
||||||
this.IconBox.TabStop = false;
|
this.IconBox.TabStop = false;
|
||||||
|
this.IconBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
||||||
//
|
//
|
||||||
// TitleText
|
// TitleText
|
||||||
//
|
//
|
||||||
|
@ -84,21 +85,23 @@
|
||||||
this.TitleText.Size = new System.Drawing.Size(100, 17);
|
this.TitleText.Size = new System.Drawing.Size(100, 17);
|
||||||
this.TitleText.TabIndex = 5;
|
this.TitleText.TabIndex = 5;
|
||||||
this.TitleText.Text = "Window Title";
|
this.TitleText.Text = "Window Title";
|
||||||
|
this.TitleText.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
||||||
//
|
//
|
||||||
// MinimizeButton
|
// MinimizeButton
|
||||||
//
|
//
|
||||||
this.MinimizeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.MinimizeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.MinimizeButton.BackColor = System.Drawing.Color.Black;
|
this.MinimizeButton.BackColor = System.Drawing.Color.Black;
|
||||||
this.MinimizeButton.Location = new System.Drawing.Point(520, 3);
|
this.MinimizeButton.Location = new System.Drawing.Point(504, 3);
|
||||||
this.MinimizeButton.Name = "MinimizeButton";
|
this.MinimizeButton.Name = "MinimizeButton";
|
||||||
this.MinimizeButton.Size = new System.Drawing.Size(24, 24);
|
this.MinimizeButton.Size = new System.Drawing.Size(24, 24);
|
||||||
this.MinimizeButton.TabIndex = 7;
|
this.MinimizeButton.TabIndex = 7;
|
||||||
|
this.MinimizeButton.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MinimizeButton_MouseClick);
|
||||||
//
|
//
|
||||||
// RollButton
|
// RollButton
|
||||||
//
|
//
|
||||||
this.RollButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.RollButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.RollButton.BackColor = System.Drawing.Color.Black;
|
this.RollButton.BackColor = System.Drawing.Color.Black;
|
||||||
this.RollButton.Location = new System.Drawing.Point(547, 3);
|
this.RollButton.Location = new System.Drawing.Point(531, 3);
|
||||||
this.RollButton.Name = "RollButton";
|
this.RollButton.Name = "RollButton";
|
||||||
this.RollButton.Size = new System.Drawing.Size(24, 24);
|
this.RollButton.Size = new System.Drawing.Size(24, 24);
|
||||||
this.RollButton.TabIndex = 6;
|
this.RollButton.TabIndex = 6;
|
||||||
|
@ -108,7 +111,7 @@
|
||||||
//
|
//
|
||||||
this.CloseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.CloseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.CloseButton.BackColor = System.Drawing.Color.Black;
|
this.CloseButton.BackColor = System.Drawing.Color.Black;
|
||||||
this.CloseButton.Location = new System.Drawing.Point(574, 3);
|
this.CloseButton.Location = new System.Drawing.Point(558, 3);
|
||||||
this.CloseButton.Name = "CloseButton";
|
this.CloseButton.Name = "CloseButton";
|
||||||
this.CloseButton.Size = new System.Drawing.Size(24, 24);
|
this.CloseButton.Size = new System.Drawing.Size(24, 24);
|
||||||
this.CloseButton.TabIndex = 5;
|
this.CloseButton.TabIndex = 5;
|
||||||
|
@ -118,10 +121,11 @@
|
||||||
//
|
//
|
||||||
this.TitleBarRight.BackColor = System.Drawing.Color.Gray;
|
this.TitleBarRight.BackColor = System.Drawing.Color.Gray;
|
||||||
this.TitleBarRight.Dock = System.Windows.Forms.DockStyle.Right;
|
this.TitleBarRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.TitleBarRight.Location = new System.Drawing.Point(599, 0);
|
this.TitleBarRight.Location = new System.Drawing.Point(583, 0);
|
||||||
this.TitleBarRight.Name = "TitleBarRight";
|
this.TitleBarRight.Name = "TitleBarRight";
|
||||||
this.TitleBarRight.Size = new System.Drawing.Size(2, 30);
|
this.TitleBarRight.Size = new System.Drawing.Size(2, 30);
|
||||||
this.TitleBarRight.TabIndex = 2;
|
this.TitleBarRight.TabIndex = 2;
|
||||||
|
this.TitleBarRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
||||||
//
|
//
|
||||||
// TitleBarLeft
|
// TitleBarLeft
|
||||||
//
|
//
|
||||||
|
@ -131,6 +135,7 @@
|
||||||
this.TitleBarLeft.Name = "TitleBarLeft";
|
this.TitleBarLeft.Name = "TitleBarLeft";
|
||||||
this.TitleBarLeft.Size = new System.Drawing.Size(2, 30);
|
this.TitleBarLeft.Size = new System.Drawing.Size(2, 30);
|
||||||
this.TitleBarLeft.TabIndex = 1;
|
this.TitleBarLeft.TabIndex = 1;
|
||||||
|
this.TitleBarLeft.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TitleBarMouseDown);
|
||||||
//
|
//
|
||||||
// BottomBarHolder
|
// BottomBarHolder
|
||||||
//
|
//
|
||||||
|
@ -138,16 +143,16 @@
|
||||||
this.BottomBarHolder.Controls.Add(this.BottomRight);
|
this.BottomBarHolder.Controls.Add(this.BottomRight);
|
||||||
this.BottomBarHolder.Controls.Add(this.BottomLeft);
|
this.BottomBarHolder.Controls.Add(this.BottomLeft);
|
||||||
this.BottomBarHolder.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.BottomBarHolder.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.BottomBarHolder.Location = new System.Drawing.Point(0, 344);
|
this.BottomBarHolder.Location = new System.Drawing.Point(0, 305);
|
||||||
this.BottomBarHolder.Name = "BottomBarHolder";
|
this.BottomBarHolder.Name = "BottomBarHolder";
|
||||||
this.BottomBarHolder.Size = new System.Drawing.Size(601, 2);
|
this.BottomBarHolder.Size = new System.Drawing.Size(585, 2);
|
||||||
this.BottomBarHolder.TabIndex = 1;
|
this.BottomBarHolder.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// BottomRight
|
// BottomRight
|
||||||
//
|
//
|
||||||
this.BottomRight.BackColor = System.Drawing.Color.Gray;
|
this.BottomRight.BackColor = System.Drawing.Color.Gray;
|
||||||
this.BottomRight.Dock = System.Windows.Forms.DockStyle.Right;
|
this.BottomRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.BottomRight.Location = new System.Drawing.Point(599, 0);
|
this.BottomRight.Location = new System.Drawing.Point(583, 0);
|
||||||
this.BottomRight.Name = "BottomRight";
|
this.BottomRight.Name = "BottomRight";
|
||||||
this.BottomRight.Size = new System.Drawing.Size(2, 2);
|
this.BottomRight.Size = new System.Drawing.Size(2, 2);
|
||||||
this.BottomRight.TabIndex = 2;
|
this.BottomRight.TabIndex = 2;
|
||||||
|
@ -165,9 +170,9 @@
|
||||||
//
|
//
|
||||||
this.RightBar.BackColor = System.Drawing.Color.Gray;
|
this.RightBar.BackColor = System.Drawing.Color.Gray;
|
||||||
this.RightBar.Dock = System.Windows.Forms.DockStyle.Right;
|
this.RightBar.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.RightBar.Location = new System.Drawing.Point(599, 30);
|
this.RightBar.Location = new System.Drawing.Point(583, 30);
|
||||||
this.RightBar.Name = "RightBar";
|
this.RightBar.Name = "RightBar";
|
||||||
this.RightBar.Size = new System.Drawing.Size(2, 314);
|
this.RightBar.Size = new System.Drawing.Size(2, 275);
|
||||||
this.RightBar.TabIndex = 3;
|
this.RightBar.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// LeftBar
|
// LeftBar
|
||||||
|
@ -176,7 +181,7 @@
|
||||||
this.LeftBar.Dock = System.Windows.Forms.DockStyle.Left;
|
this.LeftBar.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
this.LeftBar.Location = new System.Drawing.Point(0, 30);
|
this.LeftBar.Location = new System.Drawing.Point(0, 30);
|
||||||
this.LeftBar.Name = "LeftBar";
|
this.LeftBar.Name = "LeftBar";
|
||||||
this.LeftBar.Size = new System.Drawing.Size(2, 314);
|
this.LeftBar.Size = new System.Drawing.Size(2, 275);
|
||||||
this.LeftBar.TabIndex = 4;
|
this.LeftBar.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// Window
|
// Window
|
||||||
|
@ -185,13 +190,17 @@
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
|
this.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
|
||||||
this.BackColor = System.Drawing.Color.White;
|
this.BackColor = System.Drawing.Color.White;
|
||||||
|
this.ClientSize = new System.Drawing.Size(585, 307);
|
||||||
this.Controls.Add(this.LeftBar);
|
this.Controls.Add(this.LeftBar);
|
||||||
this.Controls.Add(this.RightBar);
|
this.Controls.Add(this.RightBar);
|
||||||
this.Controls.Add(this.BottomBarHolder);
|
this.Controls.Add(this.BottomBarHolder);
|
||||||
this.Controls.Add(this.TitleBarHolder);
|
this.Controls.Add(this.TitleBarHolder);
|
||||||
this.ForeColor = System.Drawing.Color.Black;
|
this.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
this.Name = "Window";
|
this.Name = "Window";
|
||||||
this.Size = new System.Drawing.Size(601, 346);
|
this.ShowInTaskbar = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.TopMost = true;
|
||||||
this.TitleBarHolder.ResumeLayout(false);
|
this.TitleBarHolder.ResumeLayout(false);
|
||||||
this.TitleBarHolder.PerformLayout();
|
this.TitleBarHolder.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.IconBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.IconBox)).EndInit();
|
||||||
|
|
|
@ -12,7 +12,7 @@ using System.Windows.Forms;
|
||||||
namespace ShiftOS.Windowing
|
namespace ShiftOS.Windowing
|
||||||
{
|
{
|
||||||
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
|
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
|
||||||
public partial class Window : UserControl
|
public partial class Window : Form
|
||||||
{
|
{
|
||||||
private SystemContext _currentSystem = null;
|
private SystemContext _currentSystem = null;
|
||||||
private int PreRollHeight = 0;
|
private int PreRollHeight = 0;
|
||||||
|
@ -38,8 +38,6 @@ namespace ShiftOS.Windowing
|
||||||
|
|
||||||
private void OnDesktopUpdated(object sender, EventArgs e)
|
private void OnDesktopUpdated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.BackColor = Color.Transparent;
|
|
||||||
|
|
||||||
// Get the skin data.
|
// Get the skin data.
|
||||||
var skin = this.CurrentSystem.GetSkinContext();
|
var skin = this.CurrentSystem.GetSkinContext();
|
||||||
var skindata = skin.GetSkinData();
|
var skindata = skin.GetSkinData();
|
||||||
|
@ -336,17 +334,6 @@ namespace ShiftOS.Windowing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler WindowClosed;
|
|
||||||
|
|
||||||
protected virtual void OnClose() { }
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
WindowClosed?.Invoke(this, EventArgs.Empty);
|
|
||||||
OnClose();
|
|
||||||
this.Parent?.Controls.Remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseButton_MouseClick(object sender, MouseEventArgs e)
|
private void CloseButton_MouseClick(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
|
@ -365,5 +352,11 @@ namespace ShiftOS.Windowing
|
||||||
}
|
}
|
||||||
IsRolled = !IsRolled;
|
IsRolled = !IsRolled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MinimizeButton_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
this.Opacity = 0;
|
||||||
|
this.Enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue