Merge branch 'master' of git@github.com:280north/cappuccino

This commit is contained in:
Francisco Ryan Tolmasky I
2009-05-24 14:20:44 -07:00
3 changed files with 73 additions and 0 deletions
+1
View File
@@ -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"
+9
View File
@@ -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";
+63
View File
@@ -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