diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
7 files changed, 23 insertions, 21 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs index 76868b6..708a832 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BasePopOverControl.cs @@ -48,7 +48,7 @@ namespace Xamarin.PropertyEditing.Mac NSLayoutConstraint.Create (viewTitle, NSLayoutAttribute.Left, NSLayoutRelation.Equal, iconView, NSLayoutAttribute.Right, 1f, 5f), //NSLayoutConstraint.Create (viewTitle, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 38f), NSLayoutConstraint.Create (viewTitle, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, 120), - NSLayoutConstraint.Create (viewTitle, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, PropertyEditorControl.DefaultControlHeight), + NSLayoutConstraint.Create (viewTitle, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, 24), }); } diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs index 6fa2dd5..bde2128 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs @@ -25,7 +25,7 @@ namespace Xamarin.PropertyEditing.Mac this.filterResource = new NSSearchField {
ControlSize = NSControlSize.Mini,
- Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize),
+ Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Mini)),
PlaceholderString = Properties.Resources.SearchResourcesTitle,
};
@@ -46,7 +46,8 @@ namespace Xamarin.PropertyEditing.Mac NSView IEditorView.NativeView => View; - public bool IsDynamicallySized => false; + public bool IsDynamicallySized => false;
+ public bool NeedsPropertyButton => false; public nint GetHeight (EditorViewModel viewModel) { diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs index 219fb95..f8ed20d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs @@ -14,7 +14,7 @@ namespace Xamarin.PropertyEditing.Mac Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; Cell.UsesSingleLineMode = true; ControlSize = NSControlSize.Small; - Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize); + Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)); Title = string.Empty; TranslatesAutoresizingMaskIntoConstraints = false; diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs index 5dba23c..9e3366d 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs @@ -14,7 +14,7 @@ namespace Xamarin.PropertyEditing.Mac Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; Cell.UsesSingleLineMode = true; ControlSize = NSControlSize.Small; - Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize); + Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)); Title = string.Empty; TranslatesAutoresizingMaskIntoConstraints = false; } diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs index 30dd7a0..aa5c648 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs @@ -18,12 +18,6 @@ namespace Xamarin.PropertyEditing.Mac internal class NumericSpinEditor : NSView, INSAccessibilityGroup { - internal const int StepperSpace = 2; - internal const int StepperWidth = 11; - const int stepperTopHeight = 9; - const int stepperBotHeight = 10; - const int inputModeWidth = 60; - private NumericTextField numericEditor; public NumericTextField NumericEditor { get { return this.numericEditor; } @@ -203,7 +197,7 @@ namespace Xamarin.PropertyEditing.Mac this.numericEditor = new NumericTextField { Alignment = NSTextAlignment.Right, TranslatesAutoresizingMaskIntoConstraints = false, - Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize), + Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)), ControlSize = NSControlSize.Small, Formatter = this.formatter }; @@ -221,18 +215,20 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (this.decrementButton); this.AddConstraints (new[] { - NSLayoutConstraint.Create (this.numericEditor, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, -(StepperWidth + StepperSpace + 1)), - NSLayoutConstraint.Create (this.numericEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, PropertyEditorControl.DefaultControlHeight - 3), + NSLayoutConstraint.Create (this.numericEditor, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 0), + NSLayoutConstraint.Create (this.numericEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, 18), - NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Top, 1f, 0f), - NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Right, 1f, StepperSpace), + NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Top, 1f, 0f), + NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Right, 1f, StepperSpace), + NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0), NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, StepperWidth), - NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, stepperTopHeight), + NSLayoutConstraint.Create (this.incrementButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, StepperTopHeight), - NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Top, 1f, stepperTopHeight), + NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Top, 1f, StepperTopHeight), + NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0), NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.numericEditor, NSLayoutAttribute.Right, 1f, StepperSpace), NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, StepperWidth), - NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, stepperBotHeight), + NSLayoutConstraint.Create (this.decrementButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, StepperBotHeight), }); } @@ -296,6 +292,11 @@ namespace Xamarin.PropertyEditing.Mac return (double)Decimal.Round ((decimal)(value < MinimumValue ? MinimumValue : value > MaximumValue ? MaximumValue : value), Digits); } + private const int StepperSpace = 2; + private const int StepperWidth = 11; + private const int StepperTopHeight = 9; + private const int StepperBotHeight = 10; + private readonly IHostResourceProvider hostResources; } } diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index 012fbc7..31055ab 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -9,7 +9,7 @@ namespace Xamarin.PropertyEditing.Mac public class PropertyButton : UnfocusableButton { - public const int DefaultSize = 20; + public const int DefaultSize = 6; NSMenu popUpContextMenu; diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs index 5f9dfab..c449d66 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnfocusableTextField.cs @@ -65,7 +65,7 @@ namespace Xamarin.PropertyEditing.Mac Bordered = false, ControlSize = NSControlSize.Small, Editable = false, - Font = NSFont.FromFontName (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultPropertyLabelFontSize), + Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)), Selectable = false, TranslatesAutoresizingMaskIntoConstraints = false, }; |