blob: 77e9f9889752a146e314e0db0771ff8445a00951 (
plain)
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
|
using System;
using System.Drawing;
using AppKit;
using CoreGraphics;
using Foundation;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.Mac.Resources;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Mac
{
internal abstract class SizeEditorControl<T> : BasePointEditorControl<T>
where T : struct
{
public SizeEditorControl (IHostResourceProvider hostResource)
: base (hostResource)
{
XLabel.StringValue = "WIDTH"; // TODO Localise
XEditor.Frame = new CGRect (0, 13, 90, 20);
YLabel.StringValue = "HEIGHT"; // TODO Localise
YEditor.Frame = new CGRect (132, 13, 90, 20);
}
public override nint GetHeight (EditorViewModel vm)
{
return 33;
}
protected override void UpdateAccessibilityValues ()
{
XEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityWidthEditor, ViewModel.Property.Name);
YEditor.AccessibilityTitle = string.Format (LocalizationResources.AccessibilityHeightEditor, ViewModel.Property.Name);
}
}
internal class SystemSizeEditorControl
: SizeEditorControl<Size>
{
public SystemSizeEditorControl (IHostResourceProvider hostResources)
: base (hostResources)
{
}
protected override void UpdateValue ()
{
XEditor.Value = ViewModel.Value.Width;
YEditor.Value = ViewModel.Value.Height;
}
}
internal class CommonSizeEditorControl
: SizeEditorControl<CommonSize>
{
public CommonSizeEditorControl (IHostResourceProvider hostResources)
: base (hostResources)
{
}
protected override void UpdateValue ()
{
XEditor.Value = ViewModel.Value.Width;
YEditor.Value = ViewModel.Value.Height;
}
}
}
|