mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-21 18:00:43 +00:00
Merge branch 'master' of git@github.com:280north/cappuccino
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
@import "CPImageView.j"
|
||||
@import "CPMenu.j"
|
||||
@import "CPMenuItem.j"
|
||||
@import "CPOpenPanel.j"
|
||||
@import "CPPanel.j"
|
||||
@import "CPPasteboard.j"
|
||||
@import "CPPopUpButton.j"
|
||||
|
||||
@@ -623,6 +623,15 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPColor (Debugging)
|
||||
|
||||
+ (CPColor)randomColor
|
||||
{
|
||||
return [CPColor colorWithRed:RAND() green:RAND() blue:RAND() alpha:1.0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPColorComponentsKey = @"CPColorComponentsKey",
|
||||
CPColorPatternImageKey = @"CPColorPatternImageKey";
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
@import <AppKit/CPPanel.j>
|
||||
#include "Platform/Platform.h"
|
||||
|
||||
var SharedOpenPanel = nil;
|
||||
|
||||
@implementation CPOpenPanel : CPPanel
|
||||
{
|
||||
CPArray _files;
|
||||
BOOL _canChooseFiles @accessors(property=canChooseFiles);
|
||||
BOOL _canChooseDirectories @accessors(property=canChooseDirectories);
|
||||
BOOL _allowsMultipleSelection @accessors(property=allowsMultipleSelection);
|
||||
}
|
||||
|
||||
+ (id)openPanel
|
||||
{
|
||||
if (!SharedOpenPanel)
|
||||
SharedOpenPanel = [[CPOpenPanel alloc] init];
|
||||
|
||||
return SharedOpenPanel;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_files = [];
|
||||
_canChooseFiles = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)filenames
|
||||
{
|
||||
return _files;
|
||||
}
|
||||
|
||||
- (unsigned)runModalForDirectory:(CPString)absoluteDirectoryPath file:(CPString)filename types:(CPArray)fileTypes
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
console.log("0 "+Titanium);
|
||||
console.log("1 "+window.Titanium);
|
||||
if (window.Titanium)
|
||||
{
|
||||
_files = Titanium.Desktop.openFiles({
|
||||
path:absoluteDirectoryPath,
|
||||
types:fileTypes,
|
||||
multiple:_allowsMultipleSelection,
|
||||
filename:filename,
|
||||
directories:_canChooseDirectories,
|
||||
files:_canChooseFiles
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (unsigned)runModalForTypes:(CPArray)fileTypes
|
||||
{alert("HERE");
|
||||
[self runModalForDirectory:"/" file:nil types:fileTypes];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user