Mercurial > projects > dwt-mac
changeset 68:cce7edf30dae
Ported dwt.widgets.FileDialog
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 23 Dec 2008 23:16:05 +0100 |
parents | a47b2ee8cbde |
children | 39340f7612f8 |
files | dwt/widgets/FileDialog.d |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/FileDialog.d Tue Dec 23 23:04:31 2008 +0100 +++ b/dwt/widgets/FileDialog.d Tue Dec 23 23:16:05 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.widgets.FileDialog; @@ -21,6 +24,10 @@ import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; +import dwt.internal.objc.cocoa.Cocoa; +import dwt.widgets.Dialog; +import dwt.widgets.Shell; + /** * Instances of this class allow the user to navigate * the file system and select or enter a file name. @@ -44,7 +51,7 @@ public class FileDialog : Dialog { String [] filterNames = new String [0]; String [] filterExtensions = new String [0]; - String [] fileNames = new String[0]; + String [] fileNames = new String [0]; String filterPath = "", fileName = ""; int filterIndex = -1; bool overwrite = true; //TODO: if setOverwrite(false) is implemented, change default to false for consistency @@ -209,16 +216,16 @@ } if (filterPath !is null) panel.setDirectory(NSString.stringWith(filterPath)); panel.setTitle(NSString.stringWith(title !is null ? title : "")); - int /*long*/ response = panel.runModal(); + NSInteger response = panel.runModal(); if (response is OS.NSFileHandlingPanelOKButton) { NSString filename = panel.filename(); fullPath = filename.getString(); if ((style & DWT.SAVE) is 0) { NSArray filenames = (cast(NSOpenPanel)panel).filenames(); - int count = (int)/*64*/filenames.count(); + NSUInteger count = filenames.count(); fileNames = new String[count]; - for (int i = 0; i < count; i++) { + for (NSUInteger i = 0; i < count; i++) { filename = new NSString(filenames.objectAtIndex(i)); NSString filenameOnly = filename.lastPathComponent(); NSString pathOnly = filename.stringByDeletingLastPathComponent();