From 82de84638ab857512181d5ed4ad0b5010bca1213 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 6 Feb 2017 20:15:22 -0500 Subject: Icon backend :D --- ShiftOS_TheReturn/AppearanceManager.cs | 7 +++++++ ShiftOS_TheReturn/Skinning.cs | 30 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'ShiftOS_TheReturn') diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 112bca5..dc88092 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -76,6 +76,11 @@ namespace ShiftOS.Engine } } + public static void SetWindowTitle(IShiftOSWindow window, string title) + { + winmgr.SetTitle(window, title); + } + public static IEnumerable GetAllWindowTypes() { List types = new List(); @@ -231,6 +236,8 @@ namespace ShiftOS.Engine public abstract void SetupDialog(IShiftOSWindow win); public abstract void InvokeAction(Action act); + + public abstract void SetTitle(IShiftOSWindow win, string title); } public interface IWindowBorder diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 3b618c1..d155688 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -112,6 +112,23 @@ namespace ShiftOS.Engine { public static void SaveSkin() { Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin, Formatting.Indented)); } + + public static Image GetIcon(string id) + { + if (!LoadedSkin.AppIcons.ContainsKey(id)) + LoadedSkin.AppIcons.Add(id, null); + + if (LoadedSkin.AppIcons[id] == null) + return new Bitmap(16, 16); + else + { + using (var sr = new MemoryStream(LoadedSkin.AppIcons[id])) + { + return Image.FromStream(sr); + } + } + + } } public class Skin { @@ -138,7 +155,11 @@ namespace ShiftOS.Engine { } [ShifterHidden] - public Dictionary AppNames = new Dictionary(); + public Dictionary AppNames = new Dictionary(); + + [ShifterHidden] + public Dictionary AppIcons = new Dictionary(); + [ShifterMeta("Windows")] [ShifterCategory("Titlebar")] @@ -914,6 +935,13 @@ namespace ShiftOS.Engine { //we DO NOT want this showing in the shifter. [ShifterHidden] public Dictionary SkinImageLayouts = new Dictionary(); + + [ShifterMeta("Windows")] + [ShifterCategory("Titlebar")] + [ShifterName("App icon from side")] + [ShifterDescription("How far from the side should the icon be?")] + [RequiresUpgrade("shift_titlebar;app_icons")] + public Point TitlebarIconFromSide = new Point(4,4); } public class ShifterHiddenAttribute : Attribute { -- cgit v1.2.3