aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Interface.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-13 07:57:29 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-13 08:19:53 +0100
commit0efa7446134489edd303b349ae1220f1c4228e9a (patch)
tree3f7100d5bb31504c6971661de7da509e3b17be26 /src/Interface.cs
parent688cd87004569c122bf19c127699c5b034492528 (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.cs17
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(){