diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-13 07:57:29 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-13 08:19:53 +0100 |
| commit | 0efa7446134489edd303b349ae1220f1c4228e9a (patch) | |
| tree | 3f7100d5bb31504c6971661de7da509e3b17be26 /src/Interface.cs | |
| parent | 688cd87004569c122bf19c127699c5b034492528 (diff) | |
styling is no longer static in iface to allow different styling context between ifaces
Diffstat (limited to 'src/Interface.cs')
| -rw-r--r-- | src/Interface.cs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Interface.cs b/src/Interface.cs index d4cc63c4..03ea9308 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -76,7 +76,6 @@ namespace Crow Directory.CreateDirectory (CrowConfigRoot); loadCursors (); - loadStyling (); findAvailableTemplates (); FontRenderingOptions = new FontOptions (); @@ -88,7 +87,7 @@ namespace Crow public Interface(){ CurrentInterface = this; CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - + loadStyling (); initTooltip (); } #endregion @@ -204,11 +203,11 @@ namespace Crow /// The compilation is done on the first object instancing, and is also done for custom widgets public delegate void LoaderInvoker(object instance); /// <summary>Store one loader per StyleKey</summary> - public static Dictionary<String, LoaderInvoker> DefaultValuesLoader = new Dictionary<string, LoaderInvoker>(); + public Dictionary<String, LoaderInvoker> DefaultValuesLoader = new Dictionary<string, LoaderInvoker>(); /// <summary>Store dictionnary of member/value per StyleKey</summary> - public static Dictionary<string, Style> Styling; + public Dictionary<string, Style> Styling; /// <summary> parse all styling data's during application startup and build global Styling Dictionary </summary> - static void loadStyling() { + protected virtual void loadStyling() { Styling = new Dictionary<string, Style> (); //fetch styling info in this order, if member styling is alreadey referenced in previous @@ -217,14 +216,16 @@ namespace Crow loadStylingFromAssembly (Assembly.GetExecutingAssembly ()); } /// <summary> Search for .style resources in assembly </summary> - static void loadStylingFromAssembly (Assembly assembly) { + void loadStylingFromAssembly (Assembly assembly) { if (assembly == null) return; foreach (string s in assembly .GetManifestResourceNames () .Where (r => r.EndsWith (".style", StringComparison.OrdinalIgnoreCase))) { - new StyleReader (assembly, s) - .Dispose (); + using (Stream stream = assembly.GetManifestResourceStream (s)) { + new StyleReader (this, stream, s); + } + } } static void loadCursors(){ |