diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index c2f47fa..f5dd211 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -37,42 +37,71 @@ using System.Reflection;
using ShiftOS.Engine.Scripting;
namespace ShiftOS.Engine
{
-
+ ///
+ /// Skinning API for Lua.
+ ///
[Exposed("skinning")]
public class SkinFunctions
{
+ ///
+ /// Reload the current skin.
+ ///
public void loadSkin()
{
SkinEngine.LoadSkin();
}
+ ///
+ /// Get the current skin info.
+ ///
+ /// A proxy object containing all skin variables.
public dynamic getSkin()
{
return SkinEngine.LoadedSkin;
}
+ ///
+ /// Set the current skin to the specified class.
+ ///
+ /// The class to load.
public void setSkin(Skin skn)
{
Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(skn));
SkinEngine.LoadSkin();
}
+ ///
+ /// Retrieves an image from the skin file.
+ ///
+ /// The skin image ID
+ /// The loaded image, null (nil in Lua) if none is found.
public dynamic getImage(string id)
{
return SkinEngine.GetImage(id);
}
}
-
+ ///
+ /// Skin engine management class.
+ ///
public static class SkinEngine
{
private static ISkinPostProcessor processor = null;
+ ///
+ /// Load a new skin postprocessor into the engine.
+ ///
+ /// The postprocessor to load.
public static void SetPostProcessor(ISkinPostProcessor _processor)
{
processor = _processor;
}
+ ///
+ /// Retrieve the user-specified image layout of a skin image.
+ ///
+ /// The skin image ID.
+ /// The for the image.
public static ImageLayout GetImageLayout(string img)
{
if (LoadedSkin.SkinImageLayouts.ContainsKey(img))
@@ -86,6 +115,11 @@ namespace ShiftOS.Engine
}
}
+ ///
+ /// Retrieves an image from the skin after postprocessing it.
+ ///
+ /// The image ID to search.
+ /// The post-processed image, or null if none was found.
public static System.Drawing.Image GetImage(string img)
{
var type = typeof(Skin);
@@ -111,11 +145,20 @@ namespace ShiftOS.Engine
return null;
}
+ ///
+ /// Set the engine's current icon prober.
+ ///
+ /// The icon prober to use.
public static void SetIconProber(IIconProber prober)
{
_iconProber = prober;
}
+ ///
+ /// Load a from a array.
+ ///
+ /// The array to convert
+ /// The resulting image.
public static Image ImageFromBinary(byte[] image)
{
if (image == null)
@@ -126,6 +169,9 @@ namespace ShiftOS.Engine
private static Skin loadedSkin = new Skin();
+ ///
+ /// Gets the currently loaded skin.
+ ///
public static Skin LoadedSkin
{
get
@@ -138,6 +184,9 @@ namespace ShiftOS.Engine
}
}
+ ///
+ /// Initiates the skin engine.
+ ///
public static void Init()
{
Application.ApplicationExit += (o, a) =>
@@ -160,8 +209,14 @@ namespace ShiftOS.Engine
}
}
+ ///
+ /// Occurs when the skin is loaded.
+ ///
public static event EmptyEventHandler SkinLoaded;
+ ///
+ /// Reload the current skin.
+ ///
public static void LoadSkin()
{
LoadedSkin = JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.GetPath("skin.json")));
@@ -170,6 +225,9 @@ namespace ShiftOS.Engine
Desktop.PopulateAppLauncher();
}
+ ///
+ /// Save the skin loaded in memory to the filesystem.
+ ///
public static void SaveSkin()
{
Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin, Formatting.Indented));
@@ -177,6 +235,11 @@ namespace ShiftOS.Engine
private static IIconProber _iconProber = null;
+ ///
+ /// Retrieves the default icon for a given icon ID.
+ ///
+ /// The icon ID to search.
+ /// The resulting icon image.
public static Image GetDefaultIcon(string id)
{
if (_iconProber == null)
@@ -213,6 +276,11 @@ namespace ShiftOS.Engine
}
}
+ ///
+ /// Retrieves the user-defined icon for a specified icon ID.
+ ///
+ /// The icon ID to search.
+ /// The resulting icon image.
public static Image GetIcon(string id)
{
if (!LoadedSkin.AppIcons.ContainsKey(id))
@@ -231,11 +299,23 @@ namespace ShiftOS.Engine
}
}
+ ///
+ /// Interface for probing app icons.
+ ///
public interface IIconProber
{
+ ///
+ /// Retrieve the icon image from a .
+ ///
+ /// The attribute data
+ /// The resulting image.
Image GetIcon(DefaultIconAttribute attr);
}
+ ///
+ /// Sets the default icon ID for a .
+ ///
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple =false)]
public class DefaultIconAttribute : Attribute
{
public DefaultIconAttribute(string id)
@@ -246,6 +326,9 @@ namespace ShiftOS.Engine
public string ID { get; private set; }
}
+ ///
+ /// The data stored in any .skn file.
+ ///
public class Skin
{
//borrowing from the discourse theme for the default skin
@@ -1372,6 +1455,9 @@ namespace ShiftOS.Engine
public Font AdvALItemFont = SysFont2;
}
+ ///
+ /// Marks a skin spec field as hidden from the Shifter.
+ ///
public class ShifterHiddenAttribute : Attribute
{