Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSAlert.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
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.NSAlert; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSButton; import dwt.internal.cocoa.NSError; import dwt.internal.cocoa.NSImage; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSView; import dwt.internal.cocoa.NSWindow; import dwt.internal.cocoa.OS; 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 cast(NSAlertStyle) 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 cast(NSInteger) 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_ : null); } 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; } }