mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:50:48 +00:00
Corrected bezel drawing and keyed archiving of popup menu item cell.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18560 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bef0d1bcb2
commit
706213590f
4 changed files with 92 additions and 19 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-02-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/Function.m
|
||||||
|
Corrected NSDrawWhiteBezel(), NSDrawDarkBezel() and
|
||||||
|
NSDrawLightBezel() to be almost identical to their Cocoa counterparts.
|
||||||
|
* Source/NSMenuItemCell.m
|
||||||
|
* Source/NSPopUpButtonCell.m
|
||||||
|
Corrected keyed decoding.
|
||||||
|
|
||||||
2004-02-08 01:36 Gregory John Casamento <greg_casamento@yahoo.com>
|
2004-02-08 01:36 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSNib.m: Added implmentation for this class.
|
* Source/NSNib.m: Added implmentation for this class.
|
||||||
|
|
|
@ -645,12 +645,12 @@ NSDrawGroove(const NSRect aRect, const NSRect clipRect)
|
||||||
void
|
void
|
||||||
NSDrawWhiteBezel(const NSRect aRect, const NSRect clipRect)
|
NSDrawWhiteBezel(const NSRect aRect, const NSRect clipRect)
|
||||||
{
|
{
|
||||||
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
|
NSRectEdge up_sides[] = {NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge,
|
||||||
NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge};
|
NSMaxYEdge, NSMaxXEdge, NSMinYEdge, NSMinXEdge};
|
||||||
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
|
NSRectEdge down_sides[] = {NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge,
|
||||||
NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge};
|
NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge};
|
||||||
float grays[] = {NSWhite, NSWhite, NSDarkGray, NSDarkGray,
|
float grays[] = {NSDarkGray, NSWhite, NSWhite, NSDarkGray,
|
||||||
NSLightGray, NSLightGray, NSDarkGray, NSDarkGray};
|
NSDarkGray, NSLightGray, NSLightGray, NSDarkGray};
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
|
@ -673,15 +673,75 @@ NSDrawWhiteBezel(const NSRect aRect, const NSRect clipRect)
|
||||||
void
|
void
|
||||||
NSDrawDarkBezel(NSRect aRect, NSRect clipRect)
|
NSDrawDarkBezel(NSRect aRect, NSRect clipRect)
|
||||||
{
|
{
|
||||||
// FIXME
|
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
|
||||||
NSDrawGrayBezel(aRect, clipRect);
|
NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge};
|
||||||
|
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
|
||||||
|
NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge};
|
||||||
|
// FIXME: The actual colour used for the 3 + 4 line
|
||||||
|
// (and the two additional points) is a bit darker.
|
||||||
|
float grays[] = {NSWhite, NSWhite, NSLightGray, NSLightGray,
|
||||||
|
NSLightGray, NSLightGray, NSBlack, NSBlack};
|
||||||
|
NSRect rect;
|
||||||
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
|
if (GSWViewIsFlipped(ctxt) == YES)
|
||||||
|
{
|
||||||
|
rect = NSDrawTiledRects(aRect, clipRect,
|
||||||
|
down_sides, grays, 8);
|
||||||
|
// to give a really clean look we add 2 light gray points
|
||||||
|
DPSsetgray(ctxt, NSLightGray);
|
||||||
|
DPSrectfill(ctxt, NSMinX(aRect) + 1., NSMaxY(aRect) - 2., 1., 1.);
|
||||||
|
DPSrectfill(ctxt, NSMaxX(aRect) - 2., NSMinY(aRect) + 1., 1., 1.);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = NSDrawTiledRects(aRect, clipRect,
|
||||||
|
up_sides, grays, 8);
|
||||||
|
// to give a really clean look we add 2 light gray points
|
||||||
|
DPSsetgray(ctxt, NSLightGray);
|
||||||
|
DPSrectfill(ctxt, NSMinX(aRect) + 1., NSMinY(aRect) + 1., 1., 1.);
|
||||||
|
DPSrectfill(ctxt, NSMaxX(aRect) - 2., NSMaxY(aRect) - 2., 1., 1.);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPSsetgray(ctxt, NSLightGray);
|
||||||
|
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
|
||||||
|
NSWidth(rect), NSHeight(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NSDrawLightBezel(NSRect aRect, NSRect clipRect)
|
NSDrawLightBezel(NSRect aRect, NSRect clipRect)
|
||||||
{
|
{
|
||||||
// FIXME
|
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge,
|
||||||
NSDrawWhiteBezel(aRect, clipRect);
|
NSMaxXEdge, NSMinYEdge, NSMinXEdge, NSMaxYEdge};
|
||||||
|
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge,
|
||||||
|
NSMaxXEdge, NSMaxYEdge, NSMinXEdge, NSMinYEdge};
|
||||||
|
float grays[] = {NSWhite, NSWhite, NSGray, NSGray,
|
||||||
|
NSBlack, NSBlack, NSBlack, NSBlack};
|
||||||
|
NSRect rect;
|
||||||
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
|
if (GSWViewIsFlipped(ctxt) == YES)
|
||||||
|
{
|
||||||
|
rect = NSDrawTiledRects(aRect, clipRect,
|
||||||
|
down_sides, grays, 8);
|
||||||
|
// to give a really clean look we add 2 light gray points
|
||||||
|
DPSsetgray(ctxt, NSLightGray);
|
||||||
|
DPSrectfill(ctxt, NSMinX(aRect), NSMaxY(aRect) - 1., 1., 1.);
|
||||||
|
DPSrectfill(ctxt, NSMaxX(aRect) - 1., NSMinY(aRect), 1., 1.);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = NSDrawTiledRects(aRect, clipRect,
|
||||||
|
up_sides, grays, 8);
|
||||||
|
// to give a really clean look we add 2 light gray points
|
||||||
|
DPSsetgray(ctxt, NSLightGray);
|
||||||
|
DPSrectfill(ctxt, NSMinX(aRect), NSMinY(aRect), 1., 1.);
|
||||||
|
DPSrectfill(ctxt, NSMaxX(aRect) - 1., NSMaxY(aRect) - 1., 1., 1.);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPSsetgray(ctxt, NSWhite);
|
||||||
|
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
|
||||||
|
NSWidth(rect), NSHeight(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -642,16 +642,22 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
ASSIGN (_menuItem, [aDecoder decodeObject]);
|
if ([aDecoder allowsKeyedCoding])
|
||||||
|
|
||||||
if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
|
|
||||||
{
|
{
|
||||||
/* In version 1, we used to encode the _menuView here. */
|
[self setMenuItem: [aDecoder decodeObjectForKey: @"NSMenuItem"]];
|
||||||
[aDecoder decodeObject];
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSIGN (_menuItem, [aDecoder decodeObject]);
|
||||||
|
|
||||||
|
if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
|
||||||
|
{
|
||||||
|
/* In version 1, we used to encode the _menuView here. */
|
||||||
|
[aDecoder decodeObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
_needs_sizing = YES;
|
_needs_sizing = YES;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -812,7 +812,6 @@ static NSImage *_pbc_image[2];
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
id<NSMenuItem> selectedItem;
|
|
||||||
NSMenu *menu;
|
NSMenu *menu;
|
||||||
|
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
|
@ -847,11 +846,11 @@ static NSImage *_pbc_image[2];
|
||||||
|
|
||||||
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||||
[self setMenu: menu];
|
[self setMenu: menu];
|
||||||
selectedItem = [aDecoder decodeObjectForKey: @"NSMenuItem"];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
|
id<NSMenuItem> selectedItem;
|
||||||
int version = [aDecoder versionForClassName:
|
int version = [aDecoder versionForClassName:
|
||||||
@"NSPopUpButtonCell"];
|
@"NSPopUpButtonCell"];
|
||||||
|
|
||||||
|
@ -895,7 +894,6 @@ static NSImage *_pbc_image[2];
|
||||||
}
|
}
|
||||||
[self setEnabled: YES];
|
[self setEnabled: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self selectItem: selectedItem];
|
[self selectItem: selectedItem];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue