1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
using System;
using AppKit;
using CoreGraphics;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.Mac.Resources;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Mac
{
internal class CommonThicknessEditorControl : BaseRectangleEditorControl<CommonThickness>
{
public CommonThicknessEditorControl ()
{
XLabel.Frame = new CGRect (28, 28, 50, 22);
XLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
XLabel.StringValue = "LEFT";
XEditor.Frame = new CGRect (0, 46, 90, 20);
YLabel.Frame = new CGRect (160, 28, 45, 22);
YLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
YLabel.StringValue = "TOP";
YEditor.Frame = new CGRect (132, 46, 90, 20);
WidthLabel.Frame = new CGRect (24, -5, 50, 22);
WidthLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
WidthLabel.StringValue = "RIGHT";
WidthEditor.Frame = new CGRect (0, 13, 90, 20);
HeightLabel.Frame = new CGRect (150, -5, 50, 22);
HeightLabel.Font = NSFont.FromFontName (DefaultFontName, DefaultDescriptionLabelFontSize);
HeightLabel.StringValue = "BOTTOM";
HeightEditor.Frame = new CGRect (132, 13, 90, 20);
}
public override nint GetHeight (EditorViewModel vm)
{
return 66;
}
protected override void OnInputUpdated (object sender, EventArgs e)
{
ViewModel.Value = (CommonThickness)Activator.CreateInstance (typeof (CommonThickness), HeightEditor.Value, XEditor.Value, WidthEditor.Value, YEditor.Value);
}
protected override void UpdateAccessibilityValues ()
{
XEditor.AccessibilityEnabled = XEditor.Enabled;
XEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityLeftEditor, ViewModel.Property.Name);
YEditor.AccessibilityEnabled = YEditor.Enabled;
YEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityTopEditor, ViewModel.Property.Name);
WidthEditor.AccessibilityEnabled = WidthEditor.Enabled;
WidthEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityRightEditor, ViewModel.Property.Name);
HeightEditor.AccessibilityEnabled = HeightEditor.Enabled;
HeightEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityBottomEditor, ViewModel.Property.Name);
}
protected override void UpdateValue ()
{
XEditor.Value = ViewModel.Value.Left;
YEditor.Value = ViewModel.Value.Top;
WidthEditor.Value = ViewModel.Value.Right;
HeightEditor.Value = ViewModel.Value.Bottom;
}
}
}
|