aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/SkinEngine
diff options
context:
space:
mode:
authorMichael VanOverbeek <[email protected]>2016-07-25 12:57:52 -0400
committerGitHub <[email protected]>2016-07-25 12:57:52 -0400
commit46c1c31302f111a1f3ec23a70e6f3986a9aa2a27 (patch)
treef00af7ea3f6ad2641fb26fa1d310fd8b7179b39c /source/WindowsFormsApplication1/SkinEngine
parentaf48e774189596b8d7a058c564a7d6d75205ca03 (diff)
parent6fa16209519896de09949a27425dff00ebf2970a (diff)
downloadshiftos-c--46c1c31302f111a1f3ec23a70e6f3986a9aa2a27.tar.gz
shiftos-c--46c1c31302f111a1f3ec23a70e6f3986a9aa2a27.tar.bz2
shiftos-c--46c1c31302f111a1f3ec23a70e6f3986a9aa2a27.zip
Merge pull request #17 from MichaelTheShifter/shiftui_integration
Shiftui integration
Diffstat (limited to 'source/WindowsFormsApplication1/SkinEngine')
-rw-r--r--source/WindowsFormsApplication1/SkinEngine/ShiftOSColorTable.cs2
-rw-r--r--source/WindowsFormsApplication1/SkinEngine/WindowComposition.cs6
-rw-r--r--source/WindowsFormsApplication1/SkinEngine/skins.cs153
3 files changed, 93 insertions, 68 deletions
diff --git a/source/WindowsFormsApplication1/SkinEngine/ShiftOSColorTable.cs b/source/WindowsFormsApplication1/SkinEngine/ShiftOSColorTable.cs
index f74b7c2..fdf840b 100644
--- a/source/WindowsFormsApplication1/SkinEngine/ShiftOSColorTable.cs
+++ b/source/WindowsFormsApplication1/SkinEngine/ShiftOSColorTable.cs
@@ -4,7 +4,7 @@
// </auto-generated>
using System.Drawing;
-using System.Windows.Forms;
+using ShiftUI;
namespace ShiftOS
{
diff --git a/source/WindowsFormsApplication1/SkinEngine/WindowComposition.cs b/source/WindowsFormsApplication1/SkinEngine/WindowComposition.cs
index 18fe2d1..99fd813 100644
--- a/source/WindowsFormsApplication1/SkinEngine/WindowComposition.cs
+++ b/source/WindowsFormsApplication1/SkinEngine/WindowComposition.cs
@@ -5,7 +5,7 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Windows.Forms;
+using ShiftUI;
namespace ShiftOS
{
@@ -13,7 +13,7 @@ namespace ShiftOS
{
private static bool _CanClose = true;
public static bool ShuttingDown = false;
- public static bool SafeToAddControls = true;
+ public static bool SafeToAddWidgets = true;
public static bool CanClose
{
@@ -57,7 +57,7 @@ namespace ShiftOS
t.Start();
}
- public static void ScaleWidget(Control ctrl, int width, int height)
+ public static void ScaleWidget(Widget ctrl, int width, int height)
{
ctrl.Size = new Size(0, 0);
var t = new Timer();
diff --git a/source/WindowsFormsApplication1/SkinEngine/skins.cs b/source/WindowsFormsApplication1/SkinEngine/skins.cs
index 206646f..b9688ba 100644
--- a/source/WindowsFormsApplication1/SkinEngine/skins.cs
+++ b/source/WindowsFormsApplication1/SkinEngine/skins.cs
@@ -4,13 +4,26 @@ using Newtonsoft.Json;
using System;
using ShiftOS;
using System.IO.Compression;
-using System.Windows.Forms;
+using ShiftUI;
using System.Collections.Generic;
using System.Drawing.Imaging;
namespace Skinning
{
- public class Skin {
+ public class Skin : ShiftUI.ShiftOS.Skin
+ {
+ public Skin()
+ {
+ //We need to set our base skin settings here because the 'new' keyword
+ //hides the variable from ShiftUI.
+ base.ButtonBackColor_Pressed = this.ButtonBackColor_Pressed;
+ base.ProgressBar_BackgroundColor = this.ProgressBar_BackgroundColor;
+ }
+
+
+ public new Color ButtonBackColor_Pressed = Color.Black;
+
+ public new Color ProgressBar_BackgroundColor = Color.Black;
//Widget Positions
public string ALPosition = "Top";
public string PanelButtonPosition = "Top";
@@ -18,65 +31,65 @@ namespace Skinning
//WINDOW SETTINGS/IMAGES
//images
- public int titlebarlayout = 3;
- public int borderleftlayout = 3;
- public int borderrightlayout = 3;
- public int borderbottomlayout = 3;
- public int closebtnlayout = 3;
- public int rollbtnlayout = 3;
- public int minbtnlayout = 3;
- public int rightcornerlayout = 3;
- public int leftcornerlayout = 3;
+ public new int titlebarlayout = 3;
+ public new int borderleftlayout = 3;
+ public new int borderrightlayout = 3;
+ public new int borderbottomlayout = 3;
+ public new int closebtnlayout = 3;
+ public new int rollbtnlayout = 3;
+ public new int minbtnlayout = 3;
+ public new int rightcornerlayout = 3;
+ public new int leftcornerlayout = 3;
// Late entry: need to fix window code to include this
- public int bottomleftcornerlayout = 3;
- public int bottomrightcornerlayout = 3;
- public Color bottomleftcornercolour = Color.Gray;
+ public new int bottomleftcornerlayout = 3;
+ public new int bottomrightcornerlayout = 3;
+ public new Color bottomleftcornercolour = Color.Gray;
- public Color bottomrightcornercolour = Color.Gray;
+ public new Color bottomrightcornercolour = Color.Gray;
- public bool enablebordercorners = false;
+ public new bool enablebordercorners = false;
// settings
- public Size closebtnsize = new Size(22, 22);
- public Size rollbtnsize = new Size(22, 22);
- public Size minbtnsize = new Size(22, 22);
- public int titlebarheight = 30;
- public int titlebariconsize = 16;
- public int closebtnfromtop = 5;
- public int closebtnfromside = 2;
- public int rollbtnfromtop = 5;
- public int rollbtnfromside = 26;
- public int minbtnfromtop = 5;
- public int minbtnfromside = 52;
- public int borderwidth = 2;
- public bool enablecorners = false;
- public int titlebarcornerwidth = 5;
- public int titleiconfromside = 4;
- public int titleiconfromtop = 4;
+ public new Size closebtnsize = new Size(22, 22);
+ public new Size rollbtnsize = new Size(22, 22);
+ public new Size minbtnsize = new Size(22, 22);
+ public new int titlebarheight = 30;
+ public new int titlebariconsize = 16;
+ public new int closebtnfromtop = 5;
+ public new int closebtnfromside = 2;
+ public new int rollbtnfromtop = 5;
+ public new int rollbtnfromside = 26;
+ public new int minbtnfromtop = 5;
+ public new int minbtnfromside = 52;
+ public new int borderwidth = 2;
+ public new bool enablecorners = false;
+ public new int titlebarcornerwidth = 5;
+ public new int titleiconfromside = 4;
+ public new int titleiconfromtop = 4;
//colours
- public Color titlebarcolour = Color.Gray;
- public Color borderleftcolour = Color.Gray;
- public Color borderrightcolour = Color.Gray;
- public Color borderbottomcolour = Color.Gray;
- public Color closebtncolour = Color.Black;
- public Color closebtnhovercolour = Color.Black;
- public Color closebtnclickcolour = Color.Black;
- public Color rollbtncolour = Color.Black;
- public Color rollbtnhovercolour = Color.Black;
- public Color rollbtnclickcolour = Color.Black;
- public Color minbtncolour = Color.Black;
- public Color minbtnhovercolour = Color.Black;
- public Color minbtnclickcolour = Color.Black;
- public Color rightcornercolour = Color.Gray;
- public Color leftcornercolour = Color.Gray;
+ public new Color titlebarcolour = Color.Gray;
+ public new Color borderleftcolour = Color.Gray;
+ public new Color borderrightcolour = Color.Gray;
+ public new Color borderbottomcolour = Color.Gray;
+ public new Color closebtncolour = Color.Black;
+ public new Color closebtnhovercolour = Color.Black;
+ public new Color closebtnclickcolour = Color.Black;
+ public new Color rollbtncolour = Color.Black;
+ public new Color rollbtnhovercolour = Color.Black;
+ public new Color rollbtnclickcolour = Color.Black;
+ public new Color minbtncolour = Color.Black;
+ public new Color minbtnhovercolour = Color.Black;
+ public new Color minbtnclickcolour = Color.Black;
+ public new Color rightcornercolour = Color.Gray;
+ public new Color leftcornercolour = Color.Gray;
// Text
- public string titletextfontfamily = "Microsoft Sans Serif";
- public int titletextfontsize = 10;
- public FontStyle titletextfontstyle = FontStyle.Bold;
- public string titletextpos = "Left";
- public int titletextfromtop = 3;
- public int titletextfromside = 24;
-
- public Color titletextcolour = Color.White;
+ public new string titletextfontfamily = "Microsoft Sans Serif";
+ public new int titletextfontsize = 10;
+ public new FontStyle titletextfontstyle = FontStyle.Bold;
+ public new string titletextpos = "Left";
+ public new int titletextfromtop = 3;
+ public new int titletextfromside = 24;
+
+ public new Color titletextcolour = Color.White;
//DESKTOP
public Color desktoppanelcolour = Color.Gray;
public Color desktopbackgroundcolour = Color.Black;
@@ -561,33 +574,45 @@ namespace Skinning
/// </summary>
public static void loadskin()
{
- if(Directory.Exists(Paths.LoadedSkin))
+ try
{
- try {
+ if (Directory.Exists(Paths.LoadedSkin))
+ {
string rawData = File.ReadAllText(Paths.LoadedSkin + "data.json");
loadedSkin = JsonConvert.DeserializeObject<Skin>(rawData);
if (File.Exists(Paths.LoadedSkin + "panels.json"))
{
- string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json");
- loadedSkin.DesktopPanels = JsonConvert.DeserializeObject<List<DesktopPanel>>(panels);
- LoadPanels();
+ try
+ {
+ string panels = File.ReadAllText(Paths.LoadedSkin + "panels.json");
+ loadedSkin.DesktopPanels = JsonConvert.DeserializeObject<List<DesktopPanel>>(panels);
+ Application.LoadSkin(loadedSkin); //Send the skin to ShiftUI so buttons and stuff get rendered with custom colors.
+ LoadPanels();
+ }
+ catch
+ {
+
+ }
}
loadimages();
LoadEmbeddedNamePack();
+
}
- catch
+ else
{
- //No skin to load.
loadedSkin = new Skin();
+ Application.LoadSkin(loadedSkin);
loadedskin_images = new Images();
saveskin();
-
}
- } else
+ }
+ catch
{
loadedSkin = new Skin();
+ Application.LoadSkin(loadedSkin);
loadedskin_images = new Images();
saveskin();
+
}
}