コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #6
0
 public override bool TextShouldEndEditing(NSText textObject)
 {
     if (!ValidateFinalString(TextField.StringValue))
     {
         TextField.ResetInvalidInput();
         AppKitFramework.NSBeep();
         return(false);
     }
     return(TextField.ShouldEndEditing(textObject));
 }
コード例 #7
0
        public override bool ShouldBeginEditing(NSText textObject)
        {
            bool began = base.ShouldBeginEditing(textObject);

            if (began)
            {
                DialogController.TextBeingEdited = true;
                CocoaCloseButton.Enabled         = false;
            }
            return(began);
        }
コード例 #8
0
        public override bool ShouldEndEditing(NSText textObject)
        {
            bool ended = base.ShouldEndEditing(textObject);

            if (ended)
            {
                DialogController.TextBeingEdited = false;
                CocoaCloseButton.Enabled         = true;
            }
            return(ended);
        }
コード例 #9
0
ファイル: Util.cs プロジェクト: gabfr/MonoMac.Windows.Form
		//, 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;
		}
コード例 #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);
        }
コード例 #11
0
ファイル: SearchBar.cs プロジェクト: jtorres/monodevelop-1
            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);
            }
コード例 #12
0
ファイル: Util.cs プロジェクト: nagyist/MonoMac.Windows.Form
        //, 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);
        }
コード例 #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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #18
0
ファイル: CheckBoxTableCell.cs プロジェクト: thereverand/xwt
 public override void EndEditing(NSText textObj)
 {
     base.EndEditing(textObj);
 }
コード例 #19
0
ファイル: Util.cs プロジェクト: mcneel/MonoMac.Windows.Form
		//, 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);
		}
コード例 #20
0
 public override bool TextShouldBeginEditing(NSText textObject)
 {
     return(TextField.ShouldBeginEditing(textObject));
 }
コード例 #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);
 }
コード例 #22
0
 public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame(AdjustFrame(aRect), inView, editor, delegateObject, theEvent);
 }
コード例 #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);
		}
コード例 #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);
			}
コード例 #25
0
 public override bool TextShouldBeginEditing(NSControl control, NSText fieldEditor)
 {
     return(!_passwordBox.GetTarget()?.IsReadOnly ?? false);
 }
コード例 #26
0
 internal virtual bool TextFieldShouldBeginEditing(NSControl control, NSText fieldEditor)
 {
     return(!owner.ReadOnly && owner.Enabled);
 }
コード例 #27
0
ファイル: CheckBoxTableCell.cs プロジェクト: thereverand/xwt
 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);
 }
コード例 #28
0
 public override bool TextShouldBeginEditing(NSText textObject)
 {
     return(false);
 }
コード例 #29
0
 public override bool ShouldBeginEditing(NSText textObject)
 {
     textObject.Delegate = new FocusableComboBoxDelegate();
     return(false);
 }
コード例 #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);
			}
コード例 #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);
 }
コード例 #32
0
ファイル: CheckBoxTableCell.cs プロジェクト: neiz/xwt
 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);
 }
コード例 #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);
		}
コード例 #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);
            }
コード例 #35
0
ファイル: CheckBoxTableCell.cs プロジェクト: neiz/xwt
 public override void EndEditing(NSText textObj)
 {
     base.EndEditing (textObj);
 }
コード例 #36
0
ファイル: SearchBar.cs プロジェクト: jtorres/monodevelop-1
 // 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);
 }
コード例 #37
0
 public override void EditWithFrame(CGRect aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
 {
     base.EditWithFrame(VerticalCenteredRectForBounds(aRect), inView, editor, delegateObject, theEvent);
 }
コード例 #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;
		}
コード例 #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);
 }