Implement NSColorPicker, add method defs to NSImage.h, add ivar init to

NSImage.m, fix bug in NSBundle [-pathForImageResource:]


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
jagapen 2000-03-25 11:54:29 +00:00
parent 53cc845d8f
commit 76a9c0ddc0
6 changed files with 40 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2000-03-25 Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
* Headers/gnustep/gui/NSColorPicker.h: Added ivar.
* Headers/gnustep/gui/NSImage.h: Added setFlipped/isFlipped methods.
* Source/NSBundleAdditions.m: Fixed bug in checking filename
extension. ([-pathForImageResource:])
* Source/NSColorPicker.m: Implement. ([-initWithPickerMask:colorPanel:]
[-colorPanel] [-insertNewButtonImage:in:] [-provideNewButtonImage:])
* Source/NSImage.m: Initialize _flags.flipDraw in [-initWithSize:]
2000-03-24 Jonathan Gapen <jagapen@whitewater.chem.wisc.edu> 2000-03-24 Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
* Source/NSFileWrapper.m: First implementation of NSFileWrapper * Source/NSFileWrapper.m: First implementation of NSFileWrapper
* Headers/gnustep/gui/NSFileWrapper.h: Added ivars and enum * Headers/gnustep/gui/NSFileWrapper.h: Added ivars and enum

View file

@ -40,6 +40,7 @@
@interface NSColorPicker : NSObject <NSColorPickingDefault> @interface NSColorPicker : NSObject <NSColorPickingDefault>
{ {
// Attributes // Attributes
id _colorPanel;
} }
// //

View file

@ -150,6 +150,8 @@
- (BOOL) drawRepresentation: (NSImageRep*)imageRep - (BOOL) drawRepresentation: (NSImageRep*)imageRep
inRect: (NSRect)aRect; inRect: (NSRect)aRect;
- (void) recache; - (void) recache;
- (void) setFlipped: (BOOL)flag;
- (BOOL) isFlipped;
// //
// Assigning a Delegate // Assigning a Delegate

View file

@ -177,12 +177,7 @@
NSString *ext = [name pathExtension]; NSString *ext = [name pathExtension];
NSString *path = nil; NSString *path = nil;
if (ext != nil) if ((ext == nil) || [ext isEqualToString:@""])
{
name = [name stringByDeletingPathExtension];
path = [self pathForResource: name ofType: ext];
}
else
{ {
NSArray *types = [NSImage imageUnfilteredFileTypes]; NSArray *types = [NSImage imageUnfilteredFileTypes];
unsigned c = [types count]; unsigned c = [types count];
@ -194,6 +189,11 @@
path = [self pathForResource: name ofType: ext]; path = [self pathForResource: name ofType: ext];
} }
} }
else
{
name = [name stringByDeletingPathExtension];
path = [self pathForResource: name ofType: ext];
}
return path; return path;
} }

View file

@ -1,12 +1,14 @@
/* /*
NSColorPicker.m NSColorPicker.m
Description... Abstract superclass for NSColorPanel color pickers
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996
Author: Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>
Date: March 2000
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -27,6 +29,7 @@
*/ */
#include <gnustep/gui/config.h> #include <gnustep/gui/config.h>
#include <AppKit/NSButtonCell.h>
#include <AppKit/NSColorPicker.h> #include <AppKit/NSColorPicker.h>
@implementation NSColorPicker @implementation NSColorPicker
@ -53,7 +56,8 @@
- (id)initWithPickerMask:(int)aMask - (id)initWithPickerMask:(int)aMask
colorPanel:(NSColorPanel *)colorPanel colorPanel:(NSColorPanel *)colorPanel
{ {
return nil; ASSIGN(_colorPanel, colorPanel);
return self;
} }
// //
@ -61,7 +65,7 @@
// //
- (NSColorPanel *)colorPanel - (NSColorPanel *)colorPanel
{ {
return nil; return _colorPanel;
} }
// //
@ -69,38 +73,45 @@
// //
- (void)insertNewButtonImage:(NSImage *)newImage - (void)insertNewButtonImage:(NSImage *)newImage
in:(NSButtonCell *)newButtonCell in:(NSButtonCell *)newButtonCell
{} {
[newButtonCell setImage: newImage];
}
- (NSImage *)provideNewButtonImage - (NSImage *)provideNewButtonImage
{ {
return nil; Class myClass = [self class];
NSBundle *bundle = [NSBundle bundleForClass: myClass];
NSString *file = [bundle pathForResource: NSStringFromClass(myClass)
ofType:@"tiff"];
return [[NSImage alloc] initWithContentsOfFile: file];
} }
// //
// Setting the Mode // Setting the Mode
// //
- (void)setMode:(int)mode - (void)setMode:(int)mode
{} {} // does nothing; override
// //
// Using Color Lists // Using Color Lists
// //
- (void)attachColorList:(NSColorList *)colorList - (void)attachColorList:(NSColorList *)colorList
{} {} // does nothing; override
- (void)detachColorList:(NSColorList *)colorList - (void)detachColorList:(NSColorList *)colorList
{} {} // does nothing; override
// //
// Showing Opacity Controls // Showing Opacity Controls
// //
- (void)alphaControlAddedOrRemoved:(id)sender - (void)alphaControlAddedOrRemoved:(id)sender
{} {} // does nothing; override
// //
// Responding to a Resized View // Responding to a Resized View
// //
- (void)viewSizeChanged:(id)sender - (void)viewSizeChanged:(id)sender
{} {} // does nothing; override
@end @end

View file

@ -288,6 +288,7 @@ static Class cacheClass = 0;
} }
_flags.colorMatchPreferred = YES; _flags.colorMatchPreferred = YES;
_flags.multipleResolutionMatching = YES; _flags.multipleResolutionMatching = YES;
_flags.flipDraw = NO;
_color = RETAIN(clearColor); _color = RETAIN(clearColor);
return self; return self;