From 4534ff6252d2cd442d2180b024a94db1f4379f41 Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Sun, 19 Nov 2017 10:21:34 -0600 Subject: [PATCH] Added new extremely buggy ShiftButton. --- .../ShiftFS/FileGUI/FileOpener.Designer.cs | 48 +++++++ ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.cs | 26 ++++ .../ShiftFS/FileGUI/FileOpener.resx | 120 +++++++++++++++++ ShiftOS.Engine/ShiftOS.Engine.csproj | 15 +++ ShiftOS.Engine/UI/ShiftButton.Designer.cs | 36 +++++ ShiftOS.Engine/UI/ShiftButton.cs | 55 ++++++++ .../WindowManager/InfoboxTemplate.cs | 3 +- ShiftOS.Engine/WindowManager/ShiftButton.resx | 126 ++++++++++++++++++ ShiftOS.Main/ShiftOS/Apps/TextPad.cs | 6 +- 9 files changed, 433 insertions(+), 2 deletions(-) create mode 100644 ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.Designer.cs create mode 100644 ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.cs create mode 100644 ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.resx create mode 100644 ShiftOS.Engine/UI/ShiftButton.Designer.cs create mode 100644 ShiftOS.Engine/UI/ShiftButton.cs create mode 100644 ShiftOS.Engine/WindowManager/ShiftButton.resx diff --git a/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.Designer.cs b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.Designer.cs new file mode 100644 index 0000000..7eca5d3 --- /dev/null +++ b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.Designer.cs @@ -0,0 +1,48 @@ +namespace ShiftOS.Engine.ShiftFS.FileGUI +{ + partial class FileOpener + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + + this.SuspendLayout(); + // + // FileOpener + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "FileOpener"; + this.Size = new System.Drawing.Size(368, 283); + this.ResumeLayout(false); + + } + + #endregion + + + } +} diff --git a/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.cs b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.cs new file mode 100644 index 0000000..1947f6f --- /dev/null +++ b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.cs @@ -0,0 +1,26 @@ +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 ShiftOS.Engine.ShiftFS.FileGUI +{ + public partial class FileOpener : UserControl + { + public FileOpener() + { + InitializeComponent(); + + } + + private void shiftButton1_Click(object sender, EventArgs e) + { + MessageBox.Show("yay"); + } + } +} diff --git a/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.resx b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Engine/ShiftFS/FileGUI/FileOpener.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index 88ad0cf..aa9d370 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -63,6 +63,12 @@ True Resources.resx + + UserControl + + + FileOpener.cs + @@ -70,6 +76,12 @@ + + Component + + + ShiftButton.cs + UserControl @@ -91,6 +103,9 @@ Resources.Designer.cs Designer + + FileOpener.cs + InfoboxTemplate.cs diff --git a/ShiftOS.Engine/UI/ShiftButton.Designer.cs b/ShiftOS.Engine/UI/ShiftButton.Designer.cs new file mode 100644 index 0000000..c744a90 --- /dev/null +++ b/ShiftOS.Engine/UI/ShiftButton.Designer.cs @@ -0,0 +1,36 @@ +namespace ShiftOS.Engine.UI +{ + partial class ShiftButton + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// 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(); + } + + #endregion + } +} diff --git a/ShiftOS.Engine/UI/ShiftButton.cs b/ShiftOS.Engine/UI/ShiftButton.cs new file mode 100644 index 0000000..a025a40 --- /dev/null +++ b/ShiftOS.Engine/UI/ShiftButton.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.Engine.UI +{ + public partial class ShiftButton : Control, IButtonControl + { + private bool _pressing = false; + private Color _lightBack; + public ShiftButton() + { + InitializeComponent(); + } + + public DialogResult DialogResult { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public void NotifyDefault(bool value) + { + + } + + public void PerformClick() + { + this.OnClick(new EventArgs()); + } + + protected override void OnPaint(PaintEventArgs pe) + { + base.OnPaint(pe); + this.Font = new Font("Lucida Console", 9, FontStyle.Regular); + _lightBack = Color.WhiteSmoke; + var g = pe.Graphics; + g.Clear(BackColor); + g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; + var sf = new StringFormat(); + + if (_pressing) + { + g.FillRectangle(new SolidBrush(Color.White), 0, 0, Width, Height); + g.DrawString(Text, Font, new SolidBrush(Color.Black), ((Width / 2) + 1), (Height / 2) + 1); + } + else + { + g.FillRectangle(new SolidBrush(Color.WhiteSmoke), 0, 0, Width, Height); + } + } + } +} diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index c2b45e0..16e84eb 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -4,6 +4,7 @@ using System.IO; using System.Media; using System.Windows.Forms; using ShiftOS.Engine.Properties; +using ShiftOS.Engine.UI; namespace ShiftOS.Engine.WindowManager { @@ -31,7 +32,7 @@ namespace ShiftOS.Engine.WindowManager public InfoboxTemplate(ButtonType type) { InitializeComponent(); - + switch (type) { case ButtonType.Ok: diff --git a/ShiftOS.Engine/WindowManager/ShiftButton.resx b/ShiftOS.Engine/WindowManager/ShiftButton.resx new file mode 100644 index 0000000..aa2bacc --- /dev/null +++ b/ShiftOS.Engine/WindowManager/ShiftButton.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + False + + \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs index e86b1be..66863cf 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs @@ -1,4 +1,6 @@ -using System; +using ShiftOS.Engine.ShiftFS.FileGUI; +using ShiftOS.Engine.WindowManager; +using System; using System.IO; using System.Windows.Forms; @@ -31,6 +33,8 @@ namespace ShiftOS.Main.ShiftOS.Apps { MessageBox.Show("yay it works"); } + var f = new FileOpener(); + ShiftWM.Init(f, "testing", null); } } } \ No newline at end of file