Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Louis <savagesoftware@gmail.com>2017-05-17 14:37:17 +0300
committerDominique Louis <savagesoftware@gmail.com>2017-10-16 19:44:24 +0300
commit050a44afca8ee044b781f4d99a1f8256dc63f606 (patch)
tree3c01565473610860c1d745b4813178185a05f32e /Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
parent876040e6b5e95d4cb658158d3305a6871bb58f3f (diff)
Ported the SpinButton control and renamed it to NumericSpinEditor, added keyup and down support.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs38
1 files changed, 17 insertions, 21 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
index 96537dc..b1ce41a 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
@@ -12,13 +12,13 @@ namespace Xamarin.PropertyEditing.Mac
where T : struct
{
protected UnfocusableTextField XLabel { get; set; }
- protected NSTextField XEditor { get; set; }
+ protected NumericSpinEditor XEditor { get; set; }
protected UnfocusableTextField YLabel { get; set; }
- protected NSTextField YEditor { get; set; }
+ protected NumericSpinEditor YEditor { get; set; }
protected UnfocusableTextField WidthLabel { get; set; }
- protected NSTextField WidthEditor { get; set; }
+ protected NumericSpinEditor WidthEditor { get; set; }
protected UnfocusableTextField HeightLabel { get; set; }
- protected NSTextField HeightEditor { get; set; }
+ protected NumericSpinEditor HeightEditor { get; set; }
public override NSView FirstKeyView => XEditor;
public override NSView LastKeyView => HeightEditor;
@@ -31,32 +31,28 @@ namespace Xamarin.PropertyEditing.Mac
public BaseRectangleEditorControl ()
{
XLabel = new UnfocusableTextField ();
- XEditor = new NSTextField ();
+ XEditor = new NumericSpinEditor ();
XEditor.BackgroundColor = NSColor.Clear;
- XEditor.StringValue = string.Empty;
- XEditor.Activated += OnInputUpdated;
- XEditor.EditingEnded += OnInputUpdated;
+ XEditor.Value = 0.0f;
+ XEditor.ValueChanged += OnInputUpdated;
YLabel = new UnfocusableTextField ();
- YEditor = new NSTextField ();
+ YEditor = new NumericSpinEditor ();
YEditor.BackgroundColor = NSColor.Clear;
- YEditor.StringValue = string.Empty;
- YEditor.Activated += OnInputUpdated;
- YEditor.EditingEnded += OnInputUpdated;
+ YEditor.Value = 0.0f;
+ YEditor.ValueChanged += OnInputUpdated;
WidthLabel = new UnfocusableTextField ();
- WidthEditor = new NSTextField ();
+ WidthEditor = new NumericSpinEditor ();
WidthEditor.BackgroundColor = NSColor.Clear;
- WidthEditor.StringValue = string.Empty;
- WidthEditor.Activated += OnInputUpdated;
- WidthEditor.EditingEnded += OnInputUpdated;
+ WidthEditor.Value = 0.0f;
+ WidthEditor.ValueChanged += OnInputUpdated;
HeightLabel = new UnfocusableTextField ();
- HeightEditor = new NSTextField ();
+ HeightEditor = new NumericSpinEditor ();
HeightEditor.BackgroundColor = NSColor.Clear;
- HeightEditor.StringValue = string.Empty;
- HeightEditor.Activated += OnInputUpdated;
- HeightEditor.EditingEnded += OnInputUpdated;
+ HeightEditor.Value = 0.0f;
+ HeightEditor.ValueChanged += OnInputUpdated;
AddSubview (XLabel);
AddSubview (XEditor);
@@ -70,7 +66,7 @@ namespace Xamarin.PropertyEditing.Mac
protected virtual void OnInputUpdated (object sender, EventArgs e)
{
- ViewModel.Value = (T)Activator.CreateInstance (typeof(T), XEditor.FloatValue, YEditor.FloatValue, WidthEditor.FloatValue, HeightEditor.FloatValue);
+ ViewModel.Value = (T)Activator.CreateInstance (typeof(T), XEditor.Value, YEditor.Value, WidthEditor.Value, HeightEditor.Value);
}
protected override void HandleErrorsChanged (object sender, System.ComponentModel.DataErrorsChangedEventArgs e)