forked from xamarin/mac-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewController.cs
55 lines (44 loc) · 1.08 KB
/
ViewController.cs
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
using System;
using AppKit;
using Foundation;
namespace CircleView
{
public partial class ViewController : NSViewController
{
public ViewController (IntPtr handle) : base (handle)
{
}
partial void ApplyRadius (Foundation.NSObject sender)
{
CircleView.Radius = ((NSSlider)sender).DoubleValue;
}
partial void ApplyColor (Foundation.NSObject sender)
{
CircleView.TextColor = ((NSColorWell)sender).Color;
}
partial void ApplySpin (Foundation.NSObject sender)
{
CircleView.ToggleAnimation ();
}
partial void ApplyStartingAngle (Foundation.NSObject sender)
{
CircleView.StartingAngle = ((NSSlider)sender).DoubleValue;
}
partial void ApplyText (Foundation.NSObject sender)
{
CircleView.Text = ((NSTextField)sender).StringValue;
}
public override void MouseDown (NSEvent theEvent)
{
AdjustView (theEvent);
}
public override void MouseDragged (NSEvent theEvent)
{
AdjustView (theEvent);
}
void AdjustView (NSEvent theEvent)
{
CircleView.Center = CircleView.ConvertPointFromView (theEvent.LocationInWindow, CircleView);
}
}
}