~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/monomac/samples/AnimatedClock/ClockLayer.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Linq;
 
4
using System.Drawing;
 
5
using System.Timers;
 
6
 
 
7
using MonoMac.Foundation;
 
8
using MonoMac.AppKit;
 
9
using MonoMac.CoreAnimation;
 
10
using MonoMac.CoreGraphics;
 
11
 
 
12
namespace AnimatedClock
 
13
{
 
14
        class ClockLayer : CALayer {
 
15
                public ClockLayer ()
 
16
                {
 
17
                }
 
18
                
 
19
                [Export ("initWithLayer:")]
 
20
                public ClockLayer (CALayer other)
 
21
                        : base (other)
 
22
                {
 
23
                }
 
24
                
 
25
                public override void Clone (CALayer other)
 
26
                {
 
27
                        ClockColor = ((ClockLayer) other).ClockColor;
 
28
                        base.Clone (other);
 
29
                }
 
30
                
 
31
                [Export ("clockColor")]
 
32
                public CGColor ClockColor { get; set; }
 
33
                
 
34
                [Export ("needsDisplayForKey:")]
 
35
                static bool NeedsDisplayForKey (NSString key)
 
36
                {
 
37
                        switch (key.ToString ()) {
 
38
                        case "clockColor":
 
39
                                return true;
 
40
                        default:
 
41
                                return CALayer.NeedsDisplayForKey (key);
 
42
                        }
 
43
                }
 
44
 
 
45
                public override void DrawInContext (CGContext context)
 
46
                {
 
47
                        base.DrawInContext (context);
 
48
                        
 
49
                        context.AddEllipseInRect (Bounds);
 
50
                        context.SetFillColor (ClockColor);
 
51
                        context.FillPath ();
 
52
                }
 
53
        }
 
54
}