diff options
Diffstat (limited to 'source/WindowsFormsApplication1/SkinEngine/skins.cs')
| -rw-r--r-- | source/WindowsFormsApplication1/SkinEngine/skins.cs | 153 |
1 files changed, 89 insertions, 64 deletions
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(); + } } |
