mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:10:38 +00:00
New drawing function and small patches on button cell.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18593 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e447a55ea3
commit
38d9d84c34
4 changed files with 113 additions and 5 deletions
|
@ -26,8 +26,8 @@
|
|||
|
||||
#include "GNUstepGUI/GSDrawFunctions.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSView.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "AppKit/NSView.h"
|
||||
#include "AppKit/PSOperators.h"
|
||||
|
||||
|
||||
|
@ -237,4 +237,58 @@
|
|||
}
|
||||
}
|
||||
|
||||
/** Draw a gradient border. */
|
||||
+ (NSRect) drawGradientBorder: (NSGradientType)gradientType
|
||||
inRect: (NSRect)border
|
||||
withClip: (NSRect)clip
|
||||
{
|
||||
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
|
||||
NSMinXEdge, NSMaxYEdge};
|
||||
NSRectEdge dn_sides[] = {NSMaxXEdge, NSMaxYEdge,
|
||||
NSMinXEdge, NSMinYEdge};
|
||||
NSColor *black = [NSColor controlDarkShadowColor];
|
||||
NSColor *dark = [NSColor controlShadowColor];
|
||||
NSColor *light = [NSColor controlColor];
|
||||
NSColor **colors;
|
||||
NSColor *concaveWeak[] = {dark, dark,
|
||||
light, light};
|
||||
NSColor *concaveStrong[] = {black, black,
|
||||
light, light};
|
||||
NSColor *convexWeak[] = {light, light,
|
||||
dark, dark};
|
||||
NSColor *convexStrong[] = {light, light,
|
||||
black, black};
|
||||
NSRect rect;
|
||||
|
||||
switch (gradientType)
|
||||
{
|
||||
case NSGradientConcaveWeak:
|
||||
colors = concaveWeak;
|
||||
break;
|
||||
case NSGradientConcaveStrong:
|
||||
colors = concaveStrong;
|
||||
break;
|
||||
case NSGradientConvexWeak:
|
||||
colors = convexWeak;
|
||||
break;
|
||||
case NSGradientConvexStrong:
|
||||
colors = convexStrong;
|
||||
break;
|
||||
case NSGradientNone:
|
||||
default:
|
||||
return border;
|
||||
}
|
||||
|
||||
if ([[NSView focusView] isFlipped] == YES)
|
||||
{
|
||||
rect = NSDrawColorTiledRects(border, clip, dn_sides, colors, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect = NSDrawColorTiledRects(border, clip, up_sides, colors, 4);
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue