diff options
author | Václav Vančura <vaclav@vancura.org> | 2018-04-16 19:27:49 +0300 |
---|---|---|
committer | Dominique Louis <savagesoftware@gmail.com> | 2018-08-08 09:33:36 +0300 |
commit | 21b744cae74f987fab5daade5100ecf4743b2ad9 (patch) | |
tree | f37ec319019652d4fd7abd241b194a26b54605ea /Xamarin.PropertyEditing.Mac/Controls/Custom | |
parent | b6c0aeba09b2167c3f9d83004f3942c3e6ae066e (diff) |
[Mac] New Stepper images
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs index 1aabaa0..560a69b 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/NumericSpinEditor.cs @@ -13,6 +13,11 @@ namespace Xamarin.PropertyEditing.Mac internal class NumericSpinEditor : NSView, INSAccessibilityGroup { + const int stepperSpace = 2; + const int stepperWidth = 11; + const int stepperTopHeight = 9; + const int stepperBotHeight = 10; + NumericTextField numericEditor; public NumericTextField NumericEditor { get { return numericEditor; } @@ -201,16 +206,18 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (decrementButton); this.DoConstraints (new[] { - numericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - 16), + numericEditor.ConstraintTo (this, (n, c) => n.Width == c.Width - (stepperWidth + stepperSpace + 1)), numericEditor.ConstraintTo (this, (n, c) => n.Height == PropertyEditorControl.DefaultControlHeight - 3), - incrementButton.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + 5), - incrementButton.ConstraintTo (numericEditor, (s, n) => s.Top == n.Top + 1), - incrementButton.ConstraintTo (numericEditor, (s, n) => s.Width == 9), - incrementButton.ConstraintTo (numericEditor, (s, n) => s.Height == 9), - decrementButton.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + 5), - decrementButton.ConstraintTo (numericEditor, (s, n) => s.Top == n.Top + 10), - decrementButton.ConstraintTo (numericEditor, (s, n) => s.Width == 9), - decrementButton.ConstraintTo (numericEditor, (s, n) => s.Height == 9), + + incrementButton.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + stepperSpace), + incrementButton.ConstraintTo (numericEditor, (s, n) => s.Top == n.Top), + incrementButton.ConstraintTo (numericEditor, (s, n) => s.Width == stepperWidth), + incrementButton.ConstraintTo (numericEditor, (s, n) => s.Height == stepperTopHeight), + + decrementButton.ConstraintTo (numericEditor, (s, n) => s.Left == n.Right + stepperSpace), + decrementButton.ConstraintTo (numericEditor, (s, n) => s.Top == n.Top + stepperTopHeight), + decrementButton.ConstraintTo (numericEditor, (s, n) => s.Width == stepperWidth), + decrementButton.ConstraintTo (numericEditor, (s, n) => s.Height == stepperBotHeight), }); PropertyEditorPanel.ThemeManager.ThemeChanged += ThemeManager_ThemeChanged; @@ -233,25 +240,6 @@ namespace Xamarin.PropertyEditing.Mac protected void UpdateTheme () { this.Appearance = PropertyEditorPanel.ThemeManager.CurrentAppearance; - - // Skin the inc/dec buttons until we support theming files - switch (PropertyEditorPanel.ThemeManager.Theme) { - case PropertyEditorTheme.Dark: - incrementButton.Image = NSImage.ImageNamed ("stepper-up"); // TODO path to proper image - decrementButton.Image = NSImage.ImageNamed ("stepper-down"); // TODO path to proper image - break; - - case PropertyEditorTheme.Light: - incrementButton.Image = NSImage.ImageNamed ("stepper-up"); // TODO path to proper image - decrementButton.Image = NSImage.ImageNamed ("stepper-down"); // TODO path to proper image - break; - - case PropertyEditorTheme.None: - incrementButton.Image = NSImage.ImageNamed ("stepper-up"); // TODO path to proper image - decrementButton.Image = NSImage.ImageNamed ("stepper-down"); // TODO path to proper image - break; - } - } virtual protected void OnEditingEnded (object sender, EventArgs e) |