2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSColorPicker</title>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
<abstract>Abstract superclass for NSColorPanel color pickers</abstract>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
1996-05-30 20:03:15 +00:00
|
|
|
Date: 1996
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
|
2000-03-25 11:54:29 +00:00
|
|
|
Date: March 2000
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1996-05-30 20:03:15 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1996-10-18 17:14:13 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
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.
|
1996-05-30 20:03:15 +00:00
|
|
|
*/
|
|
|
|
|
2010-05-24 10:48:14 +00:00
|
|
|
#import "config.h"
|
|
|
|
#import <Foundation/NSBundle.h>
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
#import "AppKit/NSButtonCell.h"
|
|
|
|
#import "AppKit/NSColorList.h"
|
|
|
|
#import "AppKit/NSColorPanel.h"
|
|
|
|
#import "AppKit/NSColorPicker.h"
|
|
|
|
#import "AppKit/NSImage.h"
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
@implementation NSColorPicker
|
|
|
|
|
|
|
|
//
|
|
|
|
// Class methods
|
|
|
|
//
|
|
|
|
+ (void)initialize
|
|
|
|
{
|
|
|
|
if (self == [NSColorPicker class])
|
|
|
|
{
|
|
|
|
// Initial version
|
|
|
|
[self setVersion:1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Instance methods
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Initializing an NSColorPicker
|
|
|
|
//
|
|
|
|
- (id)initWithPickerMask:(int)aMask
|
|
|
|
colorPanel:(NSColorPanel *)colorPanel
|
|
|
|
{
|
2000-03-25 11:54:29 +00:00
|
|
|
ASSIGN(_colorPanel, colorPanel);
|
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Getting the Color Panel
|
|
|
|
//
|
|
|
|
- (NSColorPanel *)colorPanel
|
|
|
|
{
|
2000-03-25 11:54:29 +00:00
|
|
|
return _colorPanel;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Adding Button Images
|
|
|
|
//
|
|
|
|
- (void)insertNewButtonImage:(NSImage *)newImage
|
|
|
|
in:(NSButtonCell *)newButtonCell
|
2000-03-25 11:54:29 +00:00
|
|
|
{
|
|
|
|
[newButtonCell setImage: newImage];
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
- (NSImage *)provideNewButtonImage
|
|
|
|
{
|
2000-03-25 11:54:29 +00:00
|
|
|
Class myClass = [self class];
|
|
|
|
NSBundle *bundle = [NSBundle bundleForClass: myClass];
|
|
|
|
NSString *file = [bundle pathForResource: NSStringFromClass(myClass)
|
|
|
|
ofType:@"tiff"];
|
|
|
|
|
2003-07-26 13:26:35 +00:00
|
|
|
return AUTORELEASE([[NSImage alloc] initWithContentsOfFile: file]);
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Mode
|
|
|
|
//
|
|
|
|
- (void)setMode:(int)mode
|
2000-03-25 11:54:29 +00:00
|
|
|
{} // does nothing; override
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Using Color Lists
|
|
|
|
//
|
|
|
|
- (void)attachColorList:(NSColorList *)colorList
|
2000-03-25 11:54:29 +00:00
|
|
|
{} // does nothing; override
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
- (void)detachColorList:(NSColorList *)colorList
|
2000-03-25 11:54:29 +00:00
|
|
|
{} // does nothing; override
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-01-29 16:07:56 +00:00
|
|
|
//
|
|
|
|
// Showing Opacity Controls
|
|
|
|
//
|
|
|
|
- (void)alphaControlAddedOrRemoved:(id)sender
|
2000-03-25 11:54:29 +00:00
|
|
|
{} // does nothing; override
|
1997-01-29 16:07:56 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
//
|
|
|
|
// Responding to a Resized View
|
|
|
|
//
|
|
|
|
- (void)viewSizeChanged:(id)sender
|
2000-03-25 11:54:29 +00:00
|
|
|
{} // does nothing; override
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
@end
|