mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:20:47 +00:00
NSBrowser header themeing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30189 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5767b71934
commit
dcebe1ef37
5 changed files with 73 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2010-04-18 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSBrowser.m:
|
||||||
|
* Source/GSTheme.m:
|
||||||
|
* Source/GSThemeDrawing.m:
|
||||||
|
* Headers/Additions/GNUstepGUI/GSTheme.h: Factor out browser
|
||||||
|
header drawing to GSTheme.
|
||||||
|
|
||||||
2010-04-18 Eric Wasylishen <ewasylishen@gmail.com>
|
2010-04-18 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/NSScrollView.m:
|
* Source/NSScrollView.m:
|
||||||
|
|
|
@ -263,6 +263,11 @@ APPKIT_EXPORT NSString *GSScrollerVerticalSlot;
|
||||||
APPKIT_EXPORT NSString *GSTableHeader;
|
APPKIT_EXPORT NSString *GSTableHeader;
|
||||||
APPKIT_EXPORT NSString *GSTableCorner;
|
APPKIT_EXPORT NSString *GSTableCorner;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Browser part names.
|
||||||
|
*/
|
||||||
|
APPKIT_EXPORT NSString *GSBrowserHeader;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menu part names.
|
* Menu part names.
|
||||||
*/
|
*/
|
||||||
|
@ -921,6 +926,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
||||||
forStyleMask: (unsigned int)styleMask
|
forStyleMask: (unsigned int)styleMask
|
||||||
state: (int)inputState
|
state: (int)inputState
|
||||||
andTitle: (NSString*)title;
|
andTitle: (NSString*)title;
|
||||||
|
|
||||||
|
- (void) drawBrowserHeaderCell: (NSCell*)cell
|
||||||
|
withFrame: (NSRect)rect
|
||||||
|
inView: (NSView*)view;
|
||||||
|
|
||||||
|
- (NSRect) browserHeaderDrawingRectForCell: (NSCell*)cell
|
||||||
|
withFrame: (NSRect)rect;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,6 +78,9 @@ NSString *GSScrollerVerticalSlot = @"GSScrollerVerticalSlot";
|
||||||
NSString *GSTableHeader = @"GSTableHeader";
|
NSString *GSTableHeader = @"GSTableHeader";
|
||||||
NSString *GSTableCorner = @"GSTableCorner";
|
NSString *GSTableCorner = @"GSTableCorner";
|
||||||
|
|
||||||
|
// Browser part names
|
||||||
|
NSString *GSBrowserHeader = @"GSBrowserHeader";
|
||||||
|
|
||||||
// Menu part names
|
// Menu part names
|
||||||
NSString *GSMenuHorizontalBackground = @"GSMenuHorizontalBackground";
|
NSString *GSMenuHorizontalBackground = @"GSMenuHorizontalBackground";
|
||||||
NSString *GSMenuVerticalBackground = @"GSMenuVerticalBackground";
|
NSString *GSMenuVerticalBackground = @"GSMenuVerticalBackground";
|
||||||
|
|
|
@ -1435,4 +1435,43 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) drawBrowserHeaderCell: (NSCell*)cell
|
||||||
|
withFrame: (NSRect)rect
|
||||||
|
inView: (NSView*)view;
|
||||||
|
{
|
||||||
|
GSDrawTiles *tiles;
|
||||||
|
tiles = [self tilesNamed: GSBrowserHeader state: GSThemeNormalState];
|
||||||
|
if (tiles == nil)
|
||||||
|
{
|
||||||
|
[self drawGrayBezel: rect withClip: NSZeroRect];
|
||||||
|
[cell _drawBackgroundWithFrame: rect inView: view];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self fillRect: rect
|
||||||
|
withTiles: tiles
|
||||||
|
background: [NSColor clearColor]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect) browserHeaderDrawingRectForCell: (NSCell*)cell
|
||||||
|
withFrame: (NSRect)rect
|
||||||
|
{
|
||||||
|
GSDrawTiles *tiles;
|
||||||
|
tiles = [self tilesNamed: GSBrowserHeader state: GSThemeNormalState];
|
||||||
|
if (tiles == nil)
|
||||||
|
{
|
||||||
|
return NSInsetRect(rect, 2, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: We assume the button's top and right padding are the same as
|
||||||
|
// its bottom and left.
|
||||||
|
return NSInsetRect(rect,
|
||||||
|
tiles->contentRect.origin.x,
|
||||||
|
tiles->contentRect.origin.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -206,14 +206,21 @@ static NSTextFieldCell *titleCell;
|
||||||
- (NSRect) drawingRectForBounds: (NSRect)theRect
|
- (NSRect) drawingRectForBounds: (NSRect)theRect
|
||||||
{
|
{
|
||||||
// This adjustment must match the drawn border
|
// This adjustment must match the drawn border
|
||||||
return NSInsetRect(theRect, 2, 2);
|
return [[GSTheme theme] browserHeaderDrawingRectForCell: self
|
||||||
|
withFrame: theRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
- (void) _drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
||||||
inView: (NSView*)controlView
|
inView: (NSView*)controlView
|
||||||
{
|
{
|
||||||
[[GSTheme theme] drawGrayBezel: cellFrame withClip: NSZeroRect];
|
[[GSTheme theme] drawBrowserHeaderCell: self
|
||||||
[self _drawBackgroundWithFrame: cellFrame inView: controlView];
|
withFrame: cellFrame
|
||||||
|
inView: controlView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) isOpaque
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue