Permalink
Browse files

Initial import

svn path=/trunk/maccore/; revision=155743
  • Loading branch information...
0 parents commit d922e879624590f289152d54f16670fa0b09b753 Geoff Norton committed Apr 19, 2010
Showing with 17,506 additions and 0 deletions.
  1. +137 −0 src/CoreFoundation/CFArray.cs
  2. +118 −0 src/CoreFoundation/CFBoolean.cs
  3. +68 −0 src/CoreFoundation/CFDictionary.cs
  4. +162 −0 src/CoreFoundation/CFException.cs
  5. +143 −0 src/CoreFoundation/CFRunLoop.cs
  6. +181 −0 src/CoreFoundation/CFString.cs
  7. +98 −0 src/CoreFoundation/CFUrl.cs
  8. +295 −0 src/CoreFoundation/Dispatch.cs
  9. +184 −0 src/CoreGraphics/CGAffineTransform.cs
  10. +108 −0 src/CoreGraphics/CGBitmapContext.cs
  11. +225 −0 src/CoreGraphics/CGColor.cs
  12. +198 −0 src/CoreGraphics/CGColorSpace.cs
  13. +1,011 −0 src/CoreGraphics/CGContext.cs
  14. +140 −0 src/CoreGraphics/CGDataProvider.cs
  15. +265 −0 src/CoreGraphics/CGFont.cs
  16. +140 −0 src/CoreGraphics/CGGeometry.cs
  17. +83 −0 src/CoreGraphics/CGGradient.cs
  18. +380 −0 src/CoreGraphics/CGImage.cs
  19. +200 −0 src/CoreGraphics/CGPDFDocument.cs
  20. +91 −0 src/CoreGraphics/CGPDFPage-2.cs
  21. +66 −0 src/CoreGraphics/CGPDFPage.cs
  22. +431 −0 src/CoreGraphics/CGPath.cs
  23. +144 −0 src/CoreGraphics/CGPattern.cs
  24. +76 −0 src/CoreGraphics/CGShading.cs
  25. +191 −0 src/CoreText/Adapter.cs
  26. +81 −0 src/CoreText/CTFont.Generator.cs
  27. +1,034 −0 src/CoreText/CTFont.cs
  28. +219 −0 src/CoreText/CTFontCollection.cs
  29. +537 −0 src/CoreText/CTFontDescriptor.cs
  30. +158 −0 src/CoreText/CTFontNameKey.cs
  31. +157 −0 src/CoreText/CTFontTrait.cs
  32. +202 −0 src/CoreText/CTFrame.cs
  33. +128 −0 src/CoreText/CTFramesetter.cs
  34. +170 −0 src/CoreText/CTGlyphInfo.cs
  35. +215 −0 src/CoreText/CTLine.cs
  36. +438 −0 src/CoreText/CTParagraphStyle.cs
  37. +249 −0 src/CoreText/CTRun.cs
  38. +230 −0 src/CoreText/CTRunDelegate.cs
  39. +288 −0 src/CoreText/CTStringAttributes.cs
  40. +163 −0 src/CoreText/CTTextTab.cs
  41. +219 −0 src/CoreText/CTTypesetter.cs
  42. +54 −0 src/CoreText/ConstructorError.cs
  43. +41 −0 src/Foundation/ConnectAttribute.cs
  44. +126 −0 src/Foundation/Enum.cs
  45. +61 −0 src/Foundation/ExportAttribute.cs
  46. +32 −0 src/Foundation/ModelAttribute.cs
  47. +33 −0 src/Foundation/ModelNotImplementedException.cs
  48. +49 −0 src/Foundation/NSAction.cs
  49. +175 −0 src/Foundation/NSArray.cs
  50. +55 −0 src/Foundation/NSAutoreleasePool.cs
  51. +193 −0 src/Foundation/NSData.cs
  52. +56 −0 src/Foundation/NSDate.cs
  53. +293 −0 src/Foundation/NSDictionary.cs
  54. +45 −0 src/Foundation/NSError.cs
  55. +52 −0 src/Foundation/NSNotificationCenter.cs
  56. +33 −0 src/Foundation/NSNumber.cs
  57. +36 −0 src/Foundation/NSRange.cs
  58. +54 −0 src/Foundation/NSSet.cs
  59. +133 −0 src/Foundation/NSString.cs
  60. +69 −0 src/Foundation/NSString2.cs
  61. +26 −0 src/Foundation/NSValue.cs
  62. +55 −0 src/Foundation/PreserveAttribute.cs
  63. +41 −0 src/Foundation/RegisterAttribute.cs
  64. +32 −0 src/MonoPInvokeCallbackAttribute.cs
  65. +11 −0 src/ObjCRuntime/AlphaAttribute.cs
  66. +8 −0 src/ObjCRuntime/ArgumentSemantic.cs
  67. +154 −0 src/ObjCRuntime/Dlfcn.cs
  68. +7 −0 src/ObjCRuntime/INativeObject.cs
  69. +38 −0 src/ObjCRuntime/SinceAttribute.cs
  70. +133 −0 src/ObjCRuntime/TypeConverter.cs
  71. +1,112 −0 src/Options.cs
  72. +220 −0 src/btouch.cs
  73. +2,485 −0 src/foundation.cs
  74. +1,971 −0 src/generator.cs
