Adding basic skinning

Open up the shifter, choose a skin and hit Apply. I
ll work on it more later.
This commit is contained in:
AShifter 2017-10-03 20:44:54 -06:00
parent eb54509f16
commit 385d800066
7 changed files with 137 additions and 44 deletions

Binary file not shown.

View file

@ -59,7 +59,7 @@
<Compile Include="WindowManager\InfoboxTemplate.Designer.cs">
<DependentUpon>InfoboxTemplate.cs</DependentUpon>
</Compile>
<Compile Include="WindowManager\ShiftArray.cs" />
<Compile Include="WindowManager\ShiftSkinData.cs" />
<Compile Include="WindowManager\ShiftWindow.cs">
<SubType>Form</SubType>
</Compile>

View file

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS.Engine.WindowManager
{
class ShiftArray
{
}
}

View file

@ -0,0 +1,34 @@
using System.Drawing;
namespace ShiftOS.Engine.WindowManager
{
public class ShiftSkinData
{
// ColorData
public Color leftTopCornerColor { get; set; }
public Color titleBarColor { get; set; }
public Color rightTopCornerColor { get; set; }
public Color btnCloseColor { get; set; }
public Color btnMaxColor { get; set; }
public Color btnMinColor { get; set; }
public Color leftSideColor { get; set; }
public Color rightSideColor { get; set; }
public Color leftBottomCornerColor { get; set; }
public Color bottomSideColor { get; set; }
public Color rightBottomCornerColor { get; set; }
public Color borderColorColor { get; set; }
// SetBorderColor
public void setBorderColor(Color borderColor)
{
leftTopCornerColor = borderColor;
titleBarColor = borderColor;
rightTopCornerColor = borderColor;
leftSideColor = borderColor;
rightSideColor = borderColor;
leftBottomCornerColor = borderColor;
bottomSideColor = borderColor;
rightBottomCornerColor = borderColor;
}
}
}

View file

@ -17,7 +17,7 @@ namespace ShiftOS.Main.ShiftOS.Apps
}
private Color btnSetColor_Click(object sender, EventArgs e)
private Color setColor()
{
_colorType1 = Int32.Parse(redUpDown.Value.ToString());
_colorType2 = Int32.Parse(greenUpDown.Value.ToString());
@ -41,5 +41,10 @@ namespace ShiftOS.Main.ShiftOS.Apps
}
return _finalColor;
}
private void btnSetColor_Click(object sender, EventArgs e)
{
setColor();
}
}
}

View file

@ -30,11 +30,13 @@
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -55,6 +57,8 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.button5);
this.tabPage1.Controls.Add(this.button4);
this.tabPage1.Controls.Add(this.button3);
this.tabPage1.Controls.Add(this.button2);
this.tabPage1.Controls.Add(this.groupBox1);
@ -66,6 +70,54 @@
this.tabPage1.Text = "Titlebar";
this.tabPage1.UseVisualStyleBackColor = true;
//
// button5
//
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button5.Location = new System.Drawing.Point(6, 267);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(314, 23);
this.button5.TabIndex = 5;
this.button5.Text = "Apply";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button4.Location = new System.Drawing.Point(6, 209);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(314, 23);
this.button4.TabIndex = 4;
this.button4.Text = "Set Random Skin";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.setRandomSkin);
//
// button3
//
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button3.Location = new System.Drawing.Point(6, 238);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(155, 23);
this.button3.TabIndex = 3;
this.button3.Text = "Set Default Skin";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.setDefaultSkin);
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button2.Location = new System.Drawing.Point(171, 238);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(149, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Set Colorful Skin";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.setColorSkin);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
@ -98,30 +150,6 @@
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button2.Location = new System.Drawing.Point(171, 267);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(149, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Set Colorful Skin";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.button3.Location = new System.Drawing.Point(6, 267);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(149, 23);
this.button3.TabIndex = 3;
this.button3.Text = "Set Default Skin";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Shifter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -145,5 +173,7 @@
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
}
}

View file

@ -2,12 +2,14 @@
using System.Windows.Forms;
using ShiftOS.Engine;
using ShiftOS.Engine.WindowManager;
using System.Drawing;
namespace ShiftOS.Main.ShiftOS.Apps
{
public partial class Shifter : UserControl
{
public int colorType; //This is a check to see what option was chosen.
ShiftSkinData skinConfig = new ShiftSkinData();
public Shifter()
{
InitializeComponent();
@ -19,14 +21,48 @@ namespace ShiftOS.Main.ShiftOS.Apps
ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon());
}
private void button3_Click(object sender, EventArgs e)
private void setDefaultSkin(object sender, EventArgs e)
{
skinConfig.setBorderColor(Color.FromArgb(64, 64, 64));
skinConfig.btnCloseColor = Color.Black;
skinConfig.btnMaxColor = Color.Black;
skinConfig.btnMinColor = Color.Black;
}
private void button2_Click(object sender, EventArgs e)
private void setColorSkin(object sender, EventArgs e)
{
skinConfig.setBorderColor(Color.Blue);
skinConfig.btnCloseColor = Color.Red;
skinConfig.btnMaxColor = Color.Yellow;
skinConfig.btnMinColor = Color.Green;
}
private void setRandomSkin(object sender, EventArgs e)
{
Random rnd = new Random();
skinConfig.setBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
skinConfig.btnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
skinConfig.btnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
skinConfig.btnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
}
private void button5_Click(object sender, EventArgs e)
{
foreach (var window in ShiftWM.Windows)
{
window.Invoke(new Action(() => window.top.BackColor = skinConfig.titleBarColor));
window.Invoke(new Action(() => window.topleftcorner.BackColor = skinConfig.leftTopCornerColor));
window.Invoke(new Action(() => window.toprightcorner.BackColor = skinConfig.rightTopCornerColor));
window.Invoke(new Action(() => window.left.BackColor = skinConfig.leftSideColor));
window.Invoke(new Action(() => window.right.BackColor = skinConfig.rightSideColor));
window.Invoke(new Action(() => window.bottomleftcorner.BackColor = skinConfig.leftBottomCornerColor));
window.Invoke(new Action(() => window.bottom.BackColor = skinConfig.bottomSideColor));
window.Invoke(new Action(() => window.bottomrightcorner.BackColor = skinConfig.rightBottomCornerColor));
window.Invoke(new Action(() => window.closebutton.BackColor = skinConfig.btnCloseColor));
window.Invoke(new Action(() => window.maximizebutton.BackColor = skinConfig.btnMaxColor));
window.Invoke(new Action(() => window.minimizebutton.BackColor = skinConfig.btnMinColor));
}
}
}
}