Skip to content

Commit

Permalink
Organized BlendKit classes into their own files and added licensing i…
Browse files Browse the repository at this point in the history
…nfo.

Reviewed by me.
  • Loading branch information
Francisco Ryan Tolmasky I committed May 24, 2009
1 parent 1f64cb6 commit 3523a9f
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 66 deletions.
46 changes: 40 additions & 6 deletions AppKit/Tools/BlendKit/BKShowcaseController.j
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"];

Expand Down Expand Up @@ -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;
}
Expand Down
23 changes: 22 additions & 1 deletion AppKit/Tools/BlendKit/BKThemeDescriptor.j
Original file line number Diff line number Diff line change
@@ -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>

Expand Down Expand Up @@ -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"];
Expand Down
51 changes: 51 additions & 0 deletions AppKit/Tools/BlendKit/BKThemeTemplate.j
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions AppKit/Tools/BlendKit/BKThemedObjectTemplate.j
Original file line number Diff line number Diff line change
@@ -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
54 changes: 0 additions & 54 deletions AppKit/Tools/BlendKit/BKUtilities.j

This file was deleted.

24 changes: 23 additions & 1 deletion AppKit/Tools/BlendKit/BlendKit.j
Original file line number Diff line number Diff line change
@@ -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"
28 changes: 24 additions & 4 deletions AppKit/Tools/blend/main.j
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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]])
Expand All @@ -266,7 +286,7 @@ function exec(/*Array*/ command, /*Boolean*/ showOutput)

@end

@implementation BKThemeObjectTemplate (BlendAdditions)
@implementation BKThemedObjectTemplate (BlendAdditions)

- (void)blendAddThemedObjectAttributesToTheme:(CPTheme)aTheme
{
Expand Down

0 comments on commit 3523a9f

Please sign in to comment.