mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:10:38 +00:00
Color patches.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5403 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
648fecba71
commit
b659311a03
3 changed files with 35 additions and 6 deletions
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <AppKit/NSActionCell.h>
|
||||
#include <AppKit/NSColorWell.h>
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
|
@ -45,6 +46,15 @@
|
|||
[self setVersion: 1];
|
||||
}
|
||||
|
||||
// FIXME: This is a hack. An NSColorWell shouldn't need an associated
|
||||
// cell, but without one the setTarget: and setAction: methods get passed
|
||||
// to an NSCell object by the superclass (NSControl). NSCell raises an
|
||||
// exception on these methods, but NSActionCell actually implements them.
|
||||
+ (Class)cellClass
|
||||
{
|
||||
return [NSActionCell class];
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
|
@ -89,13 +99,20 @@
|
|||
[[NSColor controlColor] set];
|
||||
NSRectFill(NSIntersectionRect(aRect, rect));
|
||||
|
||||
/*
|
||||
* Draw inner frame.
|
||||
*/
|
||||
aRect = NSInsetRect(aRect, 5.0, 5.0);
|
||||
NSDrawGrayBezel(aRect, rect);
|
||||
|
||||
aRect = NSInsetRect(aRect, 2.0, 2.0);
|
||||
|
||||
/*
|
||||
* OpenStep 4.2 behavior is to omit the inner border for
|
||||
* non-enabled NSColorWell objects.
|
||||
*/
|
||||
if ([self isEnabled])
|
||||
{
|
||||
/*
|
||||
* Draw inner frame.
|
||||
*/
|
||||
NSDrawGrayBezel(aRect, rect);
|
||||
aRect = NSInsetRect(aRect, 2.0, 2.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
aRect = NSInsetRect(aRect, 9.0, 9.0);
|
||||
|
@ -145,6 +162,7 @@
|
|||
- (void)setColor: (NSColor *)color
|
||||
{
|
||||
ASSIGN(the_color, color);
|
||||
[self display];
|
||||
}
|
||||
|
||||
- (void)takeColorFrom: (id)sender
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue