/AppKit/CPOpenPanel.j
http://github.com/cacaodev/cappuccino · Unknown · 67 lines · 55 code · 12 blank · 0 comment · 0 complexity · 3cf2dd576fd4357ed69baa4a7f9cf7ec MD5 · raw file
- /*
- * CPOpenPanel.j
- * AppKit
- *
- * Created by Ross Boucher.
- * Copyright 2009, 280 North, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
- @import "CPPanel.j"
- @implementation CPOpenPanel : CPPanel
- {
- BOOL _canChooseFiles @accessors(property=canChooseFiles);
- BOOL _canChooseDirectories @accessors(property=canChooseDirectories);
- BOOL _allowsMultipleSelection @accessors(property=allowsMultipleSelection);
- CPURL _directoryURL @accessors(property=directoryURL);
- CPArray _URLs;
- }
- + (id)openPanel
- {
- return [[CPOpenPanel alloc] init];
- }
- - (CPInteger)runModal
- {
- if (typeof window["cpOpenPanel"] === "function")
- {
- // FIXME: Is this correct???
- [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
- var options = { directoryURL: [self directoryURL],
- canChooseFiles: [self canChooseFiles],
- canChooseDirectories: [self canChooseDirectories],
- allowsMultipleSelection: [self allowsMultipleSelection] },
- result = window.cpOpenPanel(options);
- _URLs = result.URLs;
- return result.button;
- }
- throw "-runModal is unimplemented.";
- }
- - (CPArray)URLs
- {
- return _URLs;
- }
- @end