Example #1
0
        public void SetAttributes(NSDictionary attributes, NSRange range)
        {
            if (attributes == null)
                throw new ArgumentNullException ("attributes");

            LowLevelSetAttributes (attributes.Handle, range);
        }
Example #2
0
 public unsafe nuint[] GetIndexes(NSRange range)
 {
     var ret = new nuint [range.Length];
     fixed (nuint *ptr = ret)
         _GetIndexes ((IntPtr) ptr, range);
     return ret;
 }
Example #3
0
 public unsafe CLLocationCoordinate2D[] GetCoordinates(int first, int count)
 {
     var range = new NSRange (first, count);
     var target = new CLLocationCoordinate2D [count];
     fixed (CLLocationCoordinate2D *firstE = &target [0]){
         GetCoords ((IntPtr) firstE, range);
     }
     return target;
 }
Example #4
0
        public CGRect[] GetRectArray(NSRange glyphRange, NSRange selectedGlyphRange, NSTextContainer textContainer)
        {
            if (textContainer == null)
                throw new ArgumentNullException ("textContainer");

            nuint rectCount;
            var retHandle = GetRectArray (glyphRange, selectedGlyphRange, textContainer.Handle, out rectCount);
            var returnArray = new CGRect [rectCount];

            unsafe {
                float *ptr = (float*) retHandle;
                for (nuint i = 0; i < rectCount; ++i) {
                    returnArray [i] = new CGRect (ptr [0], ptr [1], ptr [2], ptr [3]);
                    ptr += 4;
                }
            }
            return returnArray;
        }
