Пример #1
0
        /// <summary>
        /// Divides this rectangle into two new rectangles.
        /// </summary>
        public void DivideRect(ref NSRect slice,
                               ref NSRect remainder,
		                       CGFloat amount,
                               NSRectEdge edge)
        {
            NSDivideRect(this, ref slice, ref remainder, amount, edge);
        }
Пример #2
0
        public void TestStaticCreation()
        {
            NSPoint refPoint = new NSPoint(1, 2);
            NSValue val = NSValue.ValueWithPoint(refPoint);
            Check(val);
            NSPoint point = val.PointValue;
            Assert.AreEqual(refPoint, point, "Points must be equal");

            NSRange refRange = new NSRange(3, 4);
            val = NSValue.ValueWithRange(refRange);
            Check(val);
            NSRange range = val.RangeValue;
            Assert.AreEqual(refRange, range, "Ranges must be equal");

            NSRect refRect = new NSRect(5, 6, 789, 789);
            val = NSValue.ValueWithRect(refRect);
            Check(val);
            NSRect rect = val.RectValue;
            Assert.AreEqual(refRect, rect, "Rectangles must be equal");

            NSSize refSize = new NSSize(456, 789);
            val = NSValue.ValueWithSize(refSize);
            Check(val);
            NSSize size = val.SizeValue;
            Assert.AreEqual(refSize, size, "Sizes must be equal");
        }
Пример #3
0
        public override void DrawRect(NSRect rect)
        {
            NSRect bounds = this.Bounds;
            float x = NSRect.NSMinX(bounds);
            float y = NSRect.NSMinY(bounds);
            float w = NSRect.NSWidth(bounds);
            float h = NSRect.NSHeight(bounds);
            float r = Math.Min(w/2, h/2);

            IntPtr context = NSGraphicsContext.CurrentContext.GraphicsPort;

            CGContext.TranslateCTM(context, x + w/2, y + h/2);

            CGContext.AddArc(context, 0, 0, r, 0, (float) (2*Math.PI), 1);
            CGContext.Clip(context);

            CGContext.SetGrayFillColor(context, 0.910f, 1);
            CGContext.FillRect(context, CGRect.CGRectMake(-w/2, -h/2, w, h));

            CGContext.AddArc(context, 0, 0, r, 0, (float) (2*Math.PI), 1);
            CGContext.SetGrayStrokeColor(context, 0.616f, 1);
            CGContext.StrokePath(context);

            CGContext.AddArc(context, 0, -2, r, 0, (float) (2*Math.PI), 1);
            CGContext.SetGrayStrokeColor(context, 0.784f, 1);
            CGContext.StrokePath(context);

            CGContext.MoveToPoint(context, 0, 0);
            CGContext.AddLineToPoint(context, r*this._offset.width, r*this._offset.height);

            CGContext.SetLineWidth(context, 2);
            CGContext.SetGrayStrokeColor(context, 0.33f, 1.0f);
            CGContext.StrokePath(context);
        }
Пример #4
0
        public override void DrawRect(NSRect aRect)
        {
            NSRect bounds = this.Bounds;
            CGFloat width = bounds.size.width;
            CGFloat height = bounds.size.height;

            NSColor.WhiteColor.Set ();
            AppKitFramework.NSRectFill (bounds);

            NSColor.ColorWithCalibratedWhiteAlpha (0.75, 1.0).Set ();
            AppKitFramework.NSFrameRect (new NSRect (0, -2, width + 2, height + 2));

            AppKitFramework.NSRectClip (bounds.OffsetRect (-1, 1));
            CGFloat offset = 2;
            NSGraphicsContext.CurrentContext.ShouldAntialias = false;

            for (int stripeIdx = 0; stripeIdx < 3; stripeIdx++) {
                offset++;

                NSColor.ColorWithCalibratedWhiteAlpha (0.85, 1.0).Set ();
                NSBezierPath.StrokeLineFromPointToPoint (new NSPoint (width - offset, 0), new NSPoint (width, offset));
                offset++;
                NSColor.ColorWithCalibratedWhiteAlpha (0.45, 1.0).Set ();
                NSBezierPath.StrokeLineFromPointToPoint (new NSPoint (width - offset, 0), new NSPoint (width, offset));
                offset++;
                NSColor.ColorWithCalibratedWhiteAlpha (0.75, 1.0).Set ();
                NSBezierPath.StrokeLineFromPointToPoint (new NSPoint (width - offset, 0), new NSPoint (width, offset));
                offset++;
            }
        }
