public static Alert AlertWithMessage(string messageTitle, string defaultButtonTitle, string alternateButtonTitle, string otherButtonTitle, string informativeText) { // Documentation indicates that nil values can be passed but they actually generate runtime errors. if (messageTitle == null) { messageTitle = ""; } if ((defaultButtonTitle == null) || (defaultButtonTitle.Length == 0)) { defaultButtonTitle = "OK"; } if (alternateButtonTitle == null) { alternateButtonTitle = ""; } if (otherButtonTitle == null) { otherButtonTitle = ""; } if (informativeText == null) { informativeText = ""; } return((Alert)Object.FromIntPtr((IntPtr)ObjCMessaging.objc_msgSend(ObjCClass.FromType(typeof(Alert)).ToIntPtr(), "alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:", typeof(System.IntPtr), typeof(System.IntPtr), new Cocoa.String(messageTitle).NativeObject, typeof(System.IntPtr), new Cocoa.String(defaultButtonTitle).NativeObject, typeof(System.IntPtr), new Cocoa.String(alternateButtonTitle).NativeObject, typeof(System.IntPtr), new Cocoa.String(otherButtonTitle).NativeObject, typeof(System.IntPtr), new Cocoa.String(informativeText).NativeObject))); }
public static void LoadNib(string nibname) { Dictionary dict = new Dictionary("NSOwner", Application.SharedApplication); ObjCMessaging.objc_msgSend((IntPtr)ObjCClass.FromType(typeof(Bundle)).ToIntPtr(), "loadNibFile:externalNameTable:withZone:", typeof(bool), typeof(System.IntPtr), new Cocoa.String(nibname).NativeObject, typeof(System.IntPtr), dict.NativeObject, typeof(System.IntPtr), Application.SharedApplication.Zone); ObjCMessaging.objc_msgSend((IntPtr)ObjCClass.FromType(typeof(Bundle)).ToIntPtr(), "loadNibNamed:owner:", typeof(bool), typeof(System.IntPtr), new Cocoa.String(nibname).NativeObject, typeof(System.IntPtr), Application.SharedApplication.NativeObject); }
public static Type TypeForClassname(string class_name) { if (class_name.StartsWith("NS") || class_name.StartsWith("CS")) { class_name = class_name.Substring(2); } if (native_classes.ContainsKey(class_name)) { return((Type)native_classes [class_name]); } foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly is System.Reflection.Emit.AssemblyBuilder) { continue; } foreach (Type type in assembly.GetTypes()) { if (type == typeof(Object) || type.IsSubclassOf(typeof(Object))) { RegisterAttribute attr = (RegisterAttribute)Attribute.GetCustomAttribute(type, typeof(RegisterAttribute)); if (attr == null) { native_classes [type.Name] = type; } else { ObjCClass.FromType(type); native_classes [attr.Name] = type; } } } } if (native_classes.Contains(class_name)) { return((Type)native_classes [class_name]); } return(null); }
public static Color FromHueSaturationBrightnessAlpha(float hue, float saturation, float brightness, float alpha) { return((Color)Object.FromIntPtr((IntPtr)ObjCMessaging.objc_msgSend((IntPtr)ObjCClass.FromType(typeof(Color)).ToIntPtr(), "colorWithDeviceHue:saturation:brightness:alpha:", typeof(IntPtr), typeof(float), hue, typeof(float), saturation, typeof(float), brightness, typeof(float), alpha))); }
public void Dealloc() { this.Dispose(); ObjCMessaging.objc_msgSend(ObjCClass.FromType(typeof(Object)).ToNativeClass().super_class, "dealloc", typeof(void)); }
static Object() { ObjCMethods.dlopen("/System/Library/Frameworks/Foundation.framework/Foundation", 0x1); ObjCMethods.dlopen("/System/Library/Frameworks/AppKit.framework/AppKit", 0x1); ObjCMethods.class_poseAs(ObjCClass.FromType(typeof(Object)).ToIntPtr(), ObjCMethods.objc_getClass("NSObject")); }
public static Bundle BundleWithPath(string path) { return((Bundle)Object.FromIntPtr((IntPtr)ObjCMessaging.objc_msgSend((IntPtr)ObjCClass.FromType(typeof(Bundle)).ToIntPtr(), "bundleWithPath:", typeof(IntPtr), typeof(IntPtr), new Cocoa.String(path).NativeObject))); }
/// <summary> /// Strokes the path of the specified rectangle using the current stroke color and the default drawing attributes /// </summary> /// <remarks> /// The path is drawn beginning at the rectangleÕs origin and proceeding in a /// counterclockwise direction. This method strokes the specified path immediately. /// </remarks> /// <param name="bounds"> /// A rectangle in the current coordinate system. /// </param> public static void StrokeRect(Rect bounds) { ObjCMessaging.objc_msgSend((IntPtr)ObjCClass.FromType(typeof(BezierPath)).ToIntPtr(), "strokeRect:", typeof(void), typeof(Rect), bounds); }