@@ -0,0 +1,137 @@
+//
+// CFArray.cs: P/Invokes for CFArray
+//
+// Authors: Mono Team
+//
+// Copyright 2010 Novell, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using MonoMac.Foundation;
+using MonoMac.ObjCRuntime;
+
+using CFIndex = System.Int32;
+
+namespace MonoMac.CoreFoundation {
+
+ class CFArray : INativeObject, IDisposable {
+
+ internal IntPtr handle;
+
+ internal CFArray (IntPtr handle, bool owns)
+ {
+ if (handle == IntPtr.Zero)
+ throw new ArgumentNullException ("handle");
+
+ this.handle = handle;
+ if (!owns)
+ CFObject.CFRetain (handle);
+ }
+
+ public IntPtr Handle {
+ get {return handle;}
+ }
+
+ ~CFArray ()
+ {
+ Dispose (false);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (handle != IntPtr.Zero){
+ CFObject.CFRelease (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+
+ // pointer to a const struct (REALLY APPLE?)
+ static readonly IntPtr kCFTypeArrayCallbacks_ptr;
+
+ static CFArray ()
+ {
+ var handle = Dlfcn.dlopen (Constants.CoreFoundationLibrary, 0);
+ if (handle == IntPtr.Zero)
+ return;
+ try {
+ kCFTypeArrayCallbacks_ptr = Dlfcn.GetIndirect (handle, "kCFTypeArrayCallBacks");
+ }
+ finally {
+ Dlfcn.dlclose (handle);
+ }
+ }
+
+ public static CFArray FromIntPtrs (params IntPtr[] values)
+ {
+ return new CFArray (Create (values), true);
+ }
+
+ public static CFArray FromNativeObjects (params INativeObject[] values)
+ {
+ return new CFArray (Create (values), true);
+ }
+
+ public int Count {
+ get {return CFArrayGetCount (handle);}
+ }
+
+ [DllImport (Constants.CoreFoundationLibrary)]
+ extern static IntPtr CFArrayCreate (IntPtr allocator, IntPtr values, CFIndex numValues, IntPtr callbacks);
+
+ public static unsafe IntPtr Create (params IntPtr[] values)
+ {
+ if (values == null)
+ throw new ArgumentNullException ("values");
+ fixed (IntPtr* pv = values) {
+ return CFArrayCreate (IntPtr.Zero,
+ (IntPtr) pv,
+ values.Length,
+ kCFTypeArrayCallbacks_ptr);
+ }
+ }
+
+ public static IntPtr Create (params INativeObject[] values)
+ {
+ if (values == null)
+ throw new ArgumentNullException ("values");
+ IntPtr[] _values = new IntPtr [values.Length];
+ for (int i = 0; i < _values.Length; ++i)
+ _values [i] = values [i].Handle;
+ return Create (_values);
+ }
+
+ [DllImport (Constants.CoreFoundationLibrary)]
+ extern static CFIndex CFArrayGetCount (IntPtr theArray);
+ public static int GetCount (IntPtr array)
+ {
+ return CFArrayGetCount (array);
+ }
+ }
+}
+
@@ -0,0 +1,118 @@
+//
+// CFBoolean.cs: Contains base types
+//
+// Authors:
+// Jonathan Pryor (jpryor@novell.com)
+//
+// The class can be either constructed from a string (from user code)
+// or from a handle (from iphone-sharp.dll internal calls). This
+// delays the creation of the actual managed string until actually
+// required
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+using MonoMac.ObjCRuntime;
+
+namespace MonoMac.CoreFoundation {
+ [Since (3,2)]
+ class CFBoolean : INativeObject, IDisposable {
+ IntPtr handle;
+
+ public static readonly CFBoolean True;
+ public static readonly CFBoolean False;
+
+ static CFBoolean ()
+ {
+ var handle = Dlfcn.dlopen (Constants.CoreTextLibrary, 0);
+ if (handle == IntPtr.Zero)
+ return;
+ try {
+ True = new CFBoolean (Dlfcn.GetIntPtr (handle, "kCFBooleanTrue"), false);
+ False = new CFBoolean (Dlfcn.GetIntPtr (handle, "kCFBooleanFalse"), false);
+ }
+ finally {
+ Dlfcn.dlclose (handle);
+ }
+ }
+
+ internal CFBoolean (IntPtr handle, bool owns)
+ {
+ this.handle = handle;
+ if (!owns)
+ CFObject.CFRetain (handle);
+ }
+
+ ~CFBoolean ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public virtual void Dispose (bool disposing)
+ {
+ if (handle != IntPtr.Zero){
+ CFObject.CFRelease (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+
+ public static implicit operator bool (CFBoolean value)
+ {
+ return value.Value;
+ }
+
+ public static explicit operator CFBoolean (bool value)
+ {
+ return FromBoolean (value);
+ }
+
+ public static CFBoolean FromBoolean (bool value)
+ {
+ return value ? True : False;
+ }
+
+ [DllImport (Constants.CoreFoundationLibrary, CharSet=CharSet.Unicode)]
+ extern static bool CFBooleanGetValue (IntPtr boolean);
+
+ public bool Value {
+ get {return CFBooleanGetValue (handle);}
+ }
+
+ public static bool GetValue (IntPtr boolean)
+ {
+ return CFBooleanGetValue (boolean);
+ }
+ }
+}
@@ -0,0 +1,68 @@
+//
+// CFDictionary.cs: P/Invokes for CFDictionary, CFMutableDictionary
+//
+// Authors: Mono Team
+//
+// Copyright 2010 Novell, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using MonoMac.Foundation;
+using MonoMac.ObjCRuntime;
+
+namespace MonoMac.CoreFoundation {
+
+ [Since (3,2)]
+ static class CFDictionary {
+
+ [DllImport (Constants.CoreFoundationLibrary)]
+ extern static IntPtr CFDictionaryGetValue (IntPtr theDict, IntPtr key);
+ public static IntPtr GetValue (IntPtr theDict, IntPtr key)
+ {
+ return CFDictionaryGetValue (theDict, key);
+ }
+
+ public static bool GetBooleanValue (IntPtr theDict, IntPtr key)
+ {
+ var value = GetValue (theDict, key);
+ if (value == IntPtr.Zero)
+ return false;
+ return CFBoolean.GetValue (value);
+ }
+ }
+
+ static class CFMutableDictionary {
+
+ [DllImport (Constants.CoreFoundationLibrary)]
+ extern static void CFDictionarySetValue (IntPtr theDict, IntPtr key, IntPtr value);
+ public static void SetValue (IntPtr theDict, IntPtr key, IntPtr value)
+ {
+ CFDictionarySetValue (theDict, key, value);
+ }
+
+ public static void SetValue (IntPtr theDict, IntPtr key, bool value)
+ {
+ SetValue (theDict, key, value ? CFBoolean.True.Handle : CFBoolean.False.Handle);
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit d922e87

Please sign in to comment.