From c81573594f509177214bbc9b64427c8aabdc30a6 Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 25 Nov 2017 08:59:48 -0700 Subject: Add SaveSystem, FullScreen Terminal and stuff Git had a horrible seizure and removed our repo but Alex-TIMEHACK helped us get it back. --- ShiftOS.Engine/UI/ShiftButton.Designer.cs | 11 +-- ShiftOS.Engine/UI/ShiftButton.cs | 60 +++++++++++++-- ShiftOS.Engine/UI/ShiftButton.resx | 123 ++++++++++++++++++++++++++++++ ShiftOS.Engine/UI/ShiftStripRenderer.cs | 21 +++++ 4 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 ShiftOS.Engine/UI/ShiftButton.resx create mode 100644 ShiftOS.Engine/UI/ShiftStripRenderer.cs (limited to 'ShiftOS.Engine/UI') diff --git a/ShiftOS.Engine/UI/ShiftButton.Designer.cs b/ShiftOS.Engine/UI/ShiftButton.Designer.cs index a84ba4a..c746a5e 100644 --- a/ShiftOS.Engine/UI/ShiftButton.Designer.cs +++ b/ShiftOS.Engine/UI/ShiftButton.Designer.cs @@ -2,7 +2,7 @@ { partial class ShiftButton { - /// + /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; @@ -22,14 +22,15 @@ #region Component Designer generated code - /// - /// Required method for Designer support - do not modify + /// + /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.SuspendLayout(); + this.ResumeLayout(false); + } #endregion diff --git a/ShiftOS.Engine/UI/ShiftButton.cs b/ShiftOS.Engine/UI/ShiftButton.cs index ebf6e2b..8e4104d 100644 --- a/ShiftOS.Engine/UI/ShiftButton.cs +++ b/ShiftOS.Engine/UI/ShiftButton.cs @@ -1,8 +1,6 @@ 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; @@ -10,11 +8,63 @@ using System.Windows.Forms; namespace ShiftOS.Engine.UI { - public partial class ShiftButton : UserControl + public partial class ShiftButton : Button { - public ShiftButton() + private static Font _normalFont = new Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + + private static Color _back = System.Drawing.Color.Black; + private static Color _border = System.Drawing.Color.White; + private static Color _activeBorder = System.Drawing.Color.Black; + private static Color _fore = System.Drawing.Color.Black; + private static Padding _margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + private static Padding _padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + + private static Size _minSize = new System.Drawing.Size(75, 23); + + private bool _active; + + public ShiftButton(): base() + { + base.Font = _normalFont; + base.BackColor = _border; + base.ForeColor = _fore; + base.FlatAppearance.BorderColor = _back; + base.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + base.Margin = _margin; + base.Padding = _padding; + base.MinimumSize = _minSize; + } + + protected override void OnControlAdded(ControlEventArgs e) + { + base.OnControlAdded(e); + UseVisualStyleBackColor = false; + } + + protected override void OnMouseEnter(System.EventArgs e) + { + base.OnMouseEnter(e); + if (!_active) + base.FlatAppearance.BorderColor = _activeBorder; + } + + protected override void OnMouseLeave(System.EventArgs e) + { + base.OnMouseLeave(e); + if (!_active) + base.FlatAppearance.BorderColor = _border; + } + + public void SetStateActive() + { + _active = true; + base.FlatAppearance.BorderColor = _activeBorder; + } + + public void SetStateNormal() { - InitializeComponent(); + _active = false; + base.FlatAppearance.BorderColor = _border; } } } diff --git a/ShiftOS.Engine/UI/ShiftButton.resx b/ShiftOS.Engine/UI/ShiftButton.resx new file mode 100644 index 0000000..e5858cc --- /dev/null +++ b/ShiftOS.Engine/UI/ShiftButton.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/ShiftOS.Engine/UI/ShiftStripRenderer.cs b/ShiftOS.Engine/UI/ShiftStripRenderer.cs new file mode 100644 index 0000000..7b8498f --- /dev/null +++ b/ShiftOS.Engine/UI/ShiftStripRenderer.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.Engine.UI +{ + public class ShiftStripRenderer : ToolStripProfessionalRenderer + { + protected override void OnRenderLabelBackground(ToolStripItemRenderEventArgs e) + { + using (var b = new SolidBrush(e.Item.BackColor)) + { + e.Graphics.FillRectangle(b, new Rectangle(Point.Empty, e.Item.Size)); + } + } + } +} -- cgit v1.2.3