Пример #5
0
 /// <summary>
 /// Returns a Boolean value that indicates whether one rectangle completely encloses another.
 /// </summary>
 /// <remarks>Original declaration is : BOOL NSContainsRect(NSRect aRect, NSRect bRect)</remarks>
 public static bool NSContainsRect(NSRect aRect, NSRect bRect)
 {
     return (!NSIsEmptyRect(bRect) &&
             (NSMinX(aRect) <= NSMinX((bRect))) &&
             (NSMinY(aRect) <= NSMinY((bRect))) &&
             (NSMaxX(aRect) >= NSMaxX((bRect))) &&
             (NSMaxY(aRect) >= NSMaxY((bRect))));
 }
Пример #6
0
 public CropMarker(NSView view)
 {
     this.target = view;
     this.setColor(NSColor.BlueColor);
     this.selectedPath = NSBezierPath.BezierPath;
     this.selectedPath.Retain();
     this.selectedRect = NSRect.NSZeroRect;
 }
Пример #7
0
 public override void DrawRect(NSRect aRect)
 {
     NSColor.WhiteColor.Set ();
     NSRect bounds = this.Bounds;
     AppKitFramework.NSRectFill (bounds);
     NSColor.ColorWithCalibratedWhiteAlpha (0.75, 1.0).Set ();
     AppKitFramework.NSFrameRect (bounds);
 }
Пример #8
0
 public override void DrawRect(NSRect rect)
 {
     this.SendMessageSuper(DragDropImageViewClass, "drawRect:", rect);
     if (this.highlight)
     {
         NSColor.GrayColor.Set();
         NSBezierPath.DefaultLineWidth = 5;
         NSBezierPath.StrokeRect(rect);
     }
 }
Пример #9
0
        public BoingView(NSRect frameRect)
            : base(frameRect)
        {
            doMultiSampleStuff = true;

            this.r = 48.0f;

            xVelocity = 1.5f;
            yVelocity = 0.0f;
            xPos = r * 2.0f;
            yPos = r * 3.0f;
        }
Пример #10
0
        public override void DrawRect(NSRect rect)
        {
            // Obtain the current context
            IntPtr ctx = NSGraphicsContext.CurrentContext.GraphicsPort;

            // Draw the image in the context
            ImageUtils.IIDrawImageTransformed(ref this.image, ctx, CGRect.CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height));

            // Draw the view border, just a simple stroked rectangle
            CGContext.AddRect(ctx, CGRect.CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height));
            CGContext.SetRGBStrokeColor(ctx, 1.0f, 0.0f, 0.0f, 1.0f);
            CGContext.StrokePath(ctx);
        }
Пример #11
0
 /// <summary>
 /// Returns a Boolean value that indicates whether this rectangle and the specified rectangle intersect.
 /// </summary>
 public bool IntersectsRect(NSRect aRect)
 {
     return NSIntersectsRect(this, aRect);
 }
