Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSApplication.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSApplication; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSDate; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSDockTile; import dwt.internal.cocoa.NSEvent; import dwt.internal.cocoa.NSException; import dwt.internal.cocoa.NSGraphicsContext; import dwt.internal.cocoa.NSImage; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSMenu; import dwt.internal.cocoa.NSResponder; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSWindow; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSApplication : NSResponder { public this () { super(); } public this (objc.id id) { super(id); } public void abortModal () { OS.objc_msgSend(this.id, OS.sel_abortModal); } public void activateContextHelpMode (id sender) { OS.objc_msgSend(this.id, OS.sel_activateContextHelpMode_1, sender !is null ? sender.id : null); } public void activateIgnoringOtherApps (bool flag) { OS.objc_msgSend(this.id, OS.sel_activateIgnoringOtherApps_1, flag); } public void addWindowsItem (NSWindow win, NSString aString, bool isFilename) { OS.objc_msgSend(this.id, OS.sel_addWindowsItem_1title_1filename_1, win !is null ? win.id : null, aString !is null ? aString.id : null, isFilename); } public NSImage applicationIconImage () { objc.id result = OS.objc_msgSend(this.id, OS.sel_applicationIconImage); return result !is null ? new NSImage(result) : null; } public void arrangeInFront (id sender) { OS.objc_msgSend(this.id, OS.sel_arrangeInFront_1, sender !is null ? sender.id : null); } public objc.id beginModalSessionForWindow_ (NSWindow theWindow) { return OS.objc_msgSend(this.id, OS.sel_beginModalSessionForWindow_1, theWindow !is null ? theWindow.id : null); } public objc.id beginModalSessionForWindow_relativeToWindow_ (NSWindow theWindow, NSWindow docWindow) { return OS.objc_msgSend(this.id, OS.sel_beginModalSessionForWindow_1relativeToWindow_1, theWindow !is null ? theWindow.id : null, docWindow !is null ? docWindow.id : null); } public void beginSheet (NSWindow sheet, NSWindow docWindow, id modalDelegate, objc.id didEndSelector, objc.id contextInfo) { OS.objc_msgSend(this.id, OS.sel_beginSheet_1modalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1, sheet !is null ? sheet.id : null, docWindow !is null ? docWindow.id : null, modalDelegate !is null ? modalDelegate.id : null, didEndSelector, contextInfo); } public void cancelUserAttentionRequest (objc.id request) { OS.objc_msgSend(this.id, OS.sel_cancelUserAttentionRequest_1, request); } public void changeWindowsItem (NSWindow win, NSString aString, bool isFilename) { OS.objc_msgSend(this.id, OS.sel_changeWindowsItem_1title_1filename_1, win !is null ? win.id : null, aString !is null ? aString.id : null, isFilename); } public NSGraphicsContext context () { objc.id result = OS.objc_msgSend(this.id, OS.sel_context); return result !is null ? new NSGraphicsContext(result) : null; } public NSEvent currentEvent () { objc.id result = OS.objc_msgSend(this.id, OS.sel_currentEvent); return result !is null ? new NSEvent(result) : null; } public void deactivate () { OS.objc_msgSend(this.id, OS.sel_deactivate); } public id delegatee () { objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); return result !is null ? new id(result) : null; } public static void detachDrawingThread (objc.id selector, id target, id argument) { OS.objc_msgSend(OS.class_NSApplication, OS.sel_detachDrawingThread_1toTarget_1withObject_1, selector, target !is null ? target.id : null, argument !is null ? argument.id : null); } public void discardEventsMatchingMask (NSUInteger mask, NSEvent lastEvent) { OS.objc_msgSend(this.id, OS.sel_discardEventsMatchingMask_1beforeEvent_1, mask, lastEvent !is null ? lastEvent.id : null); } public NSDockTile dockTile () { objc.id result = OS.objc_msgSend(this.id, OS.sel_dockTile); return result !is null ? new NSDockTile(result) : null; } public void endModalSession (objc.id session) { OS.objc_msgSend(this.id, OS.sel_endModalSession_1, session); } public void endSheet_ (NSWindow sheet) { OS.objc_msgSend(this.id, OS.sel_endSheet_1, sheet !is null ? sheet.id : null); } public void endSheet_returnCode_ (NSWindow sheet, NSInteger returnCode) { OS.objc_msgSend(this.id, OS.sel_endSheet_1returnCode_1, sheet !is null ? sheet.id : null, returnCode); } public void finishLaunching () { OS.objc_msgSend(this.id, OS.sel_finishLaunching); } public void hide (id sender) { OS.objc_msgSend(this.id, OS.sel_hide_1, sender !is null ? sender.id : null); } public void hideOtherApplications (id sender) { OS.objc_msgSend(this.id, OS.sel_hideOtherApplications_1, sender !is null ? sender.id : null); } public bool isActive () { return OS.objc_msgSend(this.id, OS.sel_isActive) !is null; } public bool isHidden () { return OS.objc_msgSend(this.id, OS.sel_isHidden) !is null; } public bool isRunning () { return OS.objc_msgSend(this.id, OS.sel_isRunning) !is null; } public NSWindow keyWindow () { objc.id result = OS.objc_msgSend(this.id, OS.sel_keyWindow); return result !is null ? new NSWindow(result) : null; } public NSMenu mainMenu () { objc.id result = OS.objc_msgSend(this.id, OS.sel_mainMenu); return result !is null ? new NSMenu(result) : null; } public NSWindow mainWindow () { objc.id result = OS.objc_msgSend(this.id, OS.sel_mainWindow); return result !is null ? new NSWindow(result) : null; } public NSWindow makeWindowsPerform (objc.id aSelector, bool flag) { objc.id result = OS.objc_msgSend(this.id, OS.sel_makeWindowsPerform_1inOrder_1, aSelector, flag); return result !is null ? new NSWindow(result) : null; } public void miniaturizeAll (id sender) { OS.objc_msgSend(this.id, OS.sel_miniaturizeAll_1, sender !is null ? sender.id : null); } public NSWindow modalWindow () { objc.id result = OS.objc_msgSend(this.id, OS.sel_modalWindow); return result !is null ? new NSWindow(result) : null; } public NSEvent nextEventMatchingMask (NSUInteger mask, NSDate expiration, NSString mode, bool deqFlag) { objc.id result = OS.objc_msgSend(this.id, OS.sel_nextEventMatchingMask_1untilDate_1inMode_1dequeue_1, mask, expiration !is null ? expiration.id : null, mode !is null ? mode.id : null, deqFlag); return result !is null ? new NSEvent(result) : null; } public void orderFrontCharacterPalette (id sender) { OS.objc_msgSend(this.id, OS.sel_orderFrontCharacterPalette_1, sender !is null ? sender.id : null); } public void orderFrontColorPanel (id sender) { OS.objc_msgSend(this.id, OS.sel_orderFrontColorPanel_1, sender !is null ? sender.id : null); } public void orderFrontStandardAboutPanel (id sender) { OS.objc_msgSend(this.id, OS.sel_orderFrontStandardAboutPanel_1, sender !is null ? sender.id : null); } public void orderFrontStandardAboutPanelWithOptions (NSDictionary optionsDictionary) { OS.objc_msgSend(this.id, OS.sel_orderFrontStandardAboutPanelWithOptions_1, optionsDictionary !is null ? optionsDictionary.id : null); } public NSArray orderedDocuments () { objc.id result = OS.objc_msgSend(this.id, OS.sel_orderedDocuments); return result !is null ? new NSArray(result) : null; } public NSArray orderedWindows () { objc.id result = OS.objc_msgSend(this.id, OS.sel_orderedWindows); return result !is null ? new NSArray(result) : null; } public void postEvent (NSEvent event, bool flag) { OS.objc_msgSend(this.id, OS.sel_postEvent_1atStart_1, event !is null ? event.id : null, flag); } public void preventWindowOrdering () { OS.objc_msgSend(this.id, OS.sel_preventWindowOrdering); } public void registerServicesMenuSendTypes (NSArray sendTypes, NSArray returnTypes) { OS.objc_msgSend(this.id, OS.sel_registerServicesMenuSendTypes_1returnTypes_1, sendTypes !is null ? sendTypes.id : null, returnTypes !is null ? returnTypes.id : null); } public void removeWindowsItem (NSWindow win) { OS.objc_msgSend(this.id, OS.sel_removeWindowsItem_1, win !is null ? win.id : null); } public void replyToApplicationShouldTerminate (bool shouldTerminate) { OS.objc_msgSend(this.id, OS.sel_replyToApplicationShouldTerminate_1, shouldTerminate); } public void replyToOpenOrPrint (objc.id reply) { OS.objc_msgSend(this.id, OS.sel_replyToOpenOrPrint_1, reply); } public void reportException (NSException theException) { OS.objc_msgSend(this.id, OS.sel_reportException_1, theException !is null ? theException.id : null); } public NSInteger requestUserAttention (objc.id requestType) { return OS.objc_msgSend(this.id, OS.sel_requestUserAttention_1, requestType); } public void run () { OS.objc_msgSend(this.id, OS.sel_run); } public objc.id runModalForWindow_ (NSWindow theWindow) { return OS.objc_msgSend(this.id, OS.sel_runModalForWindow_1, theWindow !is null ? theWindow.id : null); } public objc.id runModalForWindow_relativeToWindow_ (NSWindow theWindow, NSWindow docWindow) { return OS.objc_msgSend(this.id, OS.sel_runModalForWindow_1relativeToWindow_1, theWindow !is null ? theWindow.id : null, docWindow !is null ? docWindow.id : null); } public objc.id runModalSession (objc.id session) { return OS.objc_msgSend(this.id, OS.sel_runModalSession_1, session); } public void runPageLayout (id sender) { OS.objc_msgSend(this.id, OS.sel_runPageLayout_1, sender !is null ? sender.id : null); } public bool sendAction (objc.id theAction, id theTarget, id sender) { return OS.objc_msgSend(this.id, OS.sel_sendAction_1to_1from_1, theAction, theTarget !is null ? theTarget.id : null, sender !is null ? sender.id : null) !is null; } public void sendEvent (NSEvent theEvent) { OS.objc_msgSend(this.id, OS.sel_sendEvent_1, theEvent !is null ? theEvent.id : null); } public NSMenu servicesMenu () { objc.id result = OS.objc_msgSend(this.id, OS.sel_servicesMenu); return result !is null ? new NSMenu(result) : null; } public id servicesProvider () { objc.id result = OS.objc_msgSend(this.id, OS.sel_servicesProvider); return result !is null ? new id(result) : null; } public void setApplicationIconImage (NSImage image) { OS.objc_msgSend(this.id, OS.sel_setApplicationIconImage_1, image !is null ? image.id : null); } public void setDelegate (id anObject) { OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); } public void setMainMenu (NSMenu aMenu) { OS.objc_msgSend(this.id, OS.sel_setMainMenu_1, aMenu !is null ? aMenu.id : null); } public void setServicesMenu (NSMenu aMenu) { OS.objc_msgSend(this.id, OS.sel_setServicesMenu_1, aMenu !is null ? aMenu.id : null); } public void setServicesProvider (id provider) { OS.objc_msgSend(this.id, OS.sel_setServicesProvider_1, provider !is null ? provider.id : null); } public void setWindowsMenu (NSMenu aMenu) { OS.objc_msgSend(this.id, OS.sel_setWindowsMenu_1, aMenu !is null ? aMenu.id : null); } public void setWindowsNeedUpdate (bool needUpdate) { OS.objc_msgSend(this.id, OS.sel_setWindowsNeedUpdate_1, needUpdate); } public static NSApplication sharedApplication () { objc.id result = OS.objc_msgSend(OS.class_NSApplication, OS.sel_sharedApplication); return result !is null ? new NSApplication(result) : null; } public void showHelp (id sender) { OS.objc_msgSend(this.id, OS.sel_showHelp_1, sender !is null ? sender.id : null); } public void stop (id sender) { OS.objc_msgSend(this.id, OS.sel_stop_1, sender !is null ? sender.id : null); } public void stopModal () { OS.objc_msgSend(this.id, OS.sel_stopModal); } public void stopModalWithCode (NSInteger returnCode) { OS.objc_msgSend(this.id, OS.sel_stopModalWithCode_1, returnCode); } public id targetForAction_ (objc.SEL theAction) { objc.id result = OS.objc_msgSend(this.id, OS.sel_targetForAction_1, theAction); return result !is null ? new id(result) : null; } public id targetForAction_to_from_ (objc.SEL theAction, id theTarget, id sender) { objc.id result = OS.objc_msgSend(this.id, OS.sel_targetForAction_1to_1from_1, theAction, theTarget !is null ? theTarget.id : null, sender !is null ? sender.id : null); return result !is null ? new id(result) : null; } public void terminate (id sender) { OS.objc_msgSend(this.id, OS.sel_terminate_1, sender !is null ? sender.id : null); } public bool tryToPerform (objc.SEL anAction, id anObject) { return OS.objc_msgSend(this.id, OS.sel_tryToPerform_1with_1, anAction, anObject !is null ? anObject.id : null) !is null; } public void unhide (id sender) { OS.objc_msgSend(this.id, OS.sel_unhide_1, sender !is null ? sender.id : null); } public void unhideAllApplications (id sender) { OS.objc_msgSend(this.id, OS.sel_unhideAllApplications_1, sender !is null ? sender.id : null); } public void unhideWithoutActivation () { OS.objc_msgSend(this.id, OS.sel_unhideWithoutActivation); } public void updateWindows () { OS.objc_msgSend(this.id, OS.sel_updateWindows); } public void updateWindowsItem (NSWindow win) { OS.objc_msgSend(this.id, OS.sel_updateWindowsItem_1, win !is null ? win.id : null); } public id validRequestorForSendType (NSString sendType, NSString returnType) { objc.id result = OS.objc_msgSend(this.id, OS.sel_validRequestorForSendType_1returnType_1, sendType !is null ? sendType.id : null, returnType !is null ? returnType.id : null); return result !is null ? new id(result) : null; } public NSWindow windowWithWindowNumber (NSInteger windowNum) { objc.id result = OS.objc_msgSend(this.id, OS.sel_windowWithWindowNumber_1, windowNum); return result !is null ? new NSWindow(result) : null; } public NSArray windows () { objc.id result = OS.objc_msgSend(this.id, OS.sel_windows); return result !is null ? new NSArray(result) : null; } public NSMenu windowsMenu () { objc.id result = OS.objc_msgSend(this.id, OS.sel_windowsMenu); return result !is null ? new NSMenu(result) : null; } }