summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cocoaint/src/foundation/NSNotification.inc
blob: 2bf91cd1c5e64e15098c7f6570480e6dd5bc4888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{ Parsed from Foundation.framework NSNotification.h }

{$ifdef TYPES}
{$ifndef NSNOTIFICATION_PAS_T}
{$define NSNOTIFICATION_PAS_T}

{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSNOTIFICATION_PAS_R}
{$define NSNOTIFICATION_PAS_R}

{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSNOTIFICATION_PAS_F}
{$define NSNOTIFICATION_PAS_F}

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSNOTIFICATION_PAS_S}
{$define NSNOTIFICATION_PAS_S}

{$endif}
{$endif}

{$ifdef FORWARD}
  NSNotification = objcclass;
  NSNotificationPointer = ^NSNotification;
  NSNotificationPtr = NSNotificationPointer;
  NSNotificationCenter = objcclass;
  NSNotificationCenterPointer = ^NSNotificationCenter;
  NSNotificationCenterPtr = NSNotificationCenterPointer;

{$endif}

{$ifdef CLASSES}
{$ifndef NSNOTIFICATION_PAS_C}
{$define NSNOTIFICATION_PAS_C}

{ NSNotification }
  NSNotification = objcclass external (NSObject, NSCopyingProtocol, NSCodingProtocol)
    
  public
    function name: NSString; message 'name';
    function object_: id; message 'object';
    function userInfo: NSDictionary; message 'userInfo';

    { Adopted Protocols }
    function copyWithZone(zone_: NSZonePtr): id;
    procedure encodeWithCoder(aCoder: NSCoder);
    function initWithCoder(aDecoder: NSCoder): id;
  end;

{ NSNotificationCenter }
  NSNotificationCenter = objcclass external (NSObject)
  private
    _impl: Pointer; {garbage collector: __strong }
    _callback_block: array[0..(4)-1] of Pointer;
    _pad: array[0..(8)-1] of Pointer;
    
  public
    class function defaultCenter: id; message 'defaultCenter';
    procedure addObserver_selector_name_object(observer: id; aSelector: SEL; aName: NSString; anObject: id); message 'addObserver:selector:name:object:';
    procedure postNotification(notification: NSNotification); message 'postNotification:';
    procedure postNotificationName_object(aName: NSString; anObject: id); message 'postNotificationName:object:';
    procedure postNotificationName_object_userInfo(aName: NSString; anObject: id; aUserInfo: NSDictionary); message 'postNotificationName:object:userInfo:';
    procedure removeObserver(observer: id); message 'removeObserver:';
    procedure removeObserver_name_object(observer: id; aName: NSString; anObject: id); message 'removeObserver:name:object:';
  end;

{ NSNotificationCreationCategory }
  NSNotificationCreationCategory = objccategory external (NSNotification)
    class function notificationWithName_object(aName: NSString; anObject: id): id; message 'notificationWithName:object:';
    class function notificationWithName_object_userInfo(aName: NSString; anObject: id; aUserInfo: NSDictionary): id; message 'notificationWithName:object:userInfo:';
  end;

{$endif}
{$endif}