Пример #12
0
        public override void DrawRect(NSRect aRect)
        {
            int i;
            float[] lightModelAmbient = new float[4];
            float[] lightSpecular = new float[4];

            if (!this.didInit) {
                NSColor.ClearColor.Set ();
                AppKitFramework.NSRectFill (this.Bounds);
                this.OpenGLContext.SetValuesForParameter (new int[] { 0 }, NSOpenGLContextParameter.NSOpenGLCPSurfaceOpacity);
                this.Window.IsOpaque = false;
                this.Window.AlphaValue = 0.999f;
                this.Window.IsMovableByWindowBackground = true;

                this.generateBoingData ();
                this.didInit = true;
                screenBounds = NSScreen.MainScreen.Frame;
                angleDelta = -2.5f;
                GL.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
                GL.glClear (GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
                this.OpenGLContext.FlushBuffer ();
                bgFade = 1.0f;
                lightFactor = 0.0f;
                scaleFactor = 1.0f;
                bounceInsideWindow = true;
                if (doMultiSampleStuff) {
                    GL.glDisable (GL.GL_MULTISAMPLE_ARB);
                    GL.glHint (GL.GL_MULTISAMPLE_FILTER_HINT_NV, GL.GL_NICEST);
                }
            }

            if (enableMultiSample)
                GL.glEnable (GL.GL_MULTISAMPLE_ARB);

            if (doTransparency == 2) {
                bgFade -= 0.05f;
                if (bgFade < 0.0f)
                    bgFade = 0.0f;
            }

            if (doLight) {
                lightFactor += 0.005f;
                if (lightFactor > 1.0f) {
                    lightFactor = 1.0f;
                    doLight = false;
                }
            }

            if (doScale) {
                float oldr = r;
                scaleFactor += 0.025f;
                r = scaleFactor * 48.0f;
                yPos += r - oldr;

                if (scaleFactor > 2.0f) {
                    scaleFactor = 2.0f;
                    doScale = false;
                }
                this.generateBoingData ();
            }

            GL.glViewport (0, 0, (int)this.Bounds.size.width, (int)this.Bounds.size.height);

            GL.glScissor (0, 0, (int) (320 * scaleFactor), (int) (200 * scaleFactor));
            GL.glEnable (GL.GL_SCISSOR_TEST);
            GL.glClearColor (0.675f * bgFade, 0.675f * bgFade, 0.675f * bgFade, bgFade);
            GL.glClear (GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

            GL.glMatrixMode (GL.GL_PROJECTION);
            GL.glLoadIdentity ();
            GL.glOrtho (0, this.Bounds.size.width, 0, this.Bounds.size.height, 0.0f, 2000.0);

            GL.glDisable (GL.GL_LIGHTING);
            GL.glEnable (GL.GL_LIGHT0);

            GL.glLightModeli (GL.GL_LIGHT_MODEL_LOCAL_VIEWER, (int)GL.GL_FALSE);
            GL.glLightModeli (GL.GL_LIGHT_MODEL_TWO_SIDE, (int)GL.GL_FALSE);
            lightModelAmbient[0] = 1.0f - lightFactor;
            lightModelAmbient[1] = 1.0f - lightFactor;
            lightModelAmbient[2] = 1.0f - lightFactor;
            lightModelAmbient[3] = 1.0f - lightFactor;
            GL.glLightModelfv (GL.GL_LIGHT_MODEL_AMBIENT, lightModelAmbient);

            // Directional white light
            GL.glLightfv (GL.GL_LIGHT0, GL.GL_AMBIENT, light0Ambient);
            GL.glLightfv (GL.GL_LIGHT0, GL.GL_DIFFUSE, light0Diffuse);
            lightSpecular[0] = lightFactor;
            lightSpecular[1] = lightFactor;
            lightSpecular[2] = lightFactor;
            lightSpecular[3] = lightFactor;
            GL.glLightfv (GL.GL_LIGHT0, GL.GL_SPECULAR, lightSpecular);

            // Material properties
            GL.glEnable (GL.GL_COLOR_MATERIAL);
            GL.glEnable (GL.GL_NORMALIZE);
            GL.glColorMaterial (GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
            GL.glMaterialfv (GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, materialShininess);
            GL.glMaterialfv (GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, materialSpecular);
            GL.glMaterialfv (GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, materialEmission);

            // Reset transformation matrix and set light position.
            GL.glMatrixMode (GL.GL_MODELVIEW);
            GL.glLoadIdentity ();
            GL.glLightfv (GL.GL_LIGHT0, GL.GL_POSITION, light0Position);

            // I'm doing the scaling myself (rather than using OpenGL) just because
            // I want to get exact positioning of the lines.  There is probably a better
            // way to do this if I'd try harder with the math.  Hey, it's a demo. ;)
            if (bgFade > 0.0f) {
                GL.glDepthMask ((byte)GL.GL_FALSE);
                GL.glDisable (GL.GL_DEPTH_TEST);

                GL.glBegin (GL.GL_LINES);
                GL.glColor4f (0.6275f * bgFade, 0.0f, 0.6275f * bgFade, bgFade);
                for (i = 40; i <= 280; i += 16) {
                    GL.glVertex3f ((float)Math.Floor (i * scaleFactor) + 0.5f,(float) Math.Floor (7 * scaleFactor) + 0.5f, -500.0f);
                    GL.glVertex3f ((float)Math.Floor (i * scaleFactor) + 0.5f, (200 * scaleFactor) + 0.5f, -500.0f);

                    // Do stragglers along the bottom. Not exactly the same as
                    // the original, but close enough.
                    GL.glVertex3f ((float)Math.Floor (i * scaleFactor) + 0.5f, (float)Math.Floor (7 * scaleFactor) + 0.5f, -500.0f);
                    GL.glVertex3f ((i - 160) * scaleFactor * 1.1f + 160.0f * scaleFactor, -0.5f, -500.0f);
                }
                for (i = 8; i <= 200; i += 16) {
                    GL.glVertex3f (40.0f * scaleFactor, (float)Math.Floor (i * scaleFactor) - 0.5f, -500.0f);
                    GL.glVertex3f (280.0f * scaleFactor, (float)Math.Floor (i * scaleFactor) - 0.5f, -500.0f);
                }
                // Do final two horizontal lines
                GL.glVertex3f ((float)Math.Floor ((40.0f - 3.0f) * scaleFactor) + 0.5f, (float)Math.Floor ((7.0f - 2.0f) * scaleFactor) + 0.5f, -500.0f);
                GL.glVertex3f ((float)Math.Floor ((280.0f + 3.0f) * scaleFactor) + 0.5f, (float)Math.Floor ((7.0 - 2.0f) * scaleFactor) + 0.5f, -500.0f);
                GL.glVertex3f ((float)Math.Floor ((40.0f - 8.0f) * scaleFactor) + 0.5f, (float)Math.Floor ((7.0f - 5.0f) * scaleFactor) + 0.5f, -500.0f);
                GL.glVertex3f ((float)Math.Floor ((280.0f + 8.0f) * scaleFactor) + 0.5f, (float)Math.Floor ((7.0f - 5.0f) * scaleFactor) + 0.5f, -500.0f);
                GL.glEnd ();
            }

            GL.glLoadIdentity ();

            // Draw "shadow"
            GL.glEnable (GL.GL_CULL_FACE);
            if (bounceInsideWindow)
                GL.glTranslatef (xPos + 10, yPos - 2, -800.0f);
            else
                GL.glTranslatef (r + 10, r - 2, -800.0f);
            GL.glRotatef (-16.0f, 0.0f, 0.0f, 1.0f);
            GL.glRotatef (angle, 0.0f, 1.0f, 0.0f);
            GL.glScalef (1.05f, 1.05f, 1.05f);

            GL.glEnable (GL.GL_BLEND);
            GL.glBlendFunc (GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE_MINUS_SRC_ALPHA);

            GL.glBegin (GL.GL_QUADS);
            GL.glColor4f (0.0f, 0.0f, 0.0f, 0.4f);
            for (i = 0; i < 4 * 8 * 16; i++) {
                Vertex v1 = boingData[i];
                Vertex v2 = boingData[i &  ~3];
                GL.glNormal3f(v2.nx, v2.ny, v2.nz);
                GL.glVertex3f(v1.x, v1.y, v1.z);
                //GL.glNormal3fv (&boingData[i & ~3].nx);
                //GL.glVertex3fv (&boingData[i].x);
            }
            GL.glEnd ();

            // Draw real boing
            GL.glEnable (GL.GL_LIGHTING);
            GL.glEnable (GL.GL_CULL_FACE);
            GL.glEnable (GL.GL_DEPTH_TEST);
            GL.glDepthMask ((byte)GL.GL_TRUE);
            GL.glDepthFunc (GL.GL_LESS);
            GL.glDisable (GL.GL_BLEND);

            GL.glLoadIdentity ();

            if (bounceInsideWindow)
                GL.glTranslatef (xPos, yPos, -100.0f);
            else
                GL.glTranslatef (r, r, -100.0f);
            GL.glRotatef (-16.0f, 0.0f, 0.0f, 1.0f);
            GL.glRotatef (angle, 0.0f, 1.0f, 0.0f);

            GL.glBegin (GL.GL_QUADS);
            for (i = 0; i < 4 * 8 * 16; i++) {
                Vertex v1 = boingData[i];
                Vertex v2 = boingData[i &  ~3];
                GL.glColor4f(v1.r, v1.g, v1.b, v1.a);
                GL.glNormal3f(v2.nx, v2.ny, v2.nz);
                GL.glVertex3f(v1.x, v1.y, v1.z);
            }
            GL.glEnd ();

            GL.glDisable (GL.GL_LIGHTING);

            angle += angleDelta;
            if (angle < 0.0f)
                angle += 360.0f; else if (angle > 360.0f)
                angle -= 360.0f;

            this.OpenGLContext.FlushBuffer ();
        }
Пример #13
0
 /// <summary>
 /// Calculates the intersection of this rectangle with the specified rectangle.
 /// </summary>
 public NSRect IntersectionRect(NSRect aRect)
 {
     return NSIntersectionRect(this, aRect);
 }
Пример #14
0
 /// <summary>
 /// Creates a rectangle as the union of this rectangle and the specified rectangle.
 /// </summary>
 public NSRect UnionRect(NSRect aRect)
 {
     return NSUnionRect(this, aRect);
 }
Пример #15
0
 /// <summary>
 /// Returns a Boolean value that indicates whether this rectangle completely encloses another.
 /// </summary>
 public bool ContainsRect(NSRect aRect)
 {
     return NSContainsRect(this, aRect);
 }
Пример #16
0
        public override Id InitWithFrame(NSRect frameRect)
        {
            //uint[] attribsNice = new uint[] { (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAAccelerated, (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFADoubleBuffer, (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFADepthSize, 24, (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAAlphaSize, 8, (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAColorSize, 32, (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFANoRecovery, (uint)CGLPixelFormatAttribute.kCGLPFASampleBuffers, 1, (uint)NSOpenGLPixelFormatAttribute.kCGLPFASamples, 2, 0 };

            uint[] attribsJaggy = new uint[] {
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAAccelerated,
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFADoubleBuffer,
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFADepthSize, 24,
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAAlphaSize, 8,
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFAColorSize, 32,
                (uint)NSOpenGLPixelFormatAttribute.NSOpenGLPFANoRecovery,
                0 };

            NSOpenGLPixelFormat fmt = new NSOpenGLPixelFormat (attribsJaggy);

            this.SendMessage<IntPtr>("initWithFrame:pixelFormat:", frameRect, fmt);

            fmt.Release ();

            return this;
        }
Пример #17
0
 private static NSPoint MakeRandomPointInRect(NSRect rect)
 {
     NSPoint p;
     p.x = NSRect.NSMinX(rect) + NSRect.NSWidth(rect)*((float) r.NextDouble());
     p.y = NSRect.NSMinY(rect) + NSRect.NSHeight(rect)*((float) r.NextDouble());
     return p;
 }
        public override Id InitWithFrame(NSRect frame)
        {
            this.NativePointer = this.SendMessageSuper<IntPtr>(SpeakingCharacterViewClass, "initWithFrame:", frame);

            this.LoadChacaterByName("Buster");
            this.SetExpression(kCharacterExpressionIdentifierSleep);

            this.RegisterForDraggedTypes(NSImage.ImagePasteboardTypes);

            return this;
        }
Пример #19
0
 public SplitView(NSRect frameRect)
     : base(frameRect)
 {
 }
        public override void DrawRect(NSRect rect)
        {
            NSPoint thePointToDraw;
            NSSize sourceSize = this._curFrameImage.Size;
            NSSize destSize = rect.size;

            if (destSize.width >= sourceSize.width)
            {
                thePointToDraw.x = (destSize.width - sourceSize.width)/2;
            }
            else
            {
                thePointToDraw.x = 0;
            }

            if (destSize.height >= sourceSize.height)
            {
                thePointToDraw.y = (destSize.height - sourceSize.height)/2;
            }
            else
            {
                thePointToDraw.y = 0;
            }

            this._curFrameImage.CompositeToPointOperationFraction(thePointToDraw, NSCompositingOperation.NSCompositeSourceOver, 1.0f);
        }
Пример #21
0
partial         void GoFullScreen(Id sender)
        {
            this.isInFullScreenMode = true;

            // Pause the non-fullscreen view
            this.openGLView.StopAnimation ();

            // Mac OS X 10.6 and later offer a simplified mechanism to create full-screen contexts
            NSRect mainDisplayRect, viewRect;

            // Create a screen-sized window on the display you want to take over
            // Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display
            mainDisplayRect = NSScreen.MainScreen.Frame;
            this.fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyleMask.NSBorderlessWindowMask, NSBackingStoreType.NSBackingStoreBuffered, true);

            // Set the window level to be above the menu bar
            this.fullScreenWindow.Level = NSWindow.NSMainMenuWindowLevel + 1;

            // Perform any other window configuration you desire
            this.fullScreenWindow.IsOpaque = true;
            this.fullScreenWindow.HidesOnDeactivate = true;

            // Create a view with a double-buffered OpenGL context and attach it to the window
            // By specifying the non-fullscreen context as the shareContext, we automatically inherit the OpenGL objects (textures, etc) it has defined
            viewRect = new NSRect (0, 0, mainDisplayRect.size.width, mainDisplayRect.size.height);
            this.fullScreenView = new MyOpenGLView (viewRect, this.openGLView.OpenGLContext);
            this.fullScreenWindow.ContentView = this.fullScreenView;

            // Set the scene with the full-screen viewport and viewing transformation
            this.scene.SetViewportRect (viewRect);

            // Assign the view's MainController to self
            this.fullScreenView.MainController = this;

            // Show the window
            this.fullScreenWindow.MakeKeyAndOrderFront (this);

            if (!this.isAnimating) {
                // Mark the view as needing drawing to initalize its contents
                this.fullScreenView.NeedsDisplay = true;
            } else {
                // Start playing the animation
                this.fullScreenView.StartAnimation ();
            }
        }
Пример #22
0
 public ResizableView(NSRect frameRect)
     : base(frameRect)
 {
 }
Пример #23
0
 public DragThumbView(NSRect frameRect)
     : base(frameRect)
 {
 }
Пример #24
0
        public override void DrawRect(NSRect rect)
        {
            IntPtr context = NSGraphicsContext.CurrentContext.GraphicsPort;

            CGContext.SetRGBFillColor(context, 0.7f, 0.7f, 0.9f, 1f);
            CGContext.FillRect(context, ConvertToCGRect(rect));

            CGContext.SetShadow(context, this.shadowOffset, this.shadowRadius);

            if (this.useTLayer)
            {
                CGContext.BeginTransparencyLayer(context, null);
            }

            uint count = this.circles.Count;
            for (uint k = 0; k < count; k++)
            {
                Circle circle = this.circles.ObjectAtIndex(k).CastTo<Circle>();
                NSRect bounds = this.BoundsForCircle(circle);
                if (NSRect.NSIntersectsRect(bounds, rect))
                {
                    circle.Draw();
                }
            }

            if (this.useTLayer)
            {
                CGContext.EndTransparencyLayer(context);
            }
        }
Пример #25
0
 public override void DrawRect(NSRect aRect)
 {
     NSColor.BlackColor.Set ();
     AppKitFramework.NSRectFill (aRect);
 }
Пример #26
0
        public override Id InitWithFrame(NSRect frame)
        {
            Id self = ObjectiveCRuntime.SendMessageSuper<Id>(this, Class.Get(typeof (TLayerView)), "initWithFrame:", frame);
            if (self == null)
            {
                return null;
            }

            this.useTLayer = false;
            this.circles = new NSMutableArray(CIRCLE_COUNT);

            for (int k = 0; k < CIRCLE_COUNT; k++)
            {
                NSColor color = NSColor.ColorWithCalibratedRedGreenBlueAlpha(colors[k][0], colors[k][1], colors[k][2], colors[k][3]);
                Circle circle = new Circle();
                circle.Color = color;
                circle.Radius = circleRadius;
                circle.Center = MakeRandomPointInRect(this.Bounds);
                this.circles.AddObject(circle);
                circle.Release();
            }

            this.RegisterForDraggedTypes(NSArray.ArrayWithObject(NSPasteboard.NSColorPboardType));
            this.NeedsDisplay = true;

            return self;
        }
Пример #27
0
 public NSRect WindowWillUseStandardFrameDefaultFrame(NSWindow window, NSRect newFrame)
 {
     NSRect contentRect = this.Window.Frame;
     contentRect.size = this.Image.Size;
     return NSWindow.FrameRectForContentRectStyleMask(contentRect, window.StyleMask);
 }
Пример #28
0
 public void SetFrame(NSRect frame)
 {
     ObjectiveCRuntime.SendMessageSuper(this, Class.Get(typeof (TLayerView)), "setFrame:", frame);
     this.NeedsDisplay = true;
 }
Пример #29
0
 public AnimatedView(NSRect frameRect)
     : base(frameRect)
 {
 }
Пример #30
0
 private static CGRect ConvertToCGRect(NSRect rect)
 {
     return CGRect.CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
 }