Class: NSRunningApplication
- Defined in:
- ext/accessibility/extras/extras.c,
ext/accessibility/extras/extras.c
Overview
A 99% drop-in replacement for Cocoa's NSWorkspace
class on MRI and other
non-MacRuby rubies.
See Apple's Developer Reference for documentation on the methods in this class.
Class Method Summary collapse
- .currentApplication ⇒ Object
-
.runningApplicationsWithBundleIdentifier(bundle_id) ⇒ Object
ruby behaviour would be to raise, but we want "drop-in" compat.
- .runningApplicationWithProcessIdentifier(pid) ⇒ Object
- .terminateAutomaticallyTerminableApplications ⇒ Object
Instance Method Summary collapse
- #==(other) ⇒ Object
- #activateWithOptions(options) ⇒ Object
- #activationPolicy ⇒ Object
-
#active? ⇒ Boolean
return this to be MacRuby compatible.
-
#bundleIdentifier ⇒ Object
rb_define_method(rb_cRunningApp, "icon", rb_running_app_icon, 0);.
- #bundleURL ⇒ Object
- #executableArchitecture ⇒ Object
- #executableURL ⇒ Object
- #finishedLaunching? ⇒ Boolean
- #forceTerminate ⇒ Object
- #hidden? ⇒ Boolean
- #hide ⇒ Object
- #launchDate ⇒ Object
- #localizedName ⇒ Object
- #ownsMenuBar ⇒ Object (also: #ownsMenuBar?)
- #processIdentifier ⇒ Object
- #terminate ⇒ Object
- #terminated? ⇒ Boolean
- #unhide ⇒ Object
Class Method Details
.currentApplication ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'ext/accessibility/extras/extras.c', line 80
static
VALUE
rb_running_app_current_app(VALUE self)
{
NSRunningApplication* app = [NSRunningApplication currentApplication];
if (app)
return wrap_app(app);
return Qnil;
}
|
.runningApplicationsWithBundleIdentifier(bundle_id) ⇒ Object
ruby behaviour would be to raise, but we want "drop-in" compat
72 73 74 75 76 77 78 |
# File 'ext/accessibility/extras/extras.c', line 72
static
VALUE
rb_running_app_with_bundle_id(VALUE self, VALUE bundle_id)
{
return wrap_array_apps([NSRunningApplication
runningApplicationsWithBundleIdentifier:unwrap_nsstring(bundle_id)]);
}
|
.runningApplicationWithProcessIdentifier(pid) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'ext/accessibility/extras/extras.c', line 61
static
VALUE
rb_running_app_with_pid(VALUE self, VALUE pid)
{
NSRunningApplication* app = [NSRunningApplication
runningApplicationWithProcessIdentifier:NUM2PIDT(pid)];
if (app)
return wrap_app(app);
return Qnil; // ruby behaviour would be to raise, but we want "drop-in" compat
}
|
.terminateAutomaticallyTerminableApplications ⇒ Object
90 91 92 93 94 95 96 |
# File 'ext/accessibility/extras/extras.c', line 90
static
VALUE
rb_running_app_drop_nuke(VALUE self)
{
[NSRunningApplication terminateAutomaticallyTerminableApplications];
return rb_cRunningApp; // return this to be MacRuby compatible
}
|
Instance Method Details
#==(other) ⇒ Object
238 239 240 241 242 243 244 245 246 |
# File 'ext/accessibility/extras/extras.c', line 238
static
VALUE
rb_running_app_equality(VALUE self, VALUE other)
{
if (CLASS_OF(other) == rb_cRunningApp)
if ([unwrap_app(self) isEqual:unwrap_app(other)])
return Qtrue;
return Qfalse;
}
|
#activateWithOptions(options) ⇒ Object
106 107 108 109 110 111 |
# File 'ext/accessibility/extras/extras.c', line 106
static
VALUE
rb_running_app_activate(VALUE self, VALUE options)
{
return ([unwrap_app(self) activateWithOptions:FIX2INT(options)] ? Qtrue : Qfalse);
}
|
#activationPolicy ⇒ Object
113 114 115 116 117 118 |
# File 'ext/accessibility/extras/extras.c', line 113
static
VALUE
rb_running_app_activation_policy(VALUE self)
{
return INT2FIX(unwrap_app(self).activationPolicy);
}
|
#active? ⇒ Boolean
return this to be MacRuby compatible
99 100 101 102 103 104 |
# File 'ext/accessibility/extras/extras.c', line 99
static
VALUE
rb_running_app_is_active(VALUE self)
{
return unwrap_app(self).isActive ? Qtrue : Qfalse;
}
|
#bundleIdentifier ⇒ Object
rb_define_method(rb_cRunningApp, "icon", rb_running_app_icon, 0);
153 154 155 156 157 158 159 160 161 |
# File 'ext/accessibility/extras/extras.c', line 153
static
VALUE
rb_running_app_bundle_id(VALUE self)
{
NSString* name = [unwrap_app(self) bundleIdentifier];
if (name)
return wrap_nsstring(name);
return Qnil;
}
|
#bundleURL ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 |
# File 'ext/accessibility/extras/extras.c', line 163
static
VALUE
rb_running_app_bundle_url(VALUE self)
{
NSURL* url = [unwrap_app(self) bundleURL];
VALUE rburl = Qnil;
if (url)
rburl = wrap_nsurl(url);
[url release];
return rburl;
}
|
#executableArchitecture ⇒ Object
175 176 177 178 179 180 |
# File 'ext/accessibility/extras/extras.c', line 175
static
VALUE
rb_running_app_executable_arch(VALUE self)
{
return INT2FIX(unwrap_app(self).executableArchitecture);
}
|
#executableURL ⇒ Object
182 183 184 185 186 187 |
# File 'ext/accessibility/extras/extras.c', line 182
static
VALUE
rb_running_app_executable_url(VALUE self)
{
return wrap_nsurl(unwrap_app(self).executableURL);
}
|
#finishedLaunching? ⇒ Boolean
196 197 198 199 200 201 |
# File 'ext/accessibility/extras/extras.c', line 196
static
VALUE
rb_running_app_is_launched(VALUE self)
{
return (unwrap_app(self).isFinishedLaunching ? Qtrue : Qfalse);
}
|
#forceTerminate ⇒ Object
217 218 219 220 221 222 |
# File 'ext/accessibility/extras/extras.c', line 217
static
VALUE
rb_running_app_force_terminate(VALUE self)
{
return ([unwrap_app(self) forceTerminate] ? Qtrue : Qfalse);
}
|
#hidden? ⇒ Boolean
134 135 136 137 138 139 |
# File 'ext/accessibility/extras/extras.c', line 134
static
VALUE
rb_running_app_is_hidden(VALUE self)
{
return (unwrap_app(self).isHidden ? Qtrue : Qfalse);
}
|
#hide ⇒ Object
120 121 122 123 124 125 |
# File 'ext/accessibility/extras/extras.c', line 120
static
VALUE
rb_running_app_hide(VALUE self)
{
return ([unwrap_app(self) hide] ? Qtrue : Qfalse);
}
|
#launchDate ⇒ Object
189 190 191 192 193 194 |
# File 'ext/accessibility/extras/extras.c', line 189
static
VALUE
rb_running_app_launch_date(VALUE self)
{
return wrap_nsdate(unwrap_app(self).launchDate);
}
|
#localizedName ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 |
# File 'ext/accessibility/extras/extras.c', line 141
static
VALUE
rb_running_app_localized_name(VALUE self)
{
NSString* string = [unwrap_app(self) localizedName];
VALUE str = Qnil;
if (string)
str = wrap_nsstring(string);
[string release];
return str;
}
|
#ownsMenuBar ⇒ Object Also known as: ownsMenuBar?
210 211 212 213 214 215 |
# File 'ext/accessibility/extras/extras.c', line 210
static
VALUE
rb_running_app_owns_menu_bar(VALUE self)
{
return (unwrap_app(self).ownsMenuBar ? Qtrue : Qfalse);
}
|
#processIdentifier ⇒ Object
203 204 205 206 207 208 |
# File 'ext/accessibility/extras/extras.c', line 203
static
VALUE
rb_running_app_pid(VALUE self)
{
return PIDT2NUM(unwrap_app(self).processIdentifier);
}
|
#terminate ⇒ Object
224 225 226 227 228 229 |
# File 'ext/accessibility/extras/extras.c', line 224
static
VALUE
rb_running_app_terminate(VALUE self)
{
return ([unwrap_app(self) terminate] ? Qtrue : Qfalse);
}
|
#terminated? ⇒ Boolean
231 232 233 234 235 236 |
# File 'ext/accessibility/extras/extras.c', line 231
static
VALUE
rb_running_app_is_terminated(VALUE self)
{
return (unwrap_app(self).isTerminated ? Qtrue : Qfalse);
}
|
#unhide ⇒ Object
127 128 129 130 131 132 |
# File 'ext/accessibility/extras/extras.c', line 127
static
VALUE
rb_running_app_unhide(VALUE self)
{
return ([unwrap_app(self) unhide] ? Qtrue : Qfalse);
}
|