diff options
author | Dominique Louis <savagesoftware@gmail.com> | 2018-11-21 22:26:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-21 22:26:02 +0300 |
commit | 9ea098e431e87513f474c21553b3de6f90678cd1 (patch) | |
tree | 7a5d3986199601a07ad6f56da4172d8f714123d0 /Xamarin.PropertyEditing.Mac/Controls/Custom | |
parent | 5d37b3781eb51eec5d327549517d152fb805db9a (diff) | |
parent | 9cfabf3e7d9519c6bda661876308aefe8fd2b04d (diff) |
Merge pull request #454 from xamarin/dominique-FixBrushIconsNotAppearing
[Mac] Fixes 443. Only place where theming image isn't used initially.…
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs | 45 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs | 5 |
2 files changed, 28 insertions, 22 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs index 3ad981d..37b8e4a 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs @@ -78,11 +78,11 @@ namespace Xamarin.PropertyEditing.Mac continue;
}
- var item = new NSTabViewItem (); - item.Label = kvp.Key;
+ var item = new NSTabViewItem { + Label = kvp.Key + }; - var themeManager = PropertyEditorPanel.ThemeManager;
- NSImage image; + string image; switch (kvp.Value) { case CommonBrushType.Solid: @@ -90,40 +90,45 @@ namespace Xamarin.PropertyEditing.Mac solid.ViewModel = ViewModel; item.ViewController = solid; item.ToolTip = Properties.Resources.SolidBrush; - image = themeManager.GetImageForTheme ("property-brush-solid-16"); - break; + image = "property-brush-solid-16"; + break;
+ case CommonBrushType.MaterialDesign: var material = new MaterialBrushEditorViewController (); material.ViewModel = ViewModel; item.ViewController = material; item.ToolTip = Properties.Resources.MaterialDesignColorBrush; - image = themeManager.GetImageForTheme ("property-brush-palette-16"); - break; + image = "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; - image = themeManager.GetImageForTheme ("property-brush-resources-16"); - break; + image = "property-brush-resources-16";
+ break;
+ case CommonBrushType.Gradient: var gradient = new EmptyBrushEditorViewController (); gradient.ViewModel = ViewModel; item.ViewController = gradient; item.ToolTip = item.Label; - image = themeManager.GetImageForTheme ("property-brush-gradient-16"); - break; + image = "property-brush-gradient-16";
+ break;
+ default: - case CommonBrushType.NoBrush: - var none = new EmptyBrushEditorViewController (); - none.ViewModel = ViewModel; - item.ViewController = none; - item.ToolTip = Properties.Resources.NoBrush; - image = themeManager.GetImageForTheme ("property-brush-none-16"); - break; + case CommonBrushType.NoBrush: + var none = new EmptyBrushEditorViewController (); + none.ViewModel = ViewModel; + item.ViewController = none; + item.ToolTip = Properties.Resources.NoBrush; + image = "property-brush-none-16";
+ break; }
+
if (image != null) { - item.Image = image; + item.Identifier = new NSString (image); // Using the Identifier object, to avoid unused NSImage creation when selection happens in GetView () }
InsertTabViewItem (item, i); diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs index b779ed4..4cff17e 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs @@ -1,6 +1,7 @@ using System;
using System.Linq; using AppKit; +using Foundation; namespace Xamarin.PropertyEditing.Mac { @@ -108,8 +109,8 @@ namespace Xamarin.PropertyEditing.Mac private NSView GetView (NSTabViewItem item)
{
NSView tabView;
- if (item.Image != null) {
- tabView = new UnderlinedImageView (item.Image.Name) {
+ if (item.Identifier != null) {
+ tabView = new UnderlinedImageView ((item.Identifier as NSString).ToString()) {
Selected = this.tabStack.Views.Length == SelectedTabViewItemIndex,
ToolTip = item.ToolTip
};
|