diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
14 files changed, 179 insertions, 86 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseEditorControl.cs index 918e9ca..74d4150 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BaseEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BaseEditorControl.cs @@ -6,41 +6,83 @@ using CoreGraphics; namespace Xamarin.PropertyEditing.Mac { - internal class BaseEditorControl : NSView + internal abstract class BaseEditorControl : NSView { - NSButton errorButton; IEnumerable errorList; + const int DefaultPropertyButtonSize = 10; + const int DefaultActioButtonSize = 16; + + public event EventHandler ActionButtonClicked; + NSButton actionButton; + public NSButton ActionButton { + get { return actionButton; } + } + + public event EventHandler PropertyButtonClicked; + NSButton propertyButton; + public NSButton PropertyButton { + get { return propertyButton; } + } public BaseEditorControl () { - errorButton = new NSButton () { + propertyButton = new NSButton { + Bordered = false, + AlternateImage = NSImage.ImageNamed ("property-button-default-mac-active-10"), + Cell = { + HighlightsBy = 1, + }, + Image = NSImage.ImageNamed ("property-button-default-mac-10"), + ImageScaling = NSImageScale.AxesIndependently, + Title = string.Empty, + TranslatesAutoresizingMaskIntoConstraints = false, + }; + + propertyButton.Activated += (object sender, EventArgs e) => { + NotifyPropertyButtonClicked (); + }; + + AddSubview (propertyButton); + + actionButton = new NSButton { Bordered = false, Enabled = false, +#if DEBUG + Image = NSImage.ImageNamed ("action-warning-16"), +#endif ImageScaling = NSImageScale.AxesIndependently, Title = string.Empty, TranslatesAutoresizingMaskIntoConstraints = false, }; - errorButton.Activated += (object sender, EventArgs e) => { - var Container = new ErrorMessageView (errorList) { - Frame = new CGRect (CGPoint.Empty, new CGSize (320, 200)) - }; + actionButton.Activated += (object sender, EventArgs e) => { + if (errorList != null) { + var Container = new ErrorMessageView (errorList) { + Frame = new CGRect (CGPoint.Empty, new CGSize (320, 200)) + }; + + var errorMessagePopUp = new NSPopover { + Behavior = NSPopoverBehavior.Semitransient, + ContentViewController = new NSViewController (null, null) { View = Container }, + }; - var errorMessagePopUp = new NSPopover { - Behavior = NSPopoverBehavior.Semitransient, - ContentViewController = new NSViewController (null, null) { View = Container }, - }; + errorMessagePopUp.Show (default (CGRect), actionButton, NSRectEdge.MinYEdge); + } - errorMessagePopUp.Show (default (CGRect), errorButton, NSRectEdge.MinYEdge); + NotifyActioButtonClicked (); }; - AddSubview (errorButton); + AddSubview (actionButton); this.DoConstraints (new[] { - errorButton.ConstraintTo (this, (cb, c) => cb.Width == 20), - errorButton.ConstraintTo (this, (cb, c) => cb.Height == 20), - errorButton.ConstraintTo (this, (cb, c) => cb.Left == c.Right - 22), - errorButton.ConstraintTo (this, (cb, c) => cb.Top == c.Top + 4), + propertyButton.ConstraintTo (this, (ab, c) => ab.Width == DefaultPropertyButtonSize), + propertyButton.ConstraintTo (this, (ab, c) => ab.Height == DefaultPropertyButtonSize), + propertyButton.ConstraintTo (this, (ab, c) => ab.Top == c.Top + 6), // TODO: Better centering based on the icon height + propertyButton.ConstraintTo (this, (ab, c) => ab.Left == c.Right - 28), + actionButton.ConstraintTo (this, (eb, c) => eb.Width == DefaultActioButtonSize), + actionButton.ConstraintTo (this, (eb, c) => eb.Height == DefaultActioButtonSize), + actionButton.ConstraintTo (propertyButton, (eb, ab) => eb.Left == ab.Left + 10), + actionButton.ConstraintTo (this, (eb, c) => eb.Top == c.Top + 3), // TODO: Better centering based on the icon height }); PropertyEditorPanel.ThemeManager.ThemeChanged += ThemeManager_ThemeChanged; @@ -67,9 +109,20 @@ namespace Xamarin.PropertyEditing.Mac { errorList = errors; - errorButton.Enabled = errors != null; + actionButton.Enabled = errors != null; + // Using NSImageName.Caution for now, we can change this later at the designers behest - errorButton.Image = errorButton.Enabled ? NSImage.ImageNamed (NSImageName.Caution) : null; + actionButton.Image = actionButton.Enabled ? NSImage.ImageNamed ("action-warning-16") : null; + } + + void NotifyPropertyButtonClicked () + { + PropertyButtonClicked?.Invoke (this, EventArgs.Empty); + } + + void NotifyActioButtonClicked () + { + ActionButtonClicked?.Invoke (this, EventArgs.Empty); } } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseNumericEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseNumericEditorControl.cs index 942742f..0736e25 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BaseNumericEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BaseNumericEditorControl.cs @@ -19,8 +19,9 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (NumericEditor); this.DoConstraints ( new[] { - NumericEditor.ConstraintTo (this, (n, c) => n.Left == c.Left + 3), - NumericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - 27), + NumericEditor.ConstraintTo (this, (n, c) => n.Top == c.Top + 1), + NumericEditor.ConstraintTo (this, (n, c) => n.Left == c.Left + 4), + NumericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - 33), }); } diff --git a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs index e1ec8ed..95c577d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs @@ -46,8 +46,10 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (YEditor); this.DoConstraints (new[] { - XEditor.ConstraintTo (this, (xe, c) => xe.Width == 50), - YEditor.ConstraintTo (this, (ye, c) => ye.Width == 50), + XEditor.ConstraintTo (this, (xe, c) => xe.Width == 90), + XEditor.ConstraintTo (this, (xe, c) => xe.Height == DefaultControlHeight), + YEditor.ConstraintTo (this, (ye, c) => ye.Width == 90), + YEditor.ConstraintTo (this, (ye, c) => ye.Height == DefaultControlHeight), }); UpdateTheme (); diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs index 9658ded..3cbd62f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs @@ -65,10 +65,14 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (HeightEditor); this.DoConstraints (new[] { - XEditor.ConstraintTo (this, (xe, c) => xe.Width == 50), - YEditor.ConstraintTo (this, (ye, c) => ye.Width == 50), - WidthEditor.ConstraintTo (this, (we, c) => we.Width == 50), - HeightEditor.ConstraintTo (this, (he, c) => he.Width == 50), + XEditor.ConstraintTo (this, (xe, c) => xe.Width == 90), + XEditor.ConstraintTo (this, (xe, c) => xe.Height == DefaultControlHeight), + YEditor.ConstraintTo (this, (ye, c) => ye.Width == 90), + YEditor.ConstraintTo (this, (ye, c) => ye.Height == DefaultControlHeight), + WidthEditor.ConstraintTo (this, (we, c) => we.Width == 90), + WidthEditor.ConstraintTo (this, (we, c) => we.Height == DefaultControlHeight), + HeightEditor.ConstraintTo (this, (he, c) => he.Width == 90), + HeightEditor.ConstraintTo (this, (he, c) => he.Height == DefaultControlHeight), }); UpdateTheme (); diff --git a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs index b4f2fe9..262e341 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs @@ -1,3 +1,4 @@ +using System;
using System.Collections; using AppKit; using Xamarin.PropertyEditing.Mac.Resources; @@ -11,11 +12,14 @@ namespace Xamarin.PropertyEditing.Mac public BooleanEditorControl () { - BooleanEditor = new NSButton () { TranslatesAutoresizingMaskIntoConstraints = false }; + BooleanEditor = new NSButton { + TranslatesAutoresizingMaskIntoConstraints = false, + Title = string.Empty, + ControlSize = NSControlSize.Small,
+ Font = NSFont.FromFontName (DefaultFontName, DefaultFontSize), + }; BooleanEditor.SetButtonType (NSButtonType.Switch); - BooleanEditor.Title = string.Empty; - // update the value on 'enter' BooleanEditor.Activated += (sender, e) => { ViewModel.Value = BooleanEditor.State == NSCellStateValue.On ? true : false; @@ -25,7 +29,8 @@ namespace Xamarin.PropertyEditing.Mac this.DoConstraints (new[] { BooleanEditor.ConstraintTo (this, (cb, c) => cb.Width == c.Width), - BooleanEditor.ConstraintTo (this, (cb, c) => cb.Left == c.Left + 3) + BooleanEditor.ConstraintTo (this, (cb, c) => cb.Top == c.Top + 5), + BooleanEditor.ConstraintTo (this, (cb, c) => cb.Left == c.Left + 4), }); UpdateTheme (); diff --git a/Xamarin.PropertyEditing.Mac/Controls/CGPointEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/CGPointEditorControl.cs index 5691de4..ced326e 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/CGPointEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/CGPointEditorControl.cs @@ -19,10 +19,10 @@ namespace Xamarin.PropertyEditing.Mac XEditor.Frame = new CGRect (48, 0, 50, 20); - YLabel.Frame = new CGRect (155, 0, 25, 24); + YLabel.Frame = new CGRect (150, 0, 25, 24); YLabel.StringValue = "Y:"; // TODO Localise - YEditor.Frame = new CGRect (175, 0, 50, 20); + YEditor.Frame = new CGRect (170, 0, 50, 20); } protected override void UpdateValue () diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs index e6c2639..76cc41a 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs @@ -154,8 +154,8 @@ namespace Xamarin.PropertyEditing.Mac stepper = new NSStepper { TranslatesAutoresizingMaskIntoConstraints = false, ValueWraps = false, + ControlSize = controlSize, }; - stepper.Cell.ControlSize = controlSize; formatter = new NSNumberFormatter { FormatterBehavior = NSNumberFormatterBehavior.Version_10_4, @@ -169,11 +169,10 @@ namespace Xamarin.PropertyEditing.Mac Alignment = NSTextAlignment.Right, Formatter = formatter, TranslatesAutoresizingMaskIntoConstraints = false, + Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize), + ControlSize = controlSize, }; - numericEditor.Cell.ControlSize = controlSize; - numericEditor.Cell.Font = NSFont.ControlContentFontOfSize (NSFont.SystemFontSizeForControlSize (controlSize)); - stepper.Activated += (s, e) => { OnStepperActivated (s, e); }; @@ -189,8 +188,9 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (numericEditor); this.DoConstraints (new[] { - numericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - 17), - stepper.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + 5), + numericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - 16), + numericEditor.ConstraintTo (this, (n, c) => n.Height == 19), + stepper.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + 4), stepper.ConstraintTo (numericEditor, (s, n) => s.Top == n.Top), }); } diff --git a/Xamarin.PropertyEditing.Mac/Controls/UnfocusableTextField.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs index 8962623..f54de51 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/UnfocusableTextField.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs @@ -24,12 +24,14 @@ namespace Xamarin.PropertyEditing.Mac Bordered = false; Editable = false; Selectable = false; + ControlSize = NSControlSize.Small; + Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultPropertyLabelFontSize); } public override void DrawRect (CGRect dirtyRect) { - CGPoint origin = new CGPoint (0.0f, 7.0f); - CGRect rect = new CGRect (origin, new CGSize (this.Bounds.Width, this.Bounds.Height)); + CGPoint origin = new CGPoint (0.0f, 4.0f); + CGRect rect = new CGRect (origin, new CGSize (Bounds.Width - 5, Bounds.Height)); this.AttributedStringValue.DrawInRect (rect); } diff --git a/Xamarin.PropertyEditing.Mac/Controls/PointEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PointEditorControl.cs index 79022fc..6008bd5 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PointEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PointEditorControl.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using AppKit; using CoreGraphics; using Xamarin.PropertyEditing.Drawing; using Xamarin.PropertyEditing.Mac.Resources; @@ -11,15 +12,19 @@ namespace Xamarin.PropertyEditing.Mac { public PointEditorControl () { - XLabel.Frame = new CGRect (29, 0, 25, 24); - XLabel.StringValue = "X:"; // TODO Localise + XLabel.Frame = new CGRect (38, -6, 25, 22); + XLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + XLabel.StringValue = "X"; // TODO Localise - XEditor.Frame = new CGRect (48, 0, 50, 20); + XEditor.Frame = new CGRect (4, 13, 90, 20); - YLabel.Frame = new CGRect (155, 0, 25, 24); - YLabel.StringValue = "Y:"; // TODO Localise + YLabel.Frame = new CGRect (166, -6, 25, 22); + YLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + YLabel.StringValue = "Y"; // TODO Localise - YEditor.Frame = new CGRect (175, 0, 50, 20); + YEditor.Frame = new CGRect (132, 13, 90, 20); + + RowHeight = 33; } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs index 708289b..ce6999f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs @@ -23,22 +23,20 @@ namespace Xamarin.PropertyEditing.Mac TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = NSColor.Clear, StringValue = String.Empty, - Cell = { - ControlSize = NSControlSize.Small - }, + ControlSize = NSControlSize.Small, Editable = false, + Font = NSFont.FromFontName(DefaultFontName, DefaultFontSize), + }; + + this.comboBox.SelectionChanged += (sender, e) => { + EditorViewModel.ValueName = comboBox.SelectedValue.ToString (); }; this.popUpButton = new NSPopUpButton { TranslatesAutoresizingMaskIntoConstraints = false, StringValue = String.Empty, - Cell = { - ControlSize = NSControlSize.Small - }, - }; - - this.comboBox.SelectionChanged += (sender, e) => { - EditorViewModel.ValueName = comboBox.SelectedValue.ToString (); + ControlSize = NSControlSize.Small, + Font = NSFont.FromFontName (DefaultFontName, DefaultFontSize), }; popupButtonList = new NSMenu (); @@ -100,9 +98,10 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (this.popUpButton); this.DoConstraints (new[] { - popUpButton.ConstraintTo (this, (pub, c) => pub.Width == c.Width - 26), - popUpButton.ConstraintTo (this, (pub, c) => pub.Left == c.Left + 3), - popUpButton.ConstraintTo (this, (pub, c) => pub.Top == c.Top + 6), + popUpButton.ConstraintTo (this, (pub, c) => pub.Width == c.Width - 34), + popUpButton.ConstraintTo (this, (pub, c) => pub.Height == DefaultControlHeight + 1), + popUpButton.ConstraintTo (this, (pub, c) => pub.Left == pub.Left + 4), + popUpButton.ConstraintTo (this, (pub, c) => pub.Top == pub.Top + 0), }); firstKeyView = this.popUpButton; @@ -118,9 +117,10 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (this.comboBox); this.DoConstraints (new[] { - comboBox.ConstraintTo (this, (cb, c) => cb.Width == c.Width - 28), - comboBox.ConstraintTo (this, (cb, c) => cb.Left == c.Left + 3), - comboBox.ConstraintTo (this, (cb, c) => cb.Top == c.Top + 4), + comboBox.ConstraintTo (this, (cb, c) => cb.Width == c.Width - 35), + comboBox.ConstraintTo (this, (cb, c) => cb.Height == DefaultControlHeight), + comboBox.ConstraintTo (this, (cb, c) => cb.Left == cb.Left + 4), + comboBox.ConstraintTo (this, (cb, c) => cb.Top == cb.Top + 0), }); firstKeyView = this.comboBox; diff --git a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs index 92a71ac..e8e93ce 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs @@ -16,7 +16,15 @@ namespace Xamarin.PropertyEditing.Mac public nint TableRow { get; set; } = -1; public NSTableView TableView { get; set; } - public nfloat RowHeight { get; set; } = 24; + + const int DefaultRowHeight = 22; + protected const int DefaultControlHeight = 22; + public const int DefaultFontSize = 11; + public const int DefaultPropertyLabelFontSize = 11; + public const int DefaultDescriptionLabelFontSize = 10; + public const string DefaultFontName = ".AppleSystemUIFont"; + public nfloat RowHeight { get; set; } = DefaultRowHeight; + public bool TriggerRowChange => RowHeight != DefaultRowHeight; PropertyViewModel viewModel; public PropertyViewModel ViewModel { diff --git a/Xamarin.PropertyEditing.Mac/Controls/RectangleEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/RectangleEditorControl.cs index 5e860f6..22ec821 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/RectangleEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/RectangleEditorControl.cs @@ -12,27 +12,31 @@ namespace Xamarin.PropertyEditing.Mac public RectangleEditorControl () { // TODO localize - XLabel.Frame = new CGRect (29, 23, 25, 24); - XLabel.StringValue = "X:"; + XLabel.Frame = new CGRect (38, 27, 25, 22); + XLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + XLabel.StringValue = "X"; - XEditor.Frame = new CGRect (48, 23, 50, 20); + XEditor.Frame = new CGRect (4, 46, 90, 20); - YLabel.Frame = new CGRect (155, 23, 25, 24); - YLabel.StringValue = "Y:"; + YLabel.Frame = new CGRect (166, 27, 25, 22); + YLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + YLabel.StringValue = "Y"; - YEditor.Frame = new CGRect (175, 23, 50, 20); + YEditor.Frame = new CGRect (132, 46, 90, 20); - WidthLabel.Frame = new CGRect (3, 0, 45, 24); - WidthLabel.StringValue = "Width:"; + WidthLabel.Frame = new CGRect (24, -6, 50, 22); + WidthLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + WidthLabel.StringValue = "WIDTH"; - WidthEditor.Frame = new CGRect (48, 0, 50, 20); + WidthEditor.Frame = new CGRect (4, 13, 90, 20); - HeightLabel.Frame = new CGRect (125, 0, 45, 24); - HeightLabel.StringValue = "Height:"; + HeightLabel.Frame = new CGRect (150, -6, 50, 22); + HeightLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + HeightLabel.StringValue = "HEIGHT"; - HeightEditor.Frame = new CGRect (175, 0, 50, 20); + HeightEditor.Frame = new CGRect (132, 13, 90, 20); - RowHeight = 48; + RowHeight = 66; } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/SizeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/SizeEditorControl.cs index e2a5b47..983fdc2 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/SizeEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/SizeEditorControl.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using AppKit; using CoreGraphics; using Xamarin.PropertyEditing.Drawing; using Xamarin.PropertyEditing.Mac.Resources; @@ -11,15 +12,19 @@ namespace Xamarin.PropertyEditing.Mac { public SizeEditorControl () { - XLabel.Frame = new CGRect (3, 0, 40, 24); - XLabel.StringValue = "Width:"; // TODO Localise + XLabel.Frame = new CGRect (24, -6, 50, 22); + XLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + XLabel.StringValue = "WIDTH"; // TODO Localise - XEditor.Frame = new CGRect (48, 0, 50, 20); + XEditor.Frame = new CGRect (4, 13, 90, 20); - YLabel.Frame = new CGRect (125, 0, 45, 24); - YLabel.StringValue = "Height:"; // TODO Localise + YLabel.Frame = new CGRect (150, -6, 50, 22); + YLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize); // TODO: Washed-out color following specs + YLabel.StringValue = "HEIGHT"; // TODO Localise - YEditor.Frame = new CGRect (175, 0, 50, 20); + YEditor.Frame = new CGRect (132, 13, 90, 20); + + RowHeight = 33; } protected override void UpdateAccessibilityValues () diff --git a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs index 5769ba5..2ee7ce8 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs @@ -13,9 +13,11 @@ namespace Xamarin.PropertyEditing.Mac public StringEditorControl () { StringEditor = new NSTextField { - TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = NSColor.Clear, + ControlSize = NSControlSize.Small, + Font = NSFont.FromFontName (DefaultFontName, DefaultFontSize), StringValue = string.Empty, + TranslatesAutoresizingMaskIntoConstraints = false, }; // update the value on keypress @@ -25,8 +27,10 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (StringEditor); this.DoConstraints (new[] { - StringEditor.ConstraintTo (this, (s, c) => s.Width == c.Width - 30), - StringEditor.ConstraintTo (this, (s, c) => s.Left == s.Left + 3), + StringEditor.ConstraintTo (this, (s, c) => s.Width == c.Width - 34), + StringEditor.ConstraintTo (this, (s, c) => s.Height == DefaultControlHeight - 3), + StringEditor.ConstraintTo (this, (s, c) => s.Left == s.Left + 4), + StringEditor.ConstraintTo (this, (s, c) => s.Top == s.Top + 1), }); UpdateTheme (); |