Example #5
0
		public unsafe nuint GetGlyphs (
			NSRange glyphRange, 
			short[] /* CGGlyph* = CGFontIndex* = unsigned short* */ glyphBuffer,
			NSGlyphProperty[] /* NSGlyphProperty* = nint* */ props,
			nuint[] /* NSUInteger */ charIndexBuffer,
			byte[] /* (unsigned char *) */ bidiLevelBuffer)
		{
			if (glyphBuffer != null && glyphBuffer.Length < glyphRange.Length)
				throw new ArgumentOutOfRangeException (string.Format ("glyphBuffer must have at least {0} elements", glyphRange.Length));

			if (props != null && props.Length < glyphRange.Length)
				throw new ArgumentOutOfRangeException (string.Format ("props must have at least {0} elements", glyphRange.Length));
			
			if (charIndexBuffer != null && charIndexBuffer.Length < glyphRange.Length)
				throw new ArgumentOutOfRangeException (string.Format ("props must have at least {0} elements", glyphRange.Length));

			if (bidiLevelBuffer != null && bidiLevelBuffer.Length < glyphRange.Length)
				throw new ArgumentOutOfRangeException (string.Format ("bidiLevelBuffer must have at least {0} elements", glyphRange.Length));

			fixed (short* glyphs = glyphBuffer) {
				nuint rv;
#if XAMCORE_2_0 && ARCH_32
				// Unified/32: the output array is not the correct size, it needs to be int[], and it's an array of NSGlyphProperty (which is long)
				var tmpArray = new nint [props.Length];
				fixed (nint *properties = tmpArray) {
#else
				// Unified/64 + Classic: the input array is the correct size
				fixed (NSGlyphProperty *properties = props) {
#endif
					fixed (nuint* charIBuffer = charIndexBuffer) {
						fixed (byte* bidi = bidiLevelBuffer) {
							rv = GetGlyphsInternal (glyphRange, (IntPtr) glyphs, (IntPtr) properties, (IntPtr) charIBuffer, (IntPtr) bidi);
						}
					}
				}
#if XAMCORE_2_0 && ARCH_32
				// Marshal back from the tmpArray.
				for (int i = 0; i < props.Length; i++)
					props [i] = (NSGlyphProperty) (long) tmpArray [i];
#endif

				return rv;
			}
		}
Example #6
0
 public void GetLineOrigins(NSRange range, CGPoint[] origins)
 {
     if (origins == null)
         throw new ArgumentNullException ("origins");
     if (range.Length != 0 && origins.Length < range.Length)
         throw new ArgumentException ("origins must contain at least range.Length elements.", "origins");
     else if (origins.Length < CFArray.GetCount (CTFrameGetLines (handle)))
         throw new ArgumentException ("origins must contain at least GetLines().Length elements.", "origins");
     CTFrameGetLineOrigins (handle, range, origins);
 }
Example #7
0
 public CTFrame GetFrame(NSRange stringRange, CGPath path, CTFrameAttributes frameAttributes)
 {
     if (path == null)
         throw new ArgumentNullException ("path");
     var frame = CTFramesetterCreateFrame (handle, stringRange, path.Handle,
             frameAttributes == null ? IntPtr.Zero : frameAttributes.Dictionary.Handle);
     if (frame == IntPtr.Zero)
         return null;
     return new CTFrame (frame, true);
 }
Example #8
0
 static extern CGSize CTFramesetterSuggestFrameSizeWithConstraints(
     IntPtr framesetter, NSRange stringRange, IntPtr frameAttributes, CGSize constraints, out NSRange fitRange);
Example #9
0
 static extern IntPtr CTFramesetterCreateFrame(IntPtr framesetter, NSRange stringRange, IntPtr path, IntPtr frameAttributes);
Example #10
0
 public UIStringAttributes GetUIKitAttributes(nint location, out NSRange effectiveRange)
 {
     var attr = GetAttributes (location, out effectiveRange);
     return attr == null ? null : new UIStringAttributes (attr);
 }
Example #11
0
 public CTStringAttributes GetCoreTextAttributes(nint location, out NSRange effectiveRange)
 {
     var attr = GetAttributes (location, out effectiveRange);
     return attr == null ? null : new CTStringAttributes (attr);
 }
Example #12
0
 public static extern void void_objc_msgSend_stret_rnsrange(ref NSRange stret, IntPtr receiver, IntPtr selector);
Example #13
0
 public bool ApplyTransform(NSStringTransform transform, bool reverse, NSRange range, out NSRange resultingRange)
 {
     return ApplyTransform (NSString.NSStringTransformToCode (transform), reverse, range, out resultingRange);
 }
Example #14
0
 public void SetAttributes(CTStringAttributes attrs, NSRange range)
 {
     SetAttributes (attrs == null ? null : attrs.Dictionary, range);
 }
Example #15
0
 public void InsertCompletionforPartialWord(string word, NSRange charRange, int movement, bool isFinal)
 {
     InsertCompletion (word, charRange, movement, isFinal);
 }
Example #16
0
 public void SetAlignmentrange(NSTextAlignment alignment, NSRange range)
 {
     SetAlignmentRange (alignment, range);
 }
Example #17
0
 public bool ShouldChangeTextInRangereplacementString(NSRange affectedCharRange, string replacementString)
 {
     return ShouldChangeText (affectedCharRange, replacementString);
 }
Example #18
0
 public void SetSpellingStaterange(int value, NSRange charRange)
 {
     SetSpellingState (value, charRange);
 }
Example #19
0
 public void SetSelectedRangeaffinitystillSelecting(NSRange charRange, NSSelectionAffinity affinity, bool stillSelectingFlag)
 {
     SetSelectedRange (charRange, affinity, stillSelectingFlag);
 }
Example #20
0
 public void SetBaseWritingDirectionrange(NSWritingDirection writingDirection, NSRange range)
 {
     SetBaseWritingDirection (writingDirection, range);
 }
Example #21
0
 public static extern void void_objc_msgSend_nsrange(IntPtr receiver, IntPtr selector, NSRange arg1);
Example #22
0
 static extern void CTFrameGetLineOrigins(IntPtr handle, NSRange range, [Out] CGPoint[] origins);
Example #23
0
 public void AddAttributes(UIStringAttributes attrs, NSRange range)
 {
     AddAttributes (attrs == null ? null : attrs.Dictionary, range);
 }
Example #24
0
        public CTLine GetLine(NSRange stringRange)
        {
            var h = CTTypesetterCreateLine (handle, stringRange);

            if (h == IntPtr.Zero)
                return null;

            return new CTLine (h, true);
        }
Example #25
0
 // check helpers to avoid native exceptions
 void Check(NSRange range)
 {
     if (range.Location + range.Length > Length)
         throw new ArgumentOutOfRangeException ("range");
 }
Example #26
0
 static extern IntPtr CTTypesetterCreateLine(IntPtr typesetter, NSRange stringRange);
Example #27
0
 public NSDictionary GetAttributes(nint location, out NSRange effectiveRange)
 {
     return Runtime.GetNSObject<NSDictionary> (LowLevelGetAttributes (location, out effectiveRange));
 }
Example #28
0
 static extern IntPtr CTTypesetterCreateLineWithOffset(IntPtr typesetter, NSRange stringRange, double offset);
Example #29
0
 public CTStringAttributes GetCoreTextAttributes(nint location, out NSRange longestEffectiveRange, NSRange rangeLimit)
 {
     var attr = GetAttributes (location, out longestEffectiveRange, rangeLimit);
     return attr == null ? null : new CTStringAttributes (attr);
 }
Example #30
0
 public CGSize SuggestFrameSize(NSRange stringRange, CTFrameAttributes frameAttributes, CGSize constraints, out NSRange fitRange)
 {
     return CTFramesetterSuggestFrameSizeWithConstraints (
             handle, stringRange,
             frameAttributes == null ? IntPtr.Zero : frameAttributes.Dictionary.Handle,
             constraints, out fitRange);
 }