Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSAlert.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSAlert.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,192 @@ +/******************************************************************************* + * 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.NSAlert; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSButton; +import dwt.internal.cocoa.NSError; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSView; +import objc = dwt.internal.objc.runtime; + +alias NSUInteger NSAlertStyle; + +public class NSAlert : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public NSView accessoryView () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_accessoryView); + return result !is null ? new NSView(result) : null; + } + + public NSButton addButtonWithTitle (NSString title) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_addButtonWithTitle_1, title !is null ? title.id : null); + return result !is null ? new NSButton(result) : null; + } + + public NSAlertStyle alertStyle () + { + return OS.objc_msgSend(this.id, OS.sel_alertStyle); + } + + public static NSAlert alertWithError (NSError error) + { + objc.id result = OS.objc_msgSend(OS.class_NSAlert, OS.sel_alertWithError_1, error !is null ? error.id : null); + return result !is null ? new NSAlert(result) : null; + } + + public static NSAlert alertWithMessageText (NSString message, NSString defaultButton, NSString alternateButton, NSString otherButton, + NSString informativeTextWithFormat) + { + objc.id result = OS.objc_msgSend(OS.class_NSAlert, + OS.sel_alertWithMessageText_1defaultButton_1alternateButton_1otherButton_1informativeTextWithFormat_1, + message !is null ? message.id : null, defaultButton !is null ? defaultButton.id : null, + alternateButton !is null ? alternateButton.id : null, otherButton !is null ? otherButton.id : null, + informativeTextWithFormat !is null ? informativeTextWithFormat.id : null); + return result !is null ? new NSAlert(result) : null; + } + + public void beginSheetModalForWindow (NSWindow window, id delegatee, objc.SEL didEndSelector, void* contextInfo) + { + OS.objc_msgSend(this.id, OS.sel_beginSheetModalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1, window !is null ? window.id : null, + delegatee !is null ? delegatee.id : null, didEndSelector, contextInfo); + } + + public NSArray buttons () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_buttons); + return result !is null ? new NSArray(result) : null; + } + + public id delegatee () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + return result !is null ? new id(result) : null; + } + + public NSString helpAnchor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_helpAnchor); + return result !is null ? new NSString(result) : null; + } + + public NSImage icon () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_icon); + return result !is null ? new NSImage(result) : null; + } + + public NSString informativeText () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_informativeText); + return result !is null ? new NSString(result) : null; + } + + public void layout () + { + OS.objc_msgSend(this.id, OS.sel_layout); + } + + public NSString messageText () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_messageText); + return result !is null ? new NSString(result) : null; + } + + public NSInteger runModal () + { + return OS.objc_msgSend(this.id, OS.sel_runModal); + } + + public void setAccessoryView (NSView view) + { + OS.objc_msgSend(this.id, OS.sel_setAccessoryView_1, view !is null ? view.id : null); + } + + public void setAlertStyle (NSAlertStyle style) + { + OS.objc_msgSend(this.id, OS.sel_setAlertStyle_1, style); + } + + public void setDelegate (id delegatee) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null); + } + + public void setHelpAnchor (NSString anchor) + { + OS.objc_msgSend(this.id, OS.sel_setHelpAnchor_1, anchor !is null ? anchor.id : nullnull); + } + + public void setIcon (NSImage icon) + { + OS.objc_msgSend(this.id, OS.sel_setIcon_1, icon !is null ? icon.id : null); + } + + public void setInformativeText (NSString informativeText) + { + OS.objc_msgSend(this.id, OS.sel_setInformativeText_1, informativeText !is null ? informativeText.id : null); + } + + public void setMessageText (NSString messageText) + { + OS.objc_msgSend(this.id, OS.sel_setMessageText_1, messageText !is null ? messageText.id : null); + } + + public void setShowsHelp (bool showsHelp) + { + OS.objc_msgSend(this.id, OS.sel_setShowsHelp_1, showsHelp); + } + + public void setShowsSuppressionButton (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setShowsSuppressionButton_1, flag); + } + + public bool showsHelp () + { + return OS.objc_msgSend(this.id, OS.sel_showsHelp) !is null; + } + + public bool showsSuppressionButton () + { + return OS.objc_msgSend(this.id, OS.sel_showsSuppressionButton) !is null; + } + + public NSButton suppressionButton () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_suppressionButton); + return result !is null ? new NSButton(result) : null; + } + + public id window () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_window); + return result !is null ? new id(result) : null; + } +}