diff options
author | Bertrand Le Roy <beleroy@microsoft.com> | 2018-10-18 02:34:07 +0300 |
---|---|---|
committer | Bertrand Le Roy <beleroy@microsoft.com> | 2018-10-18 02:34:55 +0300 |
commit | 049ba20207f60d55dd22ebe1879400cf4808fe2f (patch) | |
tree | 6f029a41690f3ba0bbca2195ecdd83eac807e94b | |
parent | 5e75201231027688847d873ee50dd5eb7296c771 (diff) |
Use theme manager to retrieve icons from brush tab view controller, and make the code more resilient to missing icons.
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs index b8f58fd..a8d021f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs @@ -64,7 +64,10 @@ namespace Xamarin.PropertyEditing.Mac }
var item = new NSTabViewItem (); - item.Label = kvp.Key; + item.Label = kvp.Key;
+
+ var themeManager = PropertyEditorPanel.ThemeManager;
+ NSImage image; switch (kvp.Value) { case CommonBrushType.Solid: @@ -72,28 +75,28 @@ namespace Xamarin.PropertyEditing.Mac solid.ViewModel = ViewModel; item.ViewController = solid; item.ToolTip = Properties.Resources.SolidBrush; - item.Image = NSImage.ImageNamed ("property-brush-solid-16"); + image = themeManager.GetImageForTheme ("property-brush-solid-16"); break; case CommonBrushType.MaterialDesign: var material = new MaterialBrushEditorViewController (); material.ViewModel = ViewModel; item.ViewController = material; item.ToolTip = Properties.Resources.MaterialDesignColorBrush; - item.Image = NSImage.ImageNamed ("property-brush-palette-16"); + image = themeManager.GetImageForTheme ("property-brush-palette-16"); break; case CommonBrushType.Resource: this.resource = new ResourceBrushViewController (); this.resource.ViewModel = ViewModel; item.ViewController = this.resource; item.ToolTip = Properties.Resources.ResourceBrush; - item.Image = NSImage.ImageNamed ("property-brush-resources-16"); + image = themeManager.GetImageForTheme ("property-brush-resources-16"); break; case CommonBrushType.Gradient: var gradient = new EmptyBrushEditorViewController (); gradient.ViewModel = ViewModel; item.ViewController = gradient; item.ToolTip = item.Label; - item.Image = NSImage.ImageNamed ("property-brush-gradient-16"); + image = themeManager.GetImageForTheme ("property-brush-gradient-16"); break; default: case CommonBrushType.NoBrush: @@ -101,9 +104,12 @@ namespace Xamarin.PropertyEditing.Mac none.ViewModel = ViewModel; item.ViewController = none; item.ToolTip = Properties.Resources.NoBrush; - item.Image = NSImage.ImageNamed ("property-brush-none-16"); + image = themeManager.GetImageForTheme ("property-brush-none-16"); break; }
+ if (image != null) { + item.Image = image; + }
InsertTabViewItem (item, i); } |