summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cocoaint/src/appkit/NSRunningApplication.inc
blob: 226847ec0ff311ab3f9bf83ee27621098af77cce (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{ Parsed from Appkit.framework NSRunningApplication.h }

{$ifdef TYPES}
{$ifndef NSRUNNINGAPPLICATION_PAS_T}
{$define NSRUNNINGAPPLICATION_PAS_T}

{ Constants }

const
  NSApplicationActivateAllWindows = 1 shl 0;
  NSApplicationActivateIgnoringOtherApps = 1 shl 1;

const
  NSApplicationActivationPolicyRegular = 0;
  NSApplicationActivationPolicyAccessory = 1;
  NSApplicationActivationPolicyProhibited = 2;

{ Types }
type
  NSApplicationActivationOptions = NSUInteger;
  NSApplicationActivationOptionsPtr = ^NSApplicationActivationOptions;
  NSApplicationActivationPolicy = NSInteger;
  NSApplicationActivationPolicyPtr = ^NSApplicationActivationPolicy;

{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSRUNNINGAPPLICATION_PAS_R}
{$define NSRUNNINGAPPLICATION_PAS_R}

{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSRUNNINGAPPLICATION_PAS_F}
{$define NSRUNNINGAPPLICATION_PAS_F}

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSRUNNINGAPPLICATION_PAS_S}
{$define NSRUNNINGAPPLICATION_PAS_S}

{$endif}
{$endif}

{$ifdef FORWARD}
  NSRunningApplication = objcclass;
  NSRunningApplicationPointer = ^NSRunningApplication;
  NSRunningApplicationPtr = NSRunningApplicationPointer;

{$endif}

{$ifdef CLASSES}
{$ifndef NSRUNNINGAPPLICATION_PAS_C}
{$define NSRUNNINGAPPLICATION_PAS_C}

{ NSRunningApplication }
  NSRunningApplication = objcclass external (NSObject)
  private
    _superReserved: id;
    _asn: Pointer; {garbage collector: __strong }
    _helpers: PPointer; {garbage collector: __strong }
    _obsInfo: Pointer;
    _lock: NSLock;
    _bundleID: NSString;
    _localizedName: NSString;
    _bundleURL: NSURL;
    _executableURL: NSURL;
    _launchDate: NSDate;
    _icon: NSImage;
    _pid: cint;
    _lastSeed: cuint;
    _activeSeed: cuint;
    _staleSeed: cuint;
    _obsMask: culonglong;
    __aflags: record
      case byte of
       0: (_anonbitfield_NSRunningApplication0: cuint);
       1: (data: bitpacked record
        fetchedDynamic: 0..1;
        deadToUs: 0..1;
        terminated: 0..1;
        finishedLaunching: 0..1;
        hidden: 0..1;
        active: 0..1;
        arch: 0..((1 shl 3)-1);
        activationPolicy: 0..((1 shl 3)-1);
        reserved1: 0..((1 shl 20)-1);
       end;
      );
      end;
    _appReserved: id;
    
  public
    function isTerminated: Boolean; message 'isTerminated';
    function isFinishedLaunching: Boolean; message 'isFinishedLaunching';
    function isHidden: Boolean; message 'isHidden';
    function isActive: Boolean; message 'isActive';
    function activationPolicy: NSApplicationActivationPolicy; message 'activationPolicy';
    function localizedName: NSString; message 'localizedName';
    function bundleIdentifier: NSString; message 'bundleIdentifier';
    function bundleURL: NSURL; message 'bundleURL';
    function executableURL: NSURL; message 'executableURL';
    function processIdentifier: pid_t; message 'processIdentifier';
    function launchDate: NSDate; message 'launchDate';
    function icon: NSImage; message 'icon';
    function executableArchitecture: NSInteger; message 'executableArchitecture';
    function hide: Boolean; message 'hide';
    function unhide: Boolean; message 'unhide';
    function activateWithOptions(options: NSApplicationActivationOptions): Boolean; message 'activateWithOptions:';
    function terminate: Boolean; message 'terminate';
    function forceTerminate: Boolean; message 'forceTerminate';
    class function runningApplicationsWithBundleIdentifier(bundleIdentifier_: NSString): NSArray; message 'runningApplicationsWithBundleIdentifier:';
    class function runningApplicationWithProcessIdentifier(pid: pid_t): NSRunningApplication; message 'runningApplicationWithProcessIdentifier:';
    class function currentApplication: NSRunningApplication; message 'currentApplication';
  end;

{ NSWorkspaceRunningApplicationsCategory }
  NSWorkspaceRunningApplicationsCategory = objccategory external (NSWorkspace)
    function runningApplications: NSArray; message 'runningApplications';
  end;

{$endif}
{$endif}