From cd255b7d79b01ed7d288915dc751d48306f0d9cb Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Jul 2018 15:31:19 -0500 Subject: Improve the selection icons and the material property icon --- .../Controls/Custom/BrushTabViewController.cs | 2 +- .../Controls/Custom/UnderlinedTabViewController.cs | 46 +++++++++++++++------ .../Controls/Custom/UnderlinedTextField.cs | 15 +++---- .../Resources/property-brush-gradient-16~sel.png | Bin 137 -> 535 bytes .../property-brush-gradient-16~sel@2x.png | Bin 225 -> 712 bytes .../Resources/property-brush-image-16~sel.png | Bin 166 -> 602 bytes .../Resources/property-brush-none-16~sel.png | Bin 126 -> 547 bytes .../Resources/property-brush-palette-16.png | Bin 0 -> 191 bytes .../Resources/property-brush-palette-16@2x.png | Bin 0 -> 349 bytes .../Resources/property-brush-palette-16~dark.png | Bin 0 -> 188 bytes .../property-brush-palette-16~dark@2x.png | Bin 0 -> 344 bytes .../property-brush-palette-16~dark~sel.png | Bin 0 -> 188 bytes .../property-brush-palette-16~dark~sel@2x.png | Bin 0 -> 344 bytes .../Resources/property-brush-palette-16~sel.png | Bin 0 -> 191 bytes .../Resources/property-brush-palette-16~sel@2x.png | Bin 0 -> 349 bytes .../Resources/property-brush-resources-16~sel.png | Bin 110 -> 515 bytes .../property-brush-resources-16~sel@2x.png | Bin 138 -> 623 bytes .../Resources/property-brush-solid-16~sel.png | Bin 104 -> 495 bytes .../Resources/property-brush-solid-16~sel@2x.png | Bin 124 -> 564 bytes .../Xamarin.PropertyEditing.Mac.csproj | 8 ++++ 20 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16@2x.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark@2x.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel@2x.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel.png create mode 100644 Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel@2x.png diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs index c9f04d6..87242df 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs @@ -48,7 +48,7 @@ namespace Xamarin.PropertyEditing.Mac var material = new MaterialBrushEditorViewController (); material.ViewModel = ViewModel; item.ViewController = material; - item.Image = NSImage.ImageNamed ("property-brush-none-16"); + item.Image = NSImage.ImageNamed ("property-brush-palette-16"); break; case CommonBrushType.Resource: var resource = new ResourceBrushViewController (); diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs index 3526287..ca6a829 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs @@ -70,10 +70,6 @@ namespace Xamarin.PropertyEditing.Mac internal class UnderlinedTabViewController : NotifyingTabViewController where TViewModel : NotifyingObject { - private NSStackView tabStack = new NSStackView () { - Spacing = 4f, - }; - public override void NumberOfItemsChanged (NSTabView tabView) { base.NumberOfItemsChanged (tabView); @@ -85,7 +81,8 @@ namespace Xamarin.PropertyEditing.Mac foreach (var item in TabViewItems) { if (item.Image != null) { this.tabStack.AddView (new UnderlinedImageView (item.Image.Name) { - Selected = i == SelectedTabViewItemIndex + Selected = i == SelectedTabViewItemIndex, + ToolTip = item.Label, }, NSStackViewGravity.Leading); } else { this.tabStack.AddView (new UnderlinedTextField () { @@ -100,10 +97,28 @@ namespace Xamarin.PropertyEditing.Mac } } + private NSStackView outerStack; + private NSStackView innerStack; + private NSStackView tabStack = new NSStackView () { + Spacing = 4f, + }; + + private NSEdgeInsets edgeInsets = new NSEdgeInsets (0, 12, 12, 12); + public NSEdgeInsets EdgeInsets { + get => this.edgeInsets; + set { + this.edgeInsets = value; + if (this.outerStack != null) { + this.outerStack.EdgeInsets = value; + this.innerStack.EdgeInsets = value; + } + } + } + public override void MouseDown (NSEvent theEvent) { NSView hit = View.HitTest (View.Superview.ConvertPointFromView (theEvent.LocationInWindow, null)); - if (!(hit is ISelectable)) + if (!(hit is IUnderliningTabView)) return; int i = 0; @@ -120,7 +135,7 @@ namespace Xamarin.PropertyEditing.Mac { base.DidSelect (tabView, item); for (int i = 0; i < this.tabStack.Views.Length; i++) { - var tabItem = this.tabStack.Views[i] as ISelectable; + var tabItem = this.tabStack.Views[i] as IUnderliningTabView; if (tabItem != null) tabItem.Selected = SelectedTabViewItemIndex == i; } @@ -128,15 +143,22 @@ namespace Xamarin.PropertyEditing.Mac public override void LoadView () { - var stack = new NSStackView () { + this.outerStack = new NSStackView () { + Orientation = NSUserInterfaceLayoutOrientation.Horizontal, + EdgeInsets = EdgeInsets + }; + + this.innerStack = new NSStackView () { Spacing = 0, Alignment = NSLayoutAttribute.Left, - Orientation = NSUserInterfaceLayoutOrientation.Vertical + Orientation = NSUserInterfaceLayoutOrientation.Vertical, + EdgeInsets = EdgeInsets }; - stack.AddView (this.tabStack, NSStackViewGravity.Top); - stack.AddView (TabView, NSStackViewGravity.Bottom); - View = stack; + this.outerStack.AddView (this.innerStack, NSStackViewGravity.Leading); + this.innerStack.AddView (this.tabStack, NSStackViewGravity.Top); + this.innerStack.AddView (TabView, NSStackViewGravity.Bottom); + View = this.outerStack; } } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs index 39deb43..fcc4134 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs @@ -3,12 +3,11 @@ using CoreGraphics; namespace Xamarin.PropertyEditing.Mac { - - internal interface ISelectable { + internal interface IUnderliningTabView { bool Selected { get; set; } } - internal class UnderlinedImageView : NSImageView, ISelectable + internal class UnderlinedImageView : NSImageView, IUnderliningTabView { public UnderlinedImageView (string name) { @@ -22,14 +21,13 @@ namespace Xamarin.PropertyEditing.Mac { get => selected; set { - //if (selected == value) - // return; + if (selected == value && Image != null) + return; selected = value; var version = PropertyEditorPanel.ThemeManager.Theme == Themes.PropertyEditorTheme.Dark ? $"{name}~dark" : name; Image = NSImage.ImageNamed (selected ? $"{version}~sel" : version); - //Enabled = value; NeedsDisplay = true; } } @@ -55,7 +53,7 @@ namespace Xamarin.PropertyEditing.Mac } } - internal class UnderlinedTextField : NSTextField, ISelectable + internal class UnderlinedTextField : NSTextField, IUnderliningTabView { public UnderlinedTextField () { @@ -70,12 +68,9 @@ namespace Xamarin.PropertyEditing.Mac get => selected; set { - //if (selected == value) - // return; selected = value; TextColor = selected ? NSColor.Text : NSColor.DisabledControlText; - //Enabled = value; NeedsDisplay = true; } } diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel.png index 00b89eb..594e7e6 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel@2x.png index 01e5392..933cb3c 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel@2x.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-gradient-16~sel@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-image-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-image-16~sel.png index bb74dd5..8f36425 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-image-16~sel.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-image-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-none-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-none-16~sel.png index b8e1080..209a125 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-none-16~sel.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-none-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16.png new file mode 100644 index 0000000..ce40c8a Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16@2x.png new file mode 100644 index 0000000..dd3fbc6 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark.png new file mode 100644 index 0000000..5095161 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark@2x.png new file mode 100644 index 0000000..936f021 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel.png new file mode 100644 index 0000000..5095161 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel@2x.png new file mode 100644 index 0000000..936f021 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~dark~sel@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel.png new file mode 100644 index 0000000..ce40c8a Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel@2x.png new file mode 100644 index 0000000..dd3fbc6 Binary files /dev/null and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-palette-16~sel@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel.png index 1b3520b..5f51f84 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel@2x.png index 5e2fd96..bd4993d 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel@2x.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-resources-16~sel@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel.png index 3bbdbb0..d15fb76 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel.png differ diff --git a/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel@2x.png b/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel@2x.png index 0aa1109..dcaea5a 100755 Binary files a/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel@2x.png and b/Xamarin.PropertyEditing.Mac/Resources/property-brush-solid-16~sel@2x.png differ diff --git a/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj b/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj index 3fa13b6..c2f7a98 100644 --- a/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj +++ b/Xamarin.PropertyEditing.Mac/Xamarin.PropertyEditing.Mac.csproj @@ -240,6 +240,14 @@ + + + + + + + + \ No newline at end of file -- cgit v1.2.3