aboutsummaryrefslogtreecommitdiff
path: root/PortEngine/WindowManager
diff options
context:
space:
mode:
Diffstat (limited to 'PortEngine/WindowManager')
-rw-r--r--PortEngine/WindowManager/WM.Designer.cs70
-rw-r--r--PortEngine/WindowManager/WM.cs40
-rw-r--r--PortEngine/WindowManager/WindowManager.cs28
-rw-r--r--PortEngine/WindowManager/base.Designer.cs151
-rw-r--r--PortEngine/WindowManager/base.cs95
-rw-r--r--PortEngine/WindowManager/base.resx (renamed from PortEngine/WindowManager/WM.resx)6
6 files changed, 280 insertions, 110 deletions
diff --git a/PortEngine/WindowManager/WM.Designer.cs b/PortEngine/WindowManager/WM.Designer.cs
deleted file mode 100644
index 3e6ef63..0000000
--- a/PortEngine/WindowManager/WM.Designer.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-namespace PortEngine.WindowManager
-{
- partial class WM
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.panel1 = new System.Windows.Forms.Panel();
- this.panel2 = new System.Windows.Forms.Panel();
- this.SuspendLayout();
- //
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panel1.BackColor = System.Drawing.Color.DimGray;
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(372, 36);
- this.panel1.TabIndex = 0;
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.Color.White;
- this.panel2.Location = new System.Drawing.Point(0, 35);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(372, 267);
- this.panel2.TabIndex = 1;
- //
- // WM
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.panel2);
- this.Controls.Add(this.panel1);
- this.Name = "WM";
- this.Size = new System.Drawing.Size(372, 302);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Panel panel2;
- }
-}
diff --git a/PortEngine/WindowManager/WM.cs b/PortEngine/WindowManager/WM.cs
deleted file mode 100644
index 5c43be2..0000000
--- a/PortEngine/WindowManager/WM.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/************************************************************************
- *
- * PortEngine
- * Copyright (C) 2018 AleeCorp
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- **************************************************************************/
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace PortEngine.WindowManager
-{
- public partial class WM : UserControl
- {
- public WM()
- {
- InitializeComponent();
- }
-
- }
-}
diff --git a/PortEngine/WindowManager/WindowManager.cs b/PortEngine/WindowManager/WindowManager.cs
new file mode 100644
index 0000000..367f3df
--- /dev/null
+++ b/PortEngine/WindowManager/WindowManager.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Amethyst
+{
+ class WindowManager
+ {
+ public void createWindow(UserControl program, String name, String rpcData, String rpcImage, Image icon)
+ {
+ @base window = new @base()
+ {
+ Height = program.Height + 30,
+ Width = program.Width
+ };
+ program.Parent = window.pnlContent;
+ program.BringToFront();
+ program.Dock = DockStyle.Fill;
+ window.lblProg.Text = name;
+ if (PortEngine.Properties.Settings.Default.graphicsFriendly == false) window.Opacity = 0;
+ window.TopMost = true;
+ window.rpcData = rpcData;
+ window.rpcImage = rpcImage;
+ window.Show();
+ }
+ }
+}
diff --git a/PortEngine/WindowManager/base.Designer.cs b/PortEngine/WindowManager/base.Designer.cs
new file mode 100644
index 0000000..78072d2
--- /dev/null
+++ b/PortEngine/WindowManager/base.Designer.cs
@@ -0,0 +1,151 @@
+namespace Amethyst
+{
+ partial class @base
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.pnlTitle = new System.Windows.Forms.Panel();
+ this.btnMin = new System.Windows.Forms.Button();
+ this.btnClose = new System.Windows.Forms.Button();
+ this.lblProg = new System.Windows.Forms.Label();
+ this.pnlContent = new System.Windows.Forms.Panel();
+ this.tmClose = new System.Windows.Forms.Timer(this.components);
+ this.tmOpen = new System.Windows.Forms.Timer(this.components);
+ this.pnlTitle.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pnlTitle
+ //
+ this.pnlTitle.BackColor = System.Drawing.Color.DimGray;
+ this.pnlTitle.Controls.Add(this.btnMin);
+ this.pnlTitle.Controls.Add(this.btnClose);
+ this.pnlTitle.Controls.Add(this.lblProg);
+ this.pnlTitle.Dock = System.Windows.Forms.DockStyle.Top;
+ this.pnlTitle.Location = new System.Drawing.Point(0, 0);
+ this.pnlTitle.Name = "pnlTitle";
+ this.pnlTitle.Size = new System.Drawing.Size(500, 30);
+ this.pnlTitle.TabIndex = 0;
+ this.pnlTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseDown);
+ this.pnlTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseMove);
+ this.pnlTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseUp);
+ //
+ // btnMin
+ //
+ this.btnMin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnMin.BackColor = System.Drawing.Color.Yellow;
+ this.btnMin.FlatAppearance.BorderSize = 0;
+ this.btnMin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnMin.Location = new System.Drawing.Point(440, 0);
+ this.btnMin.Name = "btnMin";
+ this.btnMin.Size = new System.Drawing.Size(30, 30);
+ this.btnMin.TabIndex = 2;
+ this.btnMin.TabStop = false;
+ this.btnMin.Text = "-";
+ this.btnMin.UseVisualStyleBackColor = false;
+ this.btnMin.Click += new System.EventHandler(this.btnMin_Click);
+ //
+ // btnClose
+ //
+ this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnClose.BackColor = System.Drawing.Color.Red;
+ this.btnClose.FlatAppearance.BorderSize = 0;
+ this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnClose.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
+ this.btnClose.Location = new System.Drawing.Point(470, 0);
+ this.btnClose.Name = "btnClose";
+ this.btnClose.Size = new System.Drawing.Size(30, 30);
+ this.btnClose.TabIndex = 1;
+ this.btnClose.TabStop = false;
+ this.btnClose.Text = "X";
+ this.btnClose.UseVisualStyleBackColor = false;
+ this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
+ //
+ // lblProg
+ //
+ this.lblProg.AutoSize = true;
+ this.lblProg.BackColor = System.Drawing.Color.DimGray;
+ this.lblProg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.lblProg.Font = new System.Drawing.Font("Lucida Console", 12F);
+ this.lblProg.ForeColor = System.Drawing.Color.White;
+ this.lblProg.Location = new System.Drawing.Point(12, 7);
+ this.lblProg.Name = "lblProg";
+ this.lblProg.Size = new System.Drawing.Size(118, 16);
+ this.lblProg.TabIndex = 0;
+ this.lblProg.Text = "ProgramName";
+ this.lblProg.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseDown);
+ this.lblProg.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseMove);
+ this.lblProg.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlTitle_MouseUp);
+ //
+ // pnlContent
+ //
+ this.pnlContent.BackColor = System.Drawing.Color.White;
+ this.pnlContent.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlContent.Location = new System.Drawing.Point(0, 30);
+ this.pnlContent.Name = "pnlContent";
+ this.pnlContent.Size = new System.Drawing.Size(500, 369);
+ this.pnlContent.TabIndex = 1;
+ //
+ // tmClose
+ //
+ this.tmClose.Interval = 1;
+ this.tmClose.Tick += new System.EventHandler(this.tmClose_Tick);
+ //
+ // tmOpen
+ //
+ this.tmOpen.Interval = 1;
+ this.tmOpen.Tick += new System.EventHandler(this.tmOpen_Tick);
+ //
+ // @base
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(500, 399);
+ this.Controls.Add(this.pnlContent);
+ this.Controls.Add(this.pnlTitle);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.Name = "@base";
+ this.Text = "base";
+ this.Activated += new System.EventHandler(this.base_Activated);
+ this.Deactivate += new System.EventHandler(this.base_Deactivate);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.base_FormClosing);
+ this.Load += new System.EventHandler(this.base_Load);
+ this.pnlTitle.ResumeLayout(false);
+ this.pnlTitle.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+ private System.Windows.Forms.Panel pnlTitle;
+ private System.Windows.Forms.Button btnMin;
+ private System.Windows.Forms.Button btnClose;
+ public System.Windows.Forms.Label lblProg;
+ public System.Windows.Forms.Panel pnlContent;
+ private System.Windows.Forms.Timer tmClose;
+ private System.Windows.Forms.Timer tmOpen;
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/PortEngine/WindowManager/base.cs b/PortEngine/WindowManager/base.cs
new file mode 100644
index 0000000..6a2a469
--- /dev/null
+++ b/PortEngine/WindowManager/base.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Amethyst
+{
+ public partial class @base : Form
+ {
+ bool drag;
+ int mousex;
+ int mousey;
+ public string rpcData;
+ public string rpcImage;
+ public @base()
+ {
+ InitializeComponent();
+ }
+
+ #region titlebar
+ private void btnMin_Click(object sender, EventArgs e)
+ {
+ WindowState = FormWindowState.Minimized;
+ }
+
+ private void btnClose_Click(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ private void pnlTitle_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (drag)
+ {
+ Top = Cursor.Position.Y - mousey;
+ Left = Cursor.Position.X - mousex;
+ }
+ }
+
+ private void pnlTitle_MouseDown(object sender, MouseEventArgs e)
+ {
+ drag = true;
+ mousex = Cursor.Position.X - Left;
+ mousey = Cursor.Position.Y - Top;
+ }
+
+ private void pnlTitle_MouseUp(object sender, MouseEventArgs e)
+ {
+ drag = false;
+ }
+ #endregion
+ #region timers
+ private void tmClose_Tick(object sender, EventArgs e)
+ {
+ Opacity -= 0.1;
+ if (Opacity == 0) Dispose();
+ }
+
+ private void tmOpen_Tick(object sender, EventArgs e)
+ {
+ Opacity += 0.1;
+ if (Opacity == 1) tmOpen.Enabled = false;
+ }
+ #endregion
+ #region closing
+ private void base_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (PortEngine.Properties.Settings.Default.graphicsFriendly == true) Dispose();
+ tmClose.Enabled = true;
+ e.Cancel = true;
+ }
+
+ private void base_Load(object sender, EventArgs e)
+ {
+ tmOpen.Enabled = true;
+ }
+ #endregion
+ #region inactive titlebars
+ private void base_Activated(object sender, EventArgs e)
+ {
+ if (PortEngine.Properties.Settings.Default.graphicsFriendly == true) return;
+ pnlTitle.BackColor = Color.White;
+ lblProg.ForeColor = SystemColors.ControlText;
+ lblProg.BackColor = pnlTitle.BackColor;
+ }
+
+ private void base_Deactivate(object sender, EventArgs e)
+ {
+ if (PortEngine.Properties.Settings.Default.graphicsFriendly == true) return;
+ pnlTitle.BackColor = Color.WhiteSmoke;
+ lblProg.ForeColor = SystemColors.ControlDark;
+ lblProg.BackColor = pnlTitle.BackColor;
+ }
+#endregion
+ }
+}
diff --git a/PortEngine/WindowManager/WM.resx b/PortEngine/WindowManager/base.resx
index 1af7de1..9c6fc6e 100644
--- a/PortEngine/WindowManager/WM.resx
+++ b/PortEngine/WindowManager/base.resx
@@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="tmClose.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="tmOpen.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>113, 17</value>
+ </metadata>
</root> \ No newline at end of file