mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Add dummy NSShadow implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29188 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dd19af06f4
commit
bf77df9e40
5 changed files with 208 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-12-31 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSShadow.m, Headers/AppKit/NSShadow.h:
|
||||
Added NSShadow implementation; doesn't actually draw anything yet.
|
||||
|
||||
2009-12-31 German Arias <german@xelalug.org>
|
||||
|
||||
* ColorPickers/Spanish.lproj/StandardPicker.strings,
|
||||
|
|
|
@ -157,6 +157,7 @@
|
|||
#include <AppKit/NSSecureTextField.h>
|
||||
#include <AppKit/NSSegmentedCell.h>
|
||||
#include <AppKit/NSSegmentedControl.h>
|
||||
#include <AppKit/NSShadow.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
#include <AppKit/NSSpeechSynthesizer.h>
|
||||
#include <AppKit/NSStepper.h>
|
||||
|
|
57
Headers/AppKit/NSShadow.h
Normal file
57
Headers/AppKit/NSShadow.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* -*-objc-*-
|
||||
NSShadow.h
|
||||
|
||||
GUI implementation of a shadow effect.
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||
Date: Dec 2009
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSShadow
|
||||
#define _GNUstep_H_NSShadow
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class NSColor;
|
||||
|
||||
@interface NSShadow : NSObject <NSCopying, NSCoding>
|
||||
{
|
||||
NSSize _offset;
|
||||
CGFloat _radius;
|
||||
NSColor *_color;
|
||||
}
|
||||
|
||||
- (NSSize) shadowOffset;
|
||||
- (void) setShadowOffset: (NSSize)offset;
|
||||
- (CGFloat) shadowBlurRadius;
|
||||
- (void) setShadowBlurRadius: (CGFloat)radius;
|
||||
- (NSColor *) shadowColor;
|
||||
- (void) setShadowColor: (NSColor *)color;
|
||||
- (void) set;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -150,6 +150,7 @@ NSScroller.m \
|
|||
NSScrollView.m \
|
||||
NSSecureTextField.m \
|
||||
NSSelection.m \
|
||||
NSShadow.m \
|
||||
NSSlider.m \
|
||||
NSSliderCell.m \
|
||||
NSSound.m \
|
||||
|
@ -349,6 +350,7 @@ NSSecureTextField.h \
|
|||
NSSegmentedCell.h \
|
||||
NSSegmentedControl.h \
|
||||
NSSelection.h \
|
||||
NSShadow.h \
|
||||
NSSlider.h \
|
||||
NSSliderCell.h \
|
||||
NSSound.h \
|
||||
|
|
143
Source/NSShadow.m
Normal file
143
Source/NSShadow.m
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
NSShadow.m
|
||||
|
||||
GUI implementation of a shadow effect.
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||
Date: Dec 2009
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#import "AppKit/NSShadow.h"
|
||||
#import "AppKit/NSColor.h"
|
||||
|
||||
@implementation NSShadow
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
_offset = NSMakeSize(0,0);
|
||||
_radius = 0;
|
||||
ASSIGN(_color, [[NSColor blackColor] colorWithAlphaComponent: 0.333]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSShadow *s = (NSShadow*)NSCopyObject(self, 0, zone);
|
||||
RETAIN(s->_color);
|
||||
return s;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
DESTROY(_color);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"NSShadow {%f, %f} blur = %f color = %@",
|
||||
(float)_offset.width, (float)_offset.height, (float)_radius,
|
||||
[_color description]];
|
||||
}
|
||||
|
||||
- (NSSize) shadowOffset
|
||||
{
|
||||
return _offset;
|
||||
}
|
||||
|
||||
- (void) setShadowOffset: (NSSize)offset
|
||||
{
|
||||
_offset = offset;
|
||||
}
|
||||
|
||||
- (CGFloat) shadowBlurRadius
|
||||
{
|
||||
return _radius;
|
||||
}
|
||||
|
||||
- (void) setShadowBlurRadius: (CGFloat)radius
|
||||
{
|
||||
_radius = radius;
|
||||
}
|
||||
|
||||
- (NSColor *) shadowColor
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
- (void) setShadowColor: (NSColor *)color
|
||||
{
|
||||
ASSIGN(_color, color);
|
||||
}
|
||||
|
||||
- (void) set
|
||||
{
|
||||
// FIXME: Implement
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeFloat: _radius forKey: @"NSShadowBlurRadius"];
|
||||
[aCoder encodeFloat: _offset.width forKey: @"NSShadowHoriz"];
|
||||
[aCoder encodeFloat: _offset.height forKey: @"NSShadowVert"];
|
||||
[aCoder encodeObject: _color forKey: @"NSShadowColor"];
|
||||
}
|
||||
else
|
||||
{
|
||||
float radius = _radius;
|
||||
[aCoder encodeValueOfObjCType: @encode(float) at: &radius];
|
||||
[aCoder encodeSize: _offset];
|
||||
[aCoder encodeObject: _color];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super init];
|
||||
if (self == nil)
|
||||
return nil;
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
_radius = [aDecoder decodeFloatForKey: @"NSShadowBlurRadius"];
|
||||
_offset = NSMakeSize([aDecoder decodeFloatForKey: @"NSShadowHoriz"],
|
||||
[aDecoder decodeFloatForKey: @"NSShadowVert"]);
|
||||
_color = [[aDecoder decodeObjectForKey: @"NSShadowColor"] retain];
|
||||
}
|
||||
else
|
||||
{
|
||||
float radius;
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &radius];
|
||||
_radius = radius;
|
||||
_offset = [aDecoder decodeSize];
|
||||
_color = [[aDecoder decodeObject] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in a new issue