diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
3 files changed, 9 insertions, 70 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs index 756889f..edb17f5 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs @@ -5,11 +5,11 @@ using Foundation; namespace Xamarin.PropertyEditing.Mac { - public class NumericSpinEditor<T> : NumericSpinEditor + internal class NumericSpinEditor<T> : NumericSpinEditor { } - public class NumericSpinEditor : NSView, INSAccessibilityGroup + internal class NumericSpinEditor : NSView, INSAccessibilityGroup { NumericTextField numericEditor; NSStepper stepper; diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs index 8731822..f520d86 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs @@ -3,69 +3,6 @@ using AppKit; namespace Xamarin.PropertyEditing.Mac { - internal class SegmentStack : NSView - { - class SegmentItem - { - public NSImage Image { get; set; } - public string Label { get; set; } - public NSView View { get; set; } - } - - - private SegmentItem[] segments = new SegmentItem[0]; - private NSStackView stackView = new NSStackView () { - Spacing = 3 - }; - - public void SetImage (NSImage image, int segment) - { - var item = this.segments[segment]; - - item.Image = image; - if (item.Image != null) - return; - - item.View = new UnderlinedImageView (image.Name); - this.stackView.AddView (item.View, NSStackViewGravity.Leading); - } - - public NSImage GetImage (int segment) - { - return this.segments[segment].Image; - } - - public void SetLabel (string label, int segment) - { - var item = this.segments[segment]; - item.Label = label; - if (item.Image != null) - return; - - item.View = new UnderlinedTextField () { - BackgroundColor = NSColor.Clear, - Editable = false, - Bezeled = false, - StringValue = label - }; - this.stackView.AddView (item.View, NSStackViewGravity.Leading); - } - - public string GetLabel (int segment) - { - return this.segments[segment].Label; - } - - public int SegmentCount - { - get => this.segments.Length; - set - { - this.segments = new SegmentItem[value]; - } - } - } - internal class UnderlinedTabViewController<TViewModel> : NotifyingTabViewController<TViewModel> where TViewModel : NotifyingObject { public override void NumberOfItemsChanged (NSTabView tabView) @@ -99,7 +36,7 @@ namespace Xamarin.PropertyEditing.Mac private NSStackView outerStack; private NSStackView innerStack; private NSStackView tabStack = new NSStackView () { - Spacing = 4f, + Spacing = 2f, }; private NSEdgeInsets edgeInsets = new NSEdgeInsets (0, 0, 0, 0); @@ -144,6 +81,7 @@ namespace Xamarin.PropertyEditing.Mac { this.outerStack = new NSStackView () { Orientation = NSUserInterfaceLayoutOrientation.Horizontal, + Spacing = 0, EdgeInsets = EdgeInsets }; diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs index 664e979..f5dea93 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTextField.cs @@ -64,7 +64,7 @@ namespace Xamarin.PropertyEditing.Mac return; NSBezierPath path = new NSBezierPath (); - path.AppendPathWithRect (new CGRect (Bounds.X + 1, Bounds.Top + lineWidth, Bounds.Width - 2, lineWidth)); + path.AppendPathWithRect (new CGRect (Bounds.X, Bounds.Top + lineWidth, Bounds.Width, lineWidth)); (selected? NSColor.Text: NSColor.DisabledControlText).Set (); path.Fill (); } @@ -85,6 +85,7 @@ namespace Xamarin.PropertyEditing.Mac TranslatesAutoresizingMaskIntoConstraints = false; AutoresizingMask = NSViewResizingMask.MaxXMargin; UsesSingleLineMode = true; + Alignment = NSTextAlignment.Center; } private bool selected; @@ -96,7 +97,7 @@ namespace Xamarin.PropertyEditing.Mac selected = value; TextColor = selected ? NSColor.Text : NSColor.DisabledControlText; - NeedsDisplay = true; + ///NeedsDisplay = true; } } @@ -119,7 +120,7 @@ namespace Xamarin.PropertyEditing.Mac return; NSBezierPath path = new NSBezierPath (); - path.AppendPathWithRect (new CGRect (Bounds.X + 1, Bounds.Bottom - lineWidth, Bounds.Width - 2, lineWidth)); + path.AppendPathWithRect (new CGRect (Bounds.X, Bounds.Bottom - lineWidth, Bounds.Width, lineWidth)); TextColor.Set (); path.Fill (); } @@ -129,7 +130,7 @@ namespace Xamarin.PropertyEditing.Mac get { var size = base.IntrinsicContentSize; - return new CGSize (size.Width + 2, size.Height + lineWidth + 3); + return new CGSize (size.Width, size.Height + lineWidth + 3); } } } |