Exemplo n.º 1
0
        public override void SelectWithFrame(RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, int selStart, int selLength)
        {
            RectangleF textFrame, imageFrame;

            aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
            base.SelectWithFrame(textFrame, inView, editor, delegateObject, selStart, selLength);
        }
Exemplo n.º 2
0
        public override void EditWithFrame(RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
        {
            RectangleF textFrame, imageFrame;

            aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
            base.EditWithFrame(textFrame, inView, editor, delegateObject, theEvent);
        }
Exemplo n.º 3
0
        public SparkleWindow()
            : base()
        {
            SetFrame (new RectangleF (0, 0, 640, 480), true);

            Center ();

            StyleMask = (NSWindowStyle.Closable |
                         NSWindowStyle.Miniaturizable |
                         NSWindowStyle.Titled);

            MaxSize     = new SizeF (640, 480);
            MinSize     = new SizeF (640, 480);
            HasShadow   = true;
            BackingType = NSBackingStore.Buffered;

            SideSplash = new NSImage (NSBundle.MainBundle.ResourcePath + "/Pixmaps/side-splash.png");
            SideSplash.Size = new SizeF (150, 480);

            NSText tv = new NSText (new RectangleF (200, 200, 200, 200)) {
                Value = "TEST"
            };

            ContentView.AddSubview (new NSImageView (new RectangleF (0, 0, 150, 480)) { Image = SideSplash});
            ContentView.AddSubview (new NSTextField (new RectangleF (200, 100, 128, 31)) { BezelStyle = NSTextFieldBezelStyle.Rounded});
            ContentView.AddSubview (tv);

            NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
            MakeKeyAndOrderFront (this);
        }
Exemplo n.º 4
0
        public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
        {
            var actualRect = DrawingRectForBounds(aRect);

            _isSelecting = true;
            base.SelectWithFrame(actualRect, inView, editor, delegateObject, selStart, selLength);
            _isSelecting = false;
        }
Exemplo n.º 5
0
        public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
        {
            var actualRect = DrawingRectForBounds(aRect);

            _isEditing = true;
            base.EditWithFrame(actualRect, inView, editor, delegateObject, theEvent);
            _isEditing = false;
        }
Exemplo n.º 6
0
 public override bool TextShouldEndEditing(NSText textObject)
 {
     if (!ValidateFinalString(TextField.StringValue))
     {
         TextField.ResetInvalidInput();
         AppKitFramework.NSBeep();
         return(false);
     }
     return(TextField.ShouldEndEditing(textObject));
 }
Exemplo n.º 7
0
        public override bool ShouldBeginEditing(NSText textObject)
        {
            bool began = base.ShouldBeginEditing(textObject);

            if (began)
            {
                DialogController.TextBeingEdited = true;
                CocoaCloseButton.Enabled         = false;
            }
            return(began);
        }
Exemplo n.º 8
0
        public override bool ShouldEndEditing(NSText textObject)
        {
            bool ended = base.ShouldEndEditing(textObject);

            if (ended)
            {
                DialogController.TextBeingEdited = false;
                CocoaCloseButton.Enabled         = true;
            }
            return(ended);
        }
Exemplo n.º 9
0
		//, SizeF size)
		public static SizeF MeasureString (string inString, Font font)
		{
			
						/*NSTextStorage textStorage = new NSTextStorage();
			textStorage.
			NSTextContainer textContainer = new NSTextContainer(size);
			NSLayoutManager layoutManager = new NSLayoutManager();
			*/
var tv = new NSText { Font = font.ToNsFont (), Value = inString };
			tv.SizeToFit ();
			return tv.Frame.Size;
		}
Exemplo n.º 10
0
        public override bool TextShouldEndEditing(NSControl control, NSText fieldEditor)
        {
            if (!CanGetValue(fieldEditor.Value))
            {
                NSTextField text = (NSTextField)control;
                text.StringValue = this.lastValid;
                AppKitFramework.NSBeep();
                return(false);
            }

            return(true);
        }
Exemplo n.º 11
0
            public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
            {
                nfloat xOffset = 0;

                if (IdeApp.Preferences.UserInterfaceTheme == Theme.Dark)
                {
                    xOffset = -1.5f;
                }
                // y does not appear to affect anything. Whatever value is set here for y will always be 1px below the
                // placeholder text
                aRect = new CGRect(aRect.X + xOffset, aRect.Y, aRect.Width, aRect.Height);
                base.SelectWithFrame(aRect, inView, editor, delegateObject, selStart, selLength);
            }
Exemplo n.º 12
0
        //, SizeF size)
        public static SizeF MeasureString(string inString, Font font)
        {
            /*NSTextStorage textStorage = new NSTextStorage();
             *          textStorage.
             *          NSTextContainer textContainer = new NSTextContainer(size);
             *          NSLayoutManager layoutManager = new NSLayoutManager();
             */
            var tv = new NSText {
                Font = font.ToNsFont(), Value = inString
            };

            tv.SizeToFit();
            return(tv.Frame.Size);
        }
Exemplo n.º 13
0
        public override bool ShouldBeginEditing(NSText fieldEditor)
        {
            CachedCurrentEditor = fieldEditor;
            cachedValueString   = fieldEditor.Value;

            if (AllowRatios)
            {
                CachedCurrentEditor.Delegate = new RatioValidateDelegate(this);
            }
            else
            {
                CachedCurrentEditor.Delegate = new NumericValidationDelegate(this);
            }
            return(true);
        }
        public override bool ShouldBeginEditing(NSText textObject)
        {
            CachedCurrentEditor    = textObject;
            this.cachedValueString = textObject.Value;

            if (AllowRatios)
            {
                CachedCurrentEditor.Delegate = new RatioValidateDelegate(this);
            }
            else
            {
                CachedCurrentEditor.Delegate = new NumericValidationDelegate(this);
            }
            return(true);
        }
        public override bool TextShouldEndEditing(NSText textObject)
        {
            bool shouldEndEditing = false;

            if (!ValidateFinalString(textObject.Value))
            {
                TextField.ResetInvalidInput();
                AppKitFramework.NSBeep();
                TextField.ShouldEndEditing(textObject);
            }
            else
            {
                shouldEndEditing = TextField.ShouldEndEditing(textObject);
            }

            return(shouldEndEditing);
        }
Exemplo n.º 16
0
        //, SizeF size)
        public static SizeF MeasureString(string inString, Font font)
        {
            /*
             * NSTextStorage textStorage = new NSTextStorage();
             * textStorage.
             * NSTextContainer textContainer = new NSTextContainer(size);
             * NSLayoutManager layoutManager = new NSLayoutManager();
             */
            var tv = new NSText {
                Font = font.ToNsFont(), Value = inString
            };

            tv.SizeToFit();
            float w = (float)tv.Frame.Size.Width;
            float h = (float)tv.Frame.Size.Height;

            return(new SizeF(w, h));
        }
Exemplo n.º 17
0
        internal virtual Size InternalGetPreferredSize(Size proposed)
        {
            Size size;

            if (Text == string.Empty)
            {
                size = new Size(0, Font.Height);
            }
            else
            {
                var txt = new NSText();
                txt.Value = Text;
                txt.Font  = Font.ToNsFont();
                txt.SizeToFit();
                size = Size.Round(txt.Frame.Size);
            }

#if NET_2_0
            size.Width  += Padding.Horizontal;
            size.Height += Padding.Vertical;

            if (!use_compatible_text_rendering)
            {
                return(size);
            }
#else
            size.Height = Font.Height;
#endif

            if (border_style == BorderStyle.None)
            {
                size.Height += 3;
            }
            else
            {
                size.Height += 6;
            }

            return(size);
        }
Exemplo n.º 18
0
 public override void EndEditing(NSText textObj)
 {
     base.EndEditing(textObj);
 }
Exemplo n.º 19
0
		//, SizeF size)
		public static SizeF MeasureString (string inString, Font font)
		{
			/*
			NSTextStorage textStorage = new NSTextStorage();
			textStorage.
			NSTextContainer textContainer = new NSTextContainer(size);
			NSLayoutManager layoutManager = new NSLayoutManager();
			*/
			var tv = new NSText { Font = font.ToNsFont (), Value = inString };
			tv.SizeToFit ();
			float w = (float)tv.Frame.Size.Width;
			float h = (float)tv.Frame.Size.Height;
			return new SizeF (w, h);
		}
 public override bool TextShouldBeginEditing(NSText textObject)
 {
     return(TextField.ShouldBeginEditing(textObject));
 }
Exemplo n.º 21
0
 public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
 {
     base.SelectWithFrame(AdjustFrame(aRect), inView, editor, delegateObject, selStart, selLength);
 }
Exemplo n.º 22
0
 public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame(AdjustFrame(aRect), inView, editor, delegateObject, theEvent);
 }
