API 0.9.5
AppKit/CPShadow.j
Go to the documentation of this file.
00001 /*
00002  * CPShadow.j
00003  * AppKit
00004  *
00005  * Created by Francisco Tolmasky.
00006  * Copyright 2008, 280 North, Inc.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 
00024 
00031 @implementation CPShadow : CPObject
00032 {
00033     CPSize      _offset;
00034     float       _blurRadius;
00035     CPColor     _color;
00036 
00037     CPString    _cssString;
00038 }
00039 
00047 + (id)shadowWithOffset:(CGSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00048 {
00049     return [[CPShadow alloc] _initWithOffset:anOffset blurRadius:aBlurRadius color:aColor];
00050 }
00051 
00052 /* @ignore */
00053 - (id)_initWithOffset:(CPSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
00054 {
00055     self = [super init];
00056 
00057     if (self)
00058     {
00059         _offset = anOffset;
00060         _blurRadius = aBlurRadius;
00061         _color = aColor;
00062 
00063         _cssString = [_color cssString] + " " + Math.round(anOffset.width) + @"px " + Math.round(anOffset.height) + @"px " + Math.round(_blurRadius) + @"px";
00064     }
00065 
00066     return self;
00067 }
00068 
00072 - (CGSize)shadowOffset
00073 {
00074     return _offset;
00075 }
00076 
00080 - (float)shadowBlurRadius
00081 {
00082     return _blurRadius;
00083 }
00084 
00088 - (CPColor)shadowColor
00089 {
00090     return _color;
00091 }
00092 
00096 - (CPString)cssString
00097 {
00098     return _cssString;
00099 }
00100 
00101 @end
 All Classes Files Functions Variables Defines