static NSNotificationCenter() { IntPtr nsncClass = Class.Get("NSNotificationCenter"); Handle = Cocoa.SendIntPtr(nsncClass, sel_default_center); WINDOW_DID_ENTER_FULL_SCREEN = Cocoa.GetStringConstant(Cocoa.AppKitLibrary, "NSWindowDidEnterFullScreenNotification"); WINDOW_DID_EXIT_FULL_SCREEN = Cocoa.GetStringConstant(Cocoa.AppKitLibrary, "NSWindowDidExitFullScreenNotification"); }
internal static NSArray ArrayWithObjects(IntPtr[] objs) { var mutableArray = Cocoa.SendIntPtr(mutable_class_pointer, sel_array); foreach (IntPtr obj in objs) { Cocoa.SendVoid(mutableArray, sel_add_object, obj); } return(new NSArray(mutableArray)); }
internal bool WriteObjects(NSArray objects) => Cocoa.SendBool(Handle, sel_write_objects, objects.Handle);
internal NSArray?ReadObjectsForClasses(NSArray classArray, NSDictionary?optionDict) { var result = Cocoa.SendIntPtr(Handle, sel_read_objects_for_classes, classArray.Handle, optionDict?.Handle ?? IntPtr.Zero); return(result == IntPtr.Zero ? (NSArray?)null : new NSArray(result)); }
internal bool CanReadObjectForClasses(NSArray classArray, NSDictionary?optionDict) => Cocoa.SendBool(Handle, sel_can_read_object_for_classes, classArray.Handle, optionDict?.Handle ?? IntPtr.Zero);
internal int ClearContents() => Cocoa.SendInt(Handle, sel_clear_contents);
internal static NSPasteboard GeneralPasteboard() => new NSPasteboard(Cocoa.SendIntPtr(class_pointer, sel_general_pasteboard));
internal static void AddObserver(IntPtr target, IntPtr selector, IntPtr name, IntPtr obj) => Cocoa.SendVoid(Handle, sel_add_observer, target, selector, name, obj);
internal IntPtr ObjectAtIndex(int index) => Cocoa.SendIntPtr(Handle, sel_object_at_index, index);
internal int Count() => Cocoa.SendInt(Handle, sel_count);
internal static NSArray ArrayWithObject(IntPtr obj) => new NSArray(Cocoa.SendIntPtr(class_pointer, sel_array_with_object, obj));
static NSApplication() { IntPtr nsappClass = Class.Get("NSApplication"); Handle = Cocoa.SendIntPtr(nsappClass, sel_shared_application); }