Exemplo n.º 23
0
		public override void SelectWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, int selStart, int selLength)
		{
			RectangleF textFrame, imageFrame;
			aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
			base.SelectWithFrame(textFrame, inView, editor, delegateObject, selStart, selLength);
		}
Exemplo n.º 24
0
			public override void SelectWithFrame (CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
			{
				nfloat xOffset = 0;
				if (IdeApp.Preferences.UserInterfaceTheme == Theme.Dark) {
					xOffset = -1.5f;
				}
				// y does not appear to affect anything. Whatever value is set here for y will always be 1px below the
				// placeholder text
				aRect = new CGRect (aRect.X + xOffset, aRect.Y, aRect.Width, aRect.Height);
				base.SelectWithFrame (aRect, inView, editor, delegateObject, selStart, selLength);
			}
Exemplo n.º 25
0
 public override bool TextShouldBeginEditing(NSControl control, NSText fieldEditor)
 {
     return(!_passwordBox.GetTarget()?.IsReadOnly ?? false);
 }
 internal virtual bool TextFieldShouldBeginEditing(NSControl control, NSText fieldEditor)
 {
     return(!owner.ReadOnly && owner.Enabled);
 }
Exemplo n.º 27
0
 public override void EditWithFrame(System.Drawing.RectangleF aRect, NSView inView, NSText editor, MonoMac.Foundation.NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame(aRect, inView, editor, delegateObject, theEvent);
 }
Exemplo n.º 28
0
 public override bool TextShouldBeginEditing(NSText textObject)
 {
     return(false);
 }
Exemplo n.º 29
0
 public override bool ShouldBeginEditing(NSText textObject)
 {
     textObject.Delegate = new FocusableComboBoxDelegate();
     return(false);
 }
Exemplo n.º 30
0
			// When customising the NSCell these are the methods which determine
			// where the editing and selecting text appears
			public override void EditWithFrame (CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
			{
				aRect = new CGRect (aRect.X, aRect.Y + 10, aRect.Width - 66, aRect.Height);
				base.EditWithFrame (aRect, inView, editor, delegateObject, theEvent);
			}
Exemplo n.º 31
0
 public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
 {
     base.SelectWithFrame(VerticalCenteredRectForBounds(aRect), inView, editor, delegateObject, selStart, selLength);
 }
Exemplo n.º 32
0
 public override void EditWithFrame(System.Drawing.RectangleF aRect, NSView inView, NSText editor, MonoMac.Foundation.NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame (aRect, inView, editor, delegateObject, theEvent);
 }
Exemplo n.º 33
0
		public override void EditWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
		{
			RectangleF textFrame, imageFrame;
			aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
			base.EditWithFrame(textFrame, inView, editor, delegateObject, theEvent);
		}
Exemplo n.º 34
0
            public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
            {
                var bounds = DrawingRectForBounds(aRect);

                base.SelectWithFrame(bounds, inView, editor, delegateObject, selStart, selLength);
            }
Exemplo n.º 35
0
 public override void EndEditing(NSText textObj)
 {
     base.EndEditing (textObj);
 }
Exemplo n.º 36
0
 // When customising the NSCell these are the methods which determine
 // where the editing and selecting text appears
 public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
 {
     aRect = new CGRect(aRect.X, aRect.Y + 10, aRect.Width - 66, aRect.Height);
     base.EditWithFrame(aRect, inView, editor, delegateObject, theEvent);
 }
Exemplo n.º 37
0
 public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame(VerticalCenteredRectForBounds(aRect), inView, editor, delegateObject, theEvent);
 }
Exemplo n.º 38
0
		internal virtual Size InternalGetPreferredSize (Size proposed)
		{
			Size size;

			if (Text == string.Empty) {
				size = new Size (0, Font.Height);
			} else {
				var txt = new NSText();
				txt.Value = Text;
				txt.Font = Font.ToNsFont();
				txt.SizeToFit();
				size = Util.NSSizeToSize(txt.Frame.Size);
			}

#if NET_2_0
			size.Width += Padding.Horizontal;
			size.Height += Padding.Vertical;
			
			if (!use_compatible_text_rendering)
				return size;
#else
				size.Height = Font.Height;
#endif

			if (border_style == BorderStyle.None)
				size.Height += 3;
			else
				size.Height += 6;
			
			return size;
		}
Exemplo n.º 39
0
 public override void SelectWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, nint selStart, nint selLength)
 {
     aRect = AdjustBoundsForImage(aRect);
     base.SelectWithFrame(aRect, inView, editor, delegateObject, selStart, selLength);
 }