00001
00002 @import <AppKit/CPPanel.j>
00003
00004
00005 @implementation CPOpenPanel : CPPanel
00006 {
00007 BOOL _canChooseFiles @accessors(property=canChooseFiles);
00008 BOOL _canChooseDirectories @accessors(property=canChooseDirectories);
00009 BOOL _allowsMultipleSelection @accessors(property=allowsMultipleSelection);
00010 CPURL _directoryURL @accessors(property=directoryURL);
00011 CPArray _URLs;
00012 }
00013
00014 + (id)openPanel
00015 {
00016 return [[CPOpenPanel alloc] init];
00017 }
00018
00019 - (CPInteger)runModal
00020 {
00021 if (typeof window["cpOpenPanel"] === "function")
00022 {
00023
00024 [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
00025
00026 var options = { directoryURL: [self directoryURL],
00027 canChooseFiles: [self canChooseFiles],
00028 canChooseDirectories: [self canChooseDirectories],
00029 allowsMultipleSelection: [self allowsMultipleSelection] };
00030
00031 var result = window.cpOpenPanel(options);
00032
00033 _URLs = result.URLs;
00034
00035 return result.button;
00036 }
00037
00038 throw "-runModal is unimplemented.";
00039 }
00040
00041 - (CPArray)URLs
00042 {
00043 return _URLs;
00044 }
00045
00046 @end