comparison dstep/appkit/NSApplication.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSApplication;
8
9 import dstep.appkit.AppKitDefines;
10 import dstep.appkit.NSColorPanel;
11 import dstep.appkit.NSDockTile;
12 import dstep.appkit.NSEvent;
13 import dstep.appkit.NSGraphicsContext;
14 import dstep.appkit.NSHelpManager;
15 import dstep.appkit.NSImage;
16 import dstep.appkit.NSMenu;
17 import dstep.appkit.NSPageLayout;
18 import dstep.appkit.NSPasteboard;
19 import dstep.appkit.NSResponder;
20 import dstep.appkit.NSUserInterfaceValidation;
21 import dstep.appkit.NSWindow;
22 import dstep.foundation.NSArray;
23 import dstep.foundation.NSDate;
24 import dstep.foundation.NSDictionary;
25 import dstep.foundation.NSError;
26 import dstep.foundation.NSException;
27 import dstep.foundation.NSNotification;
28 import dstep.foundation.NSObjCRuntime;
29 import dstep.foundation.NSString;
30 import dstep.internal.String;
31 import dstep.objc.bridge.Bridge;
32 import dstep.objc.objc;
33
34 import bindings = dstep.appkit.NSApplication_bindings;
35
36 struct _NSModalSession;
37 struct NSThreadPrivate;
38
39 alias _NSModalSession* NSModalSession;
40 alias NSThreadPrivate _NSThreadPrivate;
41 alias NSUInteger NSRequestUserAttentionType;
42 alias NSUInteger NSApplicationDelegateReply;
43 alias NSUInteger NSApplicationTerminateReply;
44 alias NSUInteger NSApplicationPrintReply;
45
46 extern (C)
47 {
48 extern
49 {
50 const double NSAppKitVersionNumber;
51 }
52 }
53
54 private
55 {
56 NSString NSModalPanelRunLoopMode_;
57 NSString NSEventTrackingRunLoopMode_;
58 NSApplication NSApp_;
59 NSString NSApplicationDidBecomeActiveNotification_;
60 NSString NSApplicationDidHideNotification_;
61 NSString NSApplicationDidFinishLaunchingNotification_;
62 NSString NSApplicationDidResignActiveNotification_;
63 NSString NSApplicationDidUnhideNotification_;
64 NSString NSApplicationDidUpdateNotification_;
65 NSString NSApplicationWillBecomeActiveNotification_;
66 NSString NSApplicationWillHideNotification_;
67 NSString NSApplicationWillFinishLaunchingNotification_;
68 NSString NSApplicationWillResignActiveNotification_;
69 NSString NSApplicationWillUnhideNotification_;
70 NSString NSApplicationWillUpdateNotification_;
71 NSString NSApplicationWillTerminateNotification_;
72 NSString NSApplicationDidChangeScreenParametersNotification_;
73 }
74
75 NSString NSModalPanelRunLoopMode ()
76 {
77 if (NSModalPanelRunLoopMode_)
78 return NSModalPanelRunLoopMode_;
79
80 return NSModalPanelRunLoopMode_ = new NSString(bindings.NSModalPanelRunLoopMode);
81 }
82
83 NSString NSEventTrackingRunLoopMode ()
84 {
85 if (NSEventTrackingRunLoopMode_)
86 return NSEventTrackingRunLoopMode_;
87
88 return NSEventTrackingRunLoopMode_ = new NSString(bindings.NSEventTrackingRunLoopMode);
89 }
90
91 NSApplication NSApp ()
92 {
93 if (NSApp_)
94 return NSApp_;
95
96 return NSApp_ = new NSApplication(bindings.NSApp);
97 }
98
99 NSString NSApplicationDidBecomeActiveNotification ()
100 {
101 if (NSApplicationDidBecomeActiveNotification_)
102 return NSApplicationDidBecomeActiveNotification_;
103
104 return NSApplicationDidBecomeActiveNotification_ = new NSString(bindings.NSApplicationDidBecomeActiveNotification);
105 }
106
107 NSString NSApplicationDidHideNotification ()
108 {
109 if (NSApplicationDidHideNotification_)
110 return NSApplicationDidHideNotification_;
111
112 return NSApplicationDidHideNotification_ = new NSString(bindings.NSApplicationDidHideNotification);
113 }
114
115 NSString NSApplicationDidFinishLaunchingNotification ()
116 {
117 if (NSApplicationDidFinishLaunchingNotification_)
118 return NSApplicationDidFinishLaunchingNotification_;
119
120 return NSApplicationDidFinishLaunchingNotification_ = new NSString(bindings.NSApplicationDidFinishLaunchingNotification);
121 }
122
123 NSString NSApplicationDidResignActiveNotification ()
124 {
125 if (NSApplicationDidResignActiveNotification_)
126 return NSApplicationDidResignActiveNotification_;
127
128 return NSApplicationDidResignActiveNotification_ = new NSString(bindings.NSApplicationDidResignActiveNotification);
129 }
130
131 NSString NSApplicationDidUnhideNotification ()
132 {
133 if (NSApplicationDidUnhideNotification_)
134 return NSApplicationDidUnhideNotification_;
135
136 return NSApplicationDidUnhideNotification_ = new NSString(bindings.NSApplicationDidUnhideNotification);
137 }
138
139 NSString NSApplicationDidUpdateNotification ()
140 {
141 if (NSApplicationDidUpdateNotification_)
142 return NSApplicationDidUpdateNotification_;
143
144 return NSApplicationDidUpdateNotification_ = new NSString(bindings.NSApplicationDidUpdateNotification);
145 }
146
147 NSString NSApplicationWillBecomeActiveNotification ()
148 {
149 if (NSApplicationWillBecomeActiveNotification_)
150 return NSApplicationWillBecomeActiveNotification_;
151
152 return NSApplicationWillBecomeActiveNotification_ = new NSString(bindings.NSApplicationWillBecomeActiveNotification);
153 }
154
155 NSString NSApplicationWillHideNotification ()
156 {
157 if (NSApplicationWillHideNotification_)
158 return NSApplicationWillHideNotification_;
159
160 return NSApplicationWillHideNotification_ = new NSString(bindings.NSApplicationWillHideNotification);
161 }
162
163 NSString NSApplicationWillFinishLaunchingNotification ()
164 {
165 if (NSApplicationWillFinishLaunchingNotification_)
166 return NSApplicationWillFinishLaunchingNotification_;
167
168 return NSApplicationWillFinishLaunchingNotification_ = new NSString(bindings.NSApplicationWillFinishLaunchingNotification);
169 }
170
171 NSString NSApplicationWillResignActiveNotification ()
172 {
173 if (NSApplicationWillResignActiveNotification_)
174 return NSApplicationWillResignActiveNotification_;
175
176 return NSApplicationWillResignActiveNotification_ = new NSString(bindings.NSApplicationWillResignActiveNotification);
177 }
178
179 NSString NSApplicationWillUnhideNotification ()
180 {
181 if (NSApplicationWillUnhideNotification_)
182 return NSApplicationWillUnhideNotification_;
183
184 return NSApplicationWillUnhideNotification_ = new NSString(bindings.NSApplicationWillUnhideNotification);
185 }
186
187 NSString NSApplicationWillUpdateNotification ()
188 {
189 if (NSApplicationWillUpdateNotification_)
190 return NSApplicationWillUpdateNotification_;
191
192 return NSApplicationWillUpdateNotification_ = new NSString(bindings.NSApplicationWillUpdateNotification);
193 }
194
195 NSString NSApplicationWillTerminateNotification ()
196 {
197 if (NSApplicationWillTerminateNotification_)
198 return NSApplicationWillTerminateNotification_;
199
200 return NSApplicationWillTerminateNotification_ = new NSString(bindings.NSApplicationWillTerminateNotification);
201 }
202
203 NSString NSApplicationDidChangeScreenParametersNotification ()
204 {
205 if (NSApplicationDidChangeScreenParametersNotification_)
206 return NSApplicationDidChangeScreenParametersNotification_;
207
208 return NSApplicationDidChangeScreenParametersNotification_ = new NSString(bindings.NSApplicationDidChangeScreenParametersNotification);
209 }
210
211 enum
212 {
213 NSRunStoppedResponse = (-1000),
214 NSRunAbortedResponse = (-1001),
215 NSRunContinuesResponse = (-1002)
216 }
217
218 enum
219 {
220 NSUpdateWindowsRunLoopOrdering = 500000
221 }
222
223 enum
224 {
225 NSCriticalRequest = 0,
226 NSInformationalRequest = 10
227 }
228
229 enum
230 {
231 NSApplicationDelegateReplySuccess = 0,
232 NSApplicationDelegateReplyCancel = 1,
233 NSApplicationDelegateReplyFailure = 2
234 }
235
236 enum
237 {
238 NSTerminateCancel = 0,
239 NSTerminateNow = 1,
240 NSTerminateLater = 2
241 }
242
243 enum
244 {
245 NSPrintingCancelled = 0,
246 NSPrintingSuccess = 1,
247 NSPrintingFailure = 3,
248 NSPrintingReplyLater = 2
249 }
250
251 const TNSServicesMenu = `
252
253 void setServicesMenu (NSMenu aMenu)
254 {
255 return invokeObjcSelf!(void, "setServicesMenu:", NSMenu)(aMenu);
256 }
257
258 NSMenu servicesMenu ()
259 {
260 return invokeObjcSelf!(NSMenu, "servicesMenu");
261 }
262
263 void registerServicesMenuSendTypes (NSArray sendTypes, NSArray returnTypes)
264 {
265 return invokeObjcSelf!(void, "registerServicesMenuSendTypes:returnTypes:", NSArray, NSArray)(sendTypes, returnTypes);
266 }
267
268 //mixin ObjcBindMethod!(setServicesMenu, "setServicesMenu:");
269 //mixin ObjcBindMethod!(servicesMenu, "servicesMenu");
270 //mixin ObjcBindMethod!(registerServicesMenuSendTypes, "registerServicesMenuSendTypes:returnTypes:");
271
272 `;
273
274 const TNSServicesRequests = `
275
276 bool writeSelectionToPasteboard (NSPasteboard pboard, NSArray types)
277 {
278 return invokeObjcSelf!(bool, "writeSelectionToPasteboard:types:", NSPasteboard, NSArray)(pboard, types);
279 }
280
281 bool readSelectionFromPasteboard (NSPasteboard pboard)
282 {
283 return invokeObjcSelf!(bool, "readSelectionFromPasteboard:", NSPasteboard)(pboard);
284 }
285
286 //mixin ObjcBindMethod!(writeSelectionToPasteboard, "writeSelectionToPasteboard:types:");
287 //mixin ObjcBindMethod!(readSelectionFromPasteboard, "readSelectionFromPasteboard:");
288
289 `;
290
291 const TNSStandardAboutPanel = `
292
293 void orderFrontStandardAboutPanel (Object sender)
294 {
295 return invokeObjcSelf!(void, "orderFrontStandardAboutPanel:", Object)(sender);
296 }
297
298 void orderFrontStandardAboutPanelWithOptions (NSDictionary optionsDictionary)
299 {
300 return invokeObjcSelf!(void, "orderFrontStandardAboutPanelWithOptions:", NSDictionary)(optionsDictionary);
301 }
302
303 //mixin ObjcBindMethod!(orderFrontStandardAboutPanel, "orderFrontStandardAboutPanel:");
304 //mixin ObjcBindMethod!(orderFrontStandardAboutPanelWithOptions, "orderFrontStandardAboutPanelWithOptions:");
305
306 `;
307
308 const TNSWindowsMenu = `
309
310 void setWindowsMenu (NSMenu aMenu)
311 {
312 return invokeObjcSelf!(void, "setWindowsMenu:", NSMenu)(aMenu);
313 }
314
315 NSMenu windowsMenu ()
316 {
317 return invokeObjcSelf!(NSMenu, "windowsMenu");
318 }
319
320 void arrangeInFront (Object sender)
321 {
322 return invokeObjcSelf!(void, "arrangeInFront:", Object)(sender);
323 }
324
325 void removeWindowsItem (NSWindow win)
326 {
327 return invokeObjcSelf!(void, "removeWindowsItem:", NSWindow)(win);
328 }
329
330 void addWindowsItem (NSWindow win, NSString aString, bool isFilename)
331 {
332 return invokeObjcSelf!(void, "addWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename);
333 }
334
335 void changeWindowsItem (NSWindow win, NSString aString, bool isFilename)
336 {
337 return invokeObjcSelf!(void, "changeWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename);
338 }
339
340 void updateWindowsItem (NSWindow win)
341 {
342 return invokeObjcSelf!(void, "updateWindowsItem:", NSWindow)(win);
343 }
344
345 void miniaturizeAll (Object sender)
346 {
347 return invokeObjcSelf!(void, "miniaturizeAll:", Object)(sender);
348 }
349
350 //mixin ObjcBindMethod!(setWindowsMenu, "setWindowsMenu:");
351 //mixin ObjcBindMethod!(windowsMenu, "windowsMenu");
352 //mixin ObjcBindMethod!(arrangeInFront, "arrangeInFront:");
353 //mixin ObjcBindMethod!(removeWindowsItem, "removeWindowsItem:");
354 //mixin ObjcBindMethod!(addWindowsItem, "addWindowsItem:title:filename:");
355 //mixin ObjcBindMethod!(changeWindowsItem, "changeWindowsItem:title:filename:");
356 //mixin ObjcBindMethod!(updateWindowsItem, "updateWindowsItem:");
357 //mixin ObjcBindMethod!(miniaturizeAll, "miniaturizeAll:");
358
359 `;
360
361 const TNSApplicationDelegate = `
362
363 uint applicationShouldTerminate (NSApplication sender)
364 {
365 return invokeObjcSelf!(uint, "applicationShouldTerminate:", NSApplication)(sender);
366 }
367
368 bool application (NSApplication sender, NSString filename)
369 {
370 return invokeObjcSelf!(bool, "application:openFile:", NSApplication, NSString)(sender, filename);
371 }
372
373 void application (NSApplication sender, NSArray filenames)
374 {
375 return invokeObjcSelf!(void, "application:openFiles:", NSApplication, NSArray)(sender, filenames);
376 }
377
378 bool application (NSApplication sender, NSString filename)
379 {
380 return invokeObjcSelf!(bool, "application:openTempFile:", NSApplication, NSString)(sender, filename);
381 }
382
383 bool applicationShouldOpenUntitledFile (NSApplication sender)
384 {
385 return invokeObjcSelf!(bool, "applicationShouldOpenUntitledFile:", NSApplication)(sender);
386 }
387
388 bool applicationOpenUntitledFile (NSApplication sender)
389 {
390 return invokeObjcSelf!(bool, "applicationOpenUntitledFile:", NSApplication)(sender);
391 }
392
393 bool application (Object sender, NSString filename)
394 {
395 return invokeObjcSelf!(bool, "application:openFileWithoutUI:", Object, NSString)(sender, filename);
396 }
397
398 bool application (NSApplication sender, NSString filename)
399 {
400 return invokeObjcSelf!(bool, "application:printFile:", NSApplication, NSString)(sender, filename);
401 }
402
403 uint application (NSApplication application, NSArray fileNames, NSDictionary printSettings, bool showPrintPanels)
404 {
405 return invokeObjcSelf!(uint, "application:printFiles:withSettings:showPrintPanels:", NSApplication, NSArray, NSDictionary, bool)(application, fileNames, printSettings, showPrintPanels);
406 }
407
408 void application (NSApplication sender, NSArray filenames)
409 {
410 return invokeObjcSelf!(void, "application:printFiles:", NSApplication, NSArray)(sender, filenames);
411 }
412
413 bool applicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
414 {
415 return invokeObjcSelf!(bool, "applicationShouldTerminateAfterLastWindowClosed:", NSApplication)(sender);
416 }
417
418 bool applicationShouldHandleReopen (NSApplication sender, bool flag)
419 {
420 return invokeObjcSelf!(bool, "applicationShouldHandleReopen:hasVisibleWindows:", NSApplication, bool)(sender, flag);
421 }
422
423 NSMenu applicationDockMenu (NSApplication sender)
424 {
425 return invokeObjcSelf!(NSMenu, "applicationDockMenu:", NSApplication)(sender);
426 }
427
428 NSError application (NSApplication application, NSError error)
429 {
430 return invokeObjcSelf!(NSError, "application:willPresentError:", NSApplication, NSError)(application, error);
431 }
432
433 //mixin ObjcBindMethod!(applicationShouldTerminate, "applicationShouldTerminate:");
434 //mixin ObjcBindMethod!(application, "application:openFile:");
435 //mixin ObjcBindMethod!(application, "application:openFiles:");
436 //mixin ObjcBindMethod!(application, "application:openTempFile:");
437 //mixin ObjcBindMethod!(applicationShouldOpenUntitledFile, "applicationShouldOpenUntitledFile:");
438 //mixin ObjcBindMethod!(applicationOpenUntitledFile, "applicationOpenUntitledFile:");
439 //mixin ObjcBindMethod!(application, "application:openFileWithoutUI:");
440 //mixin ObjcBindMethod!(application, "application:printFile:");
441 //mixin ObjcBindMethod!(application, "application:printFiles:withSettings:showPrintPanels:");
442 //mixin ObjcBindMethod!(application, "application:printFiles:");
443 //mixin ObjcBindMethod!(applicationShouldTerminateAfterLastWindowClosed, "applicationShouldTerminateAfterLastWindowClosed:");
444 //mixin ObjcBindMethod!(applicationShouldHandleReopen, "applicationShouldHandleReopen:hasVisibleWindows:");
445 //mixin ObjcBindMethod!(applicationDockMenu, "applicationDockMenu:");
446 //mixin ObjcBindMethod!(application, "application:willPresentError:");
447
448 `;
449
450 const TNSApplicationNotifications = `
451
452 void applicationWillFinishLaunching (NSNotification notification)
453 {
454 return invokeObjcSelf!(void, "applicationWillFinishLaunching:", NSNotification)(notification);
455 }
456
457 void applicationDidFinishLaunching (NSNotification notification)
458 {
459 return invokeObjcSelf!(void, "applicationDidFinishLaunching:", NSNotification)(notification);
460 }
461
462 void applicationWillHide (NSNotification notification)
463 {
464 return invokeObjcSelf!(void, "applicationWillHide:", NSNotification)(notification);
465 }
466
467 void applicationDidHide (NSNotification notification)
468 {
469 return invokeObjcSelf!(void, "applicationDidHide:", NSNotification)(notification);
470 }
471
472 void applicationWillUnhide (NSNotification notification)
473 {
474 return invokeObjcSelf!(void, "applicationWillUnhide:", NSNotification)(notification);
475 }
476
477 void applicationDidUnhide (NSNotification notification)
478 {
479 return invokeObjcSelf!(void, "applicationDidUnhide:", NSNotification)(notification);
480 }
481
482 void applicationWillBecomeActive (NSNotification notification)
483 {
484 return invokeObjcSelf!(void, "applicationWillBecomeActive:", NSNotification)(notification);
485 }
486
487 void applicationDidBecomeActive (NSNotification notification)
488 {
489 return invokeObjcSelf!(void, "applicationDidBecomeActive:", NSNotification)(notification);
490 }
491
492 void applicationWillResignActive (NSNotification notification)
493 {
494 return invokeObjcSelf!(void, "applicationWillResignActive:", NSNotification)(notification);
495 }
496
497 void applicationDidResignActive (NSNotification notification)
498 {
499 return invokeObjcSelf!(void, "applicationDidResignActive:", NSNotification)(notification);
500 }
501
502 void applicationWillUpdate (NSNotification notification)
503 {
504 return invokeObjcSelf!(void, "applicationWillUpdate:", NSNotification)(notification);
505 }
506
507 void applicationDidUpdate (NSNotification notification)
508 {
509 return invokeObjcSelf!(void, "applicationDidUpdate:", NSNotification)(notification);
510 }
511
512 void applicationWillTerminate (NSNotification notification)
513 {
514 return invokeObjcSelf!(void, "applicationWillTerminate:", NSNotification)(notification);
515 }
516
517 void applicationDidChangeScreenParameters (NSNotification notification)
518 {
519 return invokeObjcSelf!(void, "applicationDidChangeScreenParameters:", NSNotification)(notification);
520 }
521
522 //mixin ObjcBindMethod!(applicationWillFinishLaunching, "applicationWillFinishLaunching:");
523 //mixin ObjcBindMethod!(applicationDidFinishLaunching, "applicationDidFinishLaunching:");
524 //mixin ObjcBindMethod!(applicationWillHide, "applicationWillHide:");
525 //mixin ObjcBindMethod!(applicationDidHide, "applicationDidHide:");
526 //mixin ObjcBindMethod!(applicationWillUnhide, "applicationWillUnhide:");
527 //mixin ObjcBindMethod!(applicationDidUnhide, "applicationDidUnhide:");
528 //mixin ObjcBindMethod!(applicationWillBecomeActive, "applicationWillBecomeActive:");
529 //mixin ObjcBindMethod!(applicationDidBecomeActive, "applicationDidBecomeActive:");
530 //mixin ObjcBindMethod!(applicationWillResignActive, "applicationWillResignActive:");
531 //mixin ObjcBindMethod!(applicationDidResignActive, "applicationDidResignActive:");
532 //mixin ObjcBindMethod!(applicationWillUpdate, "applicationWillUpdate:");
533 //mixin ObjcBindMethod!(applicationDidUpdate, "applicationDidUpdate:");
534 //mixin ObjcBindMethod!(applicationWillTerminate, "applicationWillTerminate:");
535 //mixin ObjcBindMethod!(applicationDidChangeScreenParameters, "applicationDidChangeScreenParameters:");
536
537 `;
538
539 const TNSServicesHandling = `
540
541 void setServicesProvider (Object provider)
542 {
543 return invokeObjcSelf!(void, "setServicesProvider:", Object)(provider);
544 }
545
546 Object servicesProvider ()
547 {
548 return invokeObjcSelf!(Object, "servicesProvider");
549 }
550
551 //mixin ObjcBindMethod!(setServicesProvider, "setServicesProvider:");
552 //mixin ObjcBindMethod!(servicesProvider, "servicesProvider");
553
554 `;
555
556 class NSApplication : NSResponder, INSUserInterfaceValidations
557 {
558 mixin (ObjcWrap);
559
560 static NSApplication sharedApplication ()
561 {
562 return invokeObjcSelfClass!(NSApplication, "sharedApplication");
563 }
564
565 void setDelegate (Object anObject)
566 {
567 return invokeObjcSelf!(void, "setDelegate:", Object)(anObject);
568 }
569
570 Object delegate_ ()
571 {
572 return invokeObjcSelf!(Object, "delegate");
573 }
574
575 NSGraphicsContext context ()
576 {
577 return invokeObjcSelf!(NSGraphicsContext, "context");
578 }
579
580 void hide (Object sender)
581 {
582 return invokeObjcSelf!(void, "hide:", Object)(sender);
583 }
584
585 void unhide (Object sender)
586 {
587 return invokeObjcSelf!(void, "unhide:", Object)(sender);
588 }
589
590 void unhideWithoutActivation ()
591 {
592 return invokeObjcSelf!(void, "unhideWithoutActivation");
593 }
594
595 NSWindow windowWithWindowNumber (NSInteger windowNum)
596 {
597 return invokeObjcSelf!(NSWindow, "windowWithWindowNumber:", NSInteger)(windowNum);
598 }
599
600 NSWindow mainWindow ()
601 {
602 return invokeObjcSelf!(NSWindow, "mainWindow");
603 }
604
605 NSWindow keyWindow ()
606 {
607 return invokeObjcSelf!(NSWindow, "keyWindow");
608 }
609
610 bool isActive ()
611 {
612 return invokeObjcSelf!(bool, "isActive");
613 }
614
615 bool isHidden ()
616 {
617 return invokeObjcSelf!(bool, "isHidden");
618 }
619
620 bool isRunning ()
621 {
622 return invokeObjcSelf!(bool, "isRunning");
623 }
624
625 void deactivate ()
626 {
627 return invokeObjcSelf!(void, "deactivate");
628 }
629
630 void activateIgnoringOtherApps (bool flag)
631 {
632 return invokeObjcSelf!(void, "activateIgnoringOtherApps:", bool)(flag);
633 }
634
635 void hideOtherApplications (Object sender)
636 {
637 return invokeObjcSelf!(void, "hideOtherApplications:", Object)(sender);
638 }
639
640 void unhideAllApplications (Object sender)
641 {
642 return invokeObjcSelf!(void, "unhideAllApplications:", Object)(sender);
643 }
644
645 void finishLaunching ()
646 {
647 return invokeObjcSelf!(void, "finishLaunching");
648 }
649
650 void run ()
651 {
652 return invokeObjcSelf!(void, "run");
653 }
654
655 NSInteger runModalForWindow (NSWindow theWindow)
656 {
657 return invokeObjcSelf!(NSInteger, "runModalForWindow:", NSWindow)(theWindow);
658 }
659
660 void stop (Object sender)
661 {
662 return invokeObjcSelf!(void, "stop:", Object)(sender);
663 }
664
665 void stopModal ()
666 {
667 return invokeObjcSelf!(void, "stopModal");
668 }
669
670 void stopModalWithCode (NSInteger returnCode)
671 {
672 return invokeObjcSelf!(void, "stopModalWithCode:", NSInteger)(returnCode);
673 }
674
675 void abortModal ()
676 {
677 return invokeObjcSelf!(void, "abortModal");
678 }
679
680 NSWindow modalWindow ()
681 {
682 return invokeObjcSelf!(NSWindow, "modalWindow");
683 }
684
685 NSModalSession beginModalSessionForWindow (NSWindow theWindow)
686 {
687 return invokeObjcSelf!(NSModalSession, "beginModalSessionForWindow:", NSWindow)(theWindow);
688 }
689
690 NSInteger runModalSession (NSModalSession session)
691 {
692 return invokeObjcSelf!(NSInteger, "runModalSession:", NSModalSession)(session);
693 }
694
695 void endModalSession (NSModalSession session)
696 {
697 return invokeObjcSelf!(void, "endModalSession:", NSModalSession)(session);
698 }
699
700 void terminate (Object sender)
701 {
702 return invokeObjcSelf!(void, "terminate:", Object)(sender);
703 }
704
705 NSInteger requestUserAttention (uint requestType)
706 {
707 return invokeObjcSelf!(NSInteger, "requestUserAttention:", uint)(requestType);
708 }
709
710 void cancelUserAttentionRequest (NSInteger request)
711 {
712 return invokeObjcSelf!(void, "cancelUserAttentionRequest:", NSInteger)(request);
713 }
714
715 void beginSheet (NSWindow sheet, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, void* contextInfo)
716 {
717 return invokeObjcSelf!(void, "beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSWindow, NSWindow, Object, SEL, void*)(sheet, docWindow, modalDelegate, didEndSelector, contextInfo);
718 }
719
720 void endSheet (NSWindow sheet)
721 {
722 return invokeObjcSelf!(void, "endSheet:", NSWindow)(sheet);
723 }
724
725 void endSheet (NSWindow sheet, NSInteger returnCode)
726 {
727 return invokeObjcSelf!(void, "endSheet:returnCode:", NSWindow, NSInteger)(sheet, returnCode);
728 }
729
730 NSInteger runModalForWindow (NSWindow theWindow, NSWindow docWindow)
731 {
732 return invokeObjcSelf!(NSInteger, "runModalForWindow:relativeToWindow:", NSWindow, NSWindow)(theWindow, docWindow);
733 }
734
735 NSModalSession beginModalSessionForWindow (NSWindow theWindow, NSWindow docWindow)
736 {
737 return invokeObjcSelf!(NSModalSession, "beginModalSessionForWindow:relativeToWindow:", NSWindow, NSWindow)(theWindow, docWindow);
738 }
739
740 NSEvent nextEventMatchingMask (NSUInteger mask, NSDate expiration, NSString mode, bool deqFlag)
741 {
742 return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:untilDate:inMode:dequeue:", NSUInteger, NSDate, NSString, bool)(mask, expiration, mode, deqFlag);
743 }
744
745 void discardEventsMatchingMask (NSUInteger mask, NSEvent lastEvent)
746 {
747 return invokeObjcSelf!(void, "discardEventsMatchingMask:beforeEvent:", NSUInteger, NSEvent)(mask, lastEvent);
748 }
749
750 void postEvent (NSEvent event, bool flag)
751 {
752 return invokeObjcSelf!(void, "postEvent:atStart:", NSEvent, bool)(event, flag);
753 }
754
755 NSEvent currentEvent ()
756 {
757 return invokeObjcSelf!(NSEvent, "currentEvent");
758 }
759
760 void sendEvent (NSEvent theEvent)
761 {
762 return invokeObjcSelf!(void, "sendEvent:", NSEvent)(theEvent);
763 }
764
765 void preventWindowOrdering ()
766 {
767 return invokeObjcSelf!(void, "preventWindowOrdering");
768 }
769
770 NSWindow makeWindowsPerform (SEL aSelector, bool flag)
771 {
772 return invokeObjcSelf!(NSWindow, "makeWindowsPerform:inOrder:", SEL, bool)(aSelector, flag);
773 }
774
775 NSArray windows ()
776 {
777 return invokeObjcSelf!(NSArray, "windows");
778 }
779
780 void setWindowsNeedUpdate (bool needUpdate)
781 {
782 return invokeObjcSelf!(void, "setWindowsNeedUpdate:", bool)(needUpdate);
783 }
784
785 void updateWindows ()
786 {
787 return invokeObjcSelf!(void, "updateWindows");
788 }
789
790 void setMainMenu (NSMenu aMenu)
791 {
792 return invokeObjcSelf!(void, "setMainMenu:", NSMenu)(aMenu);
793 }
794
795 NSMenu mainMenu ()
796 {
797 return invokeObjcSelf!(NSMenu, "mainMenu");
798 }
799
800 void setApplicationIconImage (NSImage image)
801 {
802 return invokeObjcSelf!(void, "setApplicationIconImage:", NSImage)(image);
803 }
804
805 NSImage applicationIconImage ()
806 {
807 return invokeObjcSelf!(NSImage, "applicationIconImage");
808 }
809
810 NSDockTile dockTile ()
811 {
812 return invokeObjcSelf!(NSDockTile, "dockTile");
813 }
814
815 bool sendAction (SEL theAction, Object theTarget, Object sender)
816 {
817 return invokeObjcSelf!(bool, "sendAction:to:from:", SEL, Object, Object)(theAction, theTarget, sender);
818 }
819
820 Object targetForAction (SEL theAction)
821 {
822 return invokeObjcSelf!(Object, "targetForAction:", SEL)(theAction);
823 }
824
825 Object targetForAction (SEL theAction, Object theTarget, Object sender)
826 {
827 return invokeObjcSelf!(Object, "targetForAction:to:from:", SEL, Object, Object)(theAction, theTarget, sender);
828 }
829
830 bool tryToPerform (SEL anAction, Object anObject)
831 {
832 return invokeObjcSelf!(bool, "tryToPerform:with:", SEL, Object)(anAction, anObject);
833 }
834
835 Object validRequestorForSendType (NSString sendType, NSString returnType)
836 {
837 return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType);
838 }
839
840 void reportException (NSException theException)
841 {
842 return invokeObjcSelf!(void, "reportException:", NSException)(theException);
843 }
844
845 static void detachDrawingThread (SEL selector, Object target, Object argument)
846 {
847 return invokeObjcSelfClass!(void, "detachDrawingThread:toTarget:withObject:", SEL, Object, Object)(selector, target, argument);
848 }
849
850 void replyToApplicationShouldTerminate (bool shouldTerminate)
851 {
852 return invokeObjcSelf!(void, "replyToApplicationShouldTerminate:", bool)(shouldTerminate);
853 }
854
855 void replyToOpenOrPrint (uint reply)
856 {
857 return invokeObjcSelf!(void, "replyToOpenOrPrint:", uint)(reply);
858 }
859
860 void orderFrontCharacterPalette (Object sender)
861 {
862 return invokeObjcSelf!(void, "orderFrontCharacterPalette:", Object)(sender);
863 }
864
865 bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem)
866 {
867 return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem);
868 }
869
870 // NSServicesMenu
871 void setServicesMenu (NSMenu aMenu)
872 {
873 return invokeObjcSelf!(void, "setServicesMenu:", NSMenu)(aMenu);
874 }
875
876 NSMenu servicesMenu ()
877 {
878 return invokeObjcSelf!(NSMenu, "servicesMenu");
879 }
880
881 void registerServicesMenuSendTypes (NSArray sendTypes, NSArray returnTypes)
882 {
883 return invokeObjcSelf!(void, "registerServicesMenuSendTypes:returnTypes:", NSArray, NSArray)(sendTypes, returnTypes);
884 }
885
886 // NSApplicationHelpExtension
887 void activateContextHelpMode (Object sender)
888 {
889 return invokeObjcSelf!(void, "activateContextHelpMode:", Object)(sender);
890 }
891
892 void showHelp (Object sender)
893 {
894 return invokeObjcSelf!(void, "showHelp:", Object)(sender);
895 }
896
897 // NSStandardAboutPanel
898 void orderFrontStandardAboutPanel (Object sender)
899 {
900 return invokeObjcSelf!(void, "orderFrontStandardAboutPanel:", Object)(sender);
901 }
902
903 void orderFrontStandardAboutPanelWithOptions (NSDictionary optionsDictionary)
904 {
905 return invokeObjcSelf!(void, "orderFrontStandardAboutPanelWithOptions:", NSDictionary)(optionsDictionary);
906 }
907
908 // NSWindowsMenu
909 void setWindowsMenu (NSMenu aMenu)
910 {
911 return invokeObjcSelf!(void, "setWindowsMenu:", NSMenu)(aMenu);
912 }
913
914 NSMenu windowsMenu ()
915 {
916 return invokeObjcSelf!(NSMenu, "windowsMenu");
917 }
918
919 void arrangeInFront (Object sender)
920 {
921 return invokeObjcSelf!(void, "arrangeInFront:", Object)(sender);
922 }
923
924 void removeWindowsItem (NSWindow win)
925 {
926 return invokeObjcSelf!(void, "removeWindowsItem:", NSWindow)(win);
927 }
928
929 void addWindowsItem (NSWindow win, NSString aString, bool isFilename)
930 {
931 return invokeObjcSelf!(void, "addWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename);
932 }
933
934 void changeWindowsItem (NSWindow win, NSString aString, bool isFilename)
935 {
936 return invokeObjcSelf!(void, "changeWindowsItem:title:filename:", NSWindow, NSString, bool)(win, aString, isFilename);
937 }
938
939 void updateWindowsItem (NSWindow win)
940 {
941 return invokeObjcSelf!(void, "updateWindowsItem:", NSWindow)(win);
942 }
943
944 void miniaturizeAll (Object sender)
945 {
946 return invokeObjcSelf!(void, "miniaturizeAll:", Object)(sender);
947 }
948
949 // NSPageLayoutPanel
950 void runPageLayout (Object sender)
951 {
952 return invokeObjcSelf!(void, "runPageLayout:", Object)(sender);
953 }
954
955 // NSServicesHandling
956 void setServicesProvider (Object provider)
957 {
958 return invokeObjcSelf!(void, "setServicesProvider:", Object)(provider);
959 }
960
961 Object servicesProvider ()
962 {
963 return invokeObjcSelf!(Object, "servicesProvider");
964 }
965
966 // NSColorPanel
967 void orderFrontColorPanel (Object sender)
968 {
969 return invokeObjcSelf!(void, "orderFrontColorPanel:", Object)(sender);
970 }
971 }
972
973 bool NSShowsServicesMenuItem (NSString itemName)
974 {
975 return Bridge.invokeObjcFunction!(bool, bindings.NSShowsServicesMenuItem, NSString)(itemName);
976 }
977
978 NSInteger NSSetShowsServicesMenuItem (NSString itemName, bool enabled)
979 {
980 return Bridge.invokeObjcFunction!(NSInteger, bindings.NSSetShowsServicesMenuItem, NSString, bool)(itemName, enabled);
981 }
982
983 bool NSPerformService (NSString itemName, NSPasteboard pboard)
984 {
985 return Bridge.invokeObjcFunction!(bool, bindings.NSPerformService, NSString, NSPasteboard)(itemName, pboard);
986 }
987
988 void NSRegisterServicesProvider (Object provider, NSString name)
989 {
990 return Bridge.invokeObjcFunction!(void, bindings.NSRegisterServicesProvider, Object, NSString)(provider, name);
991 }
992
993 void NSUnregisterServicesProvider (NSString name)
994 {
995 return Bridge.invokeObjcFunction!(void, bindings.NSUnregisterServicesProvider, NSString)(name);
996 }
997
998 int NSApplicationMain (string[] args)
999 {
1000 if (args.length == 0)
1001 return NSApplicationMain(0, null);
1002
1003 char*[] cArgs;
1004 cArgs.reserve(args.length);
1005
1006 foreach (str ; args)
1007 cArgs ~= (str ~ '\0').ptr;
1008
1009 return NSApplicationMain(cArgs.length, cArgs.ptr);
1010 }
1011
1012 int NSApplicationMain ()
1013 {
1014 return NSApplicationMain(0, null);
1015 }
1016
1017 extern (C)
1018 {
1019 int NSApplicationMain (int argc, char** argv);
1020 bool NSApplicationLoad ();
1021 void NSUpdateDynamicServices ();
1022 }