mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-10 20:57:11 +00:00
Organized BlendKit classes into their own files and added licensing info.
Reviewed by me.
This commit is contained in:
@@ -1,13 +1,33 @@
|
||||
/*
|
||||
* BKShowcaseController.j
|
||||
* BlendKit
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 <AppKit/CPTheme.j>
|
||||
@import <AppKit/CPView.j>
|
||||
|
||||
@import "BKUtilities.j"
|
||||
|
||||
|
||||
var LEFT_PANEL_WIDTH = 176.0;
|
||||
|
||||
var BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdentifier",
|
||||
var BKLearnMoreToolbarItemIdentifier = @"BKLearnMoreToolbarItemIdentifier",
|
||||
BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdentifier",
|
||||
BKBackgroundColorToolbarItemIdentifier = @"BKBackgroundColorToolbarItemIdentifier";
|
||||
|
||||
@implementation BKShowcaseController : CPObject
|
||||
@@ -120,12 +140,12 @@ var BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdenti
|
||||
|
||||
- (CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)aToolbar
|
||||
{
|
||||
return [CPToolbarSpaceItemIdentifier, CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
|
||||
return [BKLearnMoreToolbarItemIdentifier, CPToolbarSpaceItemIdentifier, CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
|
||||
}
|
||||
|
||||
- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)aToolbar
|
||||
{
|
||||
return [CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
|
||||
return [BKLearnMoreToolbarItemIdentifier, CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
|
||||
}
|
||||
|
||||
- (CPToolbarItem)toolbar:(CPToolbar)aToolbar itemForItemIdentifier:(CPString)anItemIdentifier willBeInsertedIntoToolbar:(BOOL)aFlag
|
||||
@@ -151,7 +171,7 @@ var BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdenti
|
||||
[toolbarItem setMaxSize:CGSizeMake(width + 20.0, 32.0)];
|
||||
}
|
||||
|
||||
else if (BKBackgroundColorToolbarItemIdentifier)
|
||||
else if (anItemIdentifier === BKBackgroundColorToolbarItemIdentifier)
|
||||
{
|
||||
var popUpButton = [CPPopUpButton buttonWithTitle:@"Light Checkers"];
|
||||
|
||||
@@ -179,6 +199,20 @@ var BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdenti
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 32.0)];
|
||||
}
|
||||
else if (anItemIdentifier === BKLearnMoreToolbarItemIdentifier)
|
||||
{
|
||||
var button = [CPButton buttonWithTitle:@" Aristo Home Page "];
|
||||
|
||||
[button setDefaultButton:YES];
|
||||
|
||||
[toolbarItem setView:button];
|
||||
[toolbarItem setLabel:@"Learn More"];
|
||||
|
||||
var width = CGRectGetWidth([button frame]);
|
||||
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 32.0)];
|
||||
}
|
||||
|
||||
return toolbarItem;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* BKThemeDescriptor.j
|
||||
* BlendKit
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 <Foundation/CPObject.j>
|
||||
|
||||
@@ -121,7 +142,7 @@ var ItemSizes = { },
|
||||
if (!object)
|
||||
continue;
|
||||
|
||||
var template = [[BKThemeObjectTemplate alloc] init];
|
||||
var template = [[BKThemedObjectTemplate alloc] init];
|
||||
|
||||
[template setValue:object forKey:@"themedObject"];
|
||||
[template setValue:BKLabelFromIdentifier(selector) forKey:@"label"];
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* BKThemeTemplate.j
|
||||
* BlendKit
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 <Foundation/CPObject.j>
|
||||
|
||||
|
||||
@implementation BKThemeTemplate : CPObject
|
||||
{
|
||||
CPString _name;
|
||||
CPString _description;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_name = [aCoder decodeObjectForKey:@"BKThemeTemplateName"];
|
||||
_description = [aCoder decodeObjectForKey:@"BKThemeTemplateDescription"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_name forKey:@"BKThemeTemplateName"];
|
||||
[aCoder encodeObject:_description forKey:@"BKThemeTemplateDescription"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* BKThemedObjectTemplate.j
|
||||
* BlendKit
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 <AppKit/CPView.j>
|
||||
|
||||
|
||||
@implementation BKThemedObjectTemplate : CPView
|
||||
{
|
||||
CPString _label;
|
||||
id _themedObject;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_label = [aCoder decodeObjectForKey:@"BKThemedObjectTemplateLabel"];
|
||||
_themedObject = [aCoder decodeObjectForKey:@"BKThemedObjectTemplateThemedObject"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_label forKey:@"BKThemedObjectTemplateLabel"];
|
||||
[aCoder encodeObject:_themedObject forKey:@"BKThemedObjectTemplateThemedObject"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
@implementation BKThemeTemplate : CPObject
|
||||
{
|
||||
CPString _name;
|
||||
CPString _description;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_name = [aCoder decodeObjectForKey:@"BKThemeTemplateName"];
|
||||
_description = [aCoder decodeObjectForKey:@"BKThemeTemplateDescription"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_name forKey:@"BKThemeTemplateName"];
|
||||
[aCoder encodeObject:_description forKey:@"BKThemeTemplateDescription"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation BKThemeObjectTemplate : CPView
|
||||
{
|
||||
CPString _label;
|
||||
id _themedObject;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_label = [aCoder decodeObjectForKey:@"BKThemeObjectTemplateLabel"];
|
||||
_themedObject = [aCoder decodeObjectForKey:@"BKThemeObjectTemplateThemedObject"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_label forKey:@"BKThemeObjectTemplateLabel"];
|
||||
[aCoder encodeObject:_themedObject forKey:@"BKThemeObjectTemplateThemedObject"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,4 +1,26 @@
|
||||
/*
|
||||
* BlendKit.j
|
||||
* BlendKit
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 "BKShowcaseController.j"
|
||||
@import "BKThemeDescriptor.j"
|
||||
@import "BKUtilities.j"
|
||||
@import "BKThemeTemplate.j"
|
||||
@import "BKThemedObjectTemplate.j"
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
/*
|
||||
* main.j
|
||||
* blend
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* 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 <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
@import <AppKit/CPCib.j>
|
||||
@import <AppKit/CPTheme.j>
|
||||
@import <BlendKit/BlendKit.j>
|
||||
|
||||
var File = require("file");
|
||||
@@ -246,7 +266,7 @@ function exec(/*Array*/ command, /*Boolean*/ showOutput)
|
||||
{
|
||||
var theClass = [self class];
|
||||
|
||||
if ([theClass isKindOfClass:[BKThemeObjectTemplate class]])
|
||||
if ([theClass isKindOfClass:[BKThemedObjectTemplate class]])
|
||||
return [self];
|
||||
|
||||
if ([theClass isKindOfClass:[CPView class]])
|
||||
@@ -266,7 +286,7 @@ function exec(/*Array*/ command, /*Boolean*/ showOutput)
|
||||
|
||||
@end
|
||||
|
||||
@implementation BKThemeObjectTemplate (BlendAdditions)
|
||||
@implementation BKThemedObjectTemplate (BlendAdditions)
|
||||
|
||||
- (void)blendAddThemedObjectAttributesToTheme:(CPTheme)aTheme
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user