public static string GetString(this NSTextView self) { var selector = new ObjCRuntime.Selector("string"); var handle = LibObjc.IntPtr_objc_msgSend(self.Handle, selector.Handle); return(handle != IntPtr.Zero ? NSString.FromHandle(handle) : (string)null); }
public static NSWindow[] OrderedWindows(this NSApplication self) { var selector = new ObjCRuntime.Selector("orderedWindows"); var ptr = LibObjc.IntPtr_objc_msgSend(self.Handle, selector.Handle); var array = NSArray.ArrayFromHandle <NSWindow>(ptr); return(array); }
public static NSInvocation ToInvocation(this NSMethodSignature signature) { var cls = Class.GetHandle(typeof(NSInvocation)); var ctor = Selector.GetHandle("invocationWithMethodSignature:"); var inv = LibObjc.IntPtr_objc_msgSend_IntPtr(cls, ctor, signature.Handle); return(ObjCRuntime.Runtime.GetNSObject <NSInvocation>(inv)); }
public static Class SetCellClass(this Class ctrlClass, Class cellClass) { var cellClassHandle = LibObjc.IntPtr_objc_msgSend(cellClass.Handle, classSel.Handle); var ctrlClassHandle = LibObjc.IntPtr_objc_msgSend(ctrlClass.Handle, classSel.Handle); var prevCellClassHandle = LibObjc.IntPtr_objc_msgSend(ctrlClassHandle, cellClassSel.Handle); LibObjc.void_objc_msgSend_IntPtr(ctrlClassHandle, setCellClassSel.Handle, cellClassHandle); return(prevCellClassHandle == IntPtr.Zero ? (Class)null : new Class(prevCellClassHandle)); }
public static bool AddMethod(this NSObject obj, Selector selector, Delegate imp) { if (obj.RespondsToSelector(selector)) { return(false); } var classHandle = obj.Class.Handle; return(LibObjc.class_addMethod(classHandle, selector.Handle, imp, "v@:")); }
// provider must implement NSPasteboardItemDataProvider public static void SetDataProviderForTypes(this NSPasteboardItem item, NSObject provider, string[] types) { var sel = new ObjCRuntime.Selector("setDataProvider:forTypes:"); var array = NSArray.FromStrings(types); var ok = LibObjc.bool_objc_msgSend_IntPtr_IntPtr(item.Handle, sel.Handle, provider.Handle, array.Handle); }
public static void AllowsUndo(this NSTextView self, bool value) { var selector = new ObjCRuntime.Selector("setAllowsUndo:"); LibObjc.void_objc_msgSend_Bool(self.Handle, selector.Handle, value); }
public static bool AllowsUndo(this NSTextView self) { var selector = new ObjCRuntime.Selector("allowsUndo"); return(LibObjc.bool_objc_msgSend(self.Handle, selector.Handle)); }
public static void SetString(this NSTextView self, NSString value) { var selector = new ObjCRuntime.Selector("setString:"); LibObjc.void_objc_msgSend_IntPtr(self.Handle, selector.Handle, value.Handle); }
public static void SetArgument(this NSInvocation invocation, NSObject arg, int index) { LibObjc.void_objc_msgSend_IntPtr_nint(invocation.Handle, Selector.GetHandle("setArgument:atIndex:"), arg?.Handle ?? IntPtr.Zero, index); }
public static NSMethodSignature GetMethodSignature(this NSObject obj, Selector selector) { var sig = LibObjc.IntPtr_objc_msgSend_IntPtr(obj.Handle, Selector.GetHandle("methodSignatureForSelector:"), selector.Handle); return(ObjCRuntime.Runtime.GetNSObject <NSMethodSignature>(sig)); }