Minor theme fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27560 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-01-08 16:13:23 +00:00
parent a3b990072b
commit eedfcb0e8e
2 changed files with 32 additions and 6 deletions

View file

@ -1,6 +1,8 @@
2009-01-08 Richard Frith-Macdonald <rfm@gnu.org> 2009-01-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTheme.m: Fix nil pointer exception. * Source/GSTheme.m: Fix nil pointer exception.
* Source/NSScrollView.m: Fix to notice theme activation and support
themed color for separators.
2009-01-07 Fred Kiefer <FredKiefer@gmx.de> 2009-01-07 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -35,6 +35,7 @@
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include "AppKit/NSColor.h" #include "AppKit/NSColor.h"
#include "AppKit/NSColorList.h"
#include "AppKit/NSCell.h" #include "AppKit/NSCell.h"
#include "AppKit/NSClipView.h" #include "AppKit/NSClipView.h"
#include "AppKit/NSEvent.h" #include "AppKit/NSEvent.h"
@ -737,7 +738,8 @@ static float scrollerWidth;
} }
// FIXME: Should we just hide the scroll bar or remove it? // FIXME: Should we just hide the scroll bar or remove it?
if ((_autohidesScrollers) && (documentFrame.size.height > clipViewBounds.size.height)) if ((_autohidesScrollers)
&& (documentFrame.size.height > clipViewBounds.size.height))
{ {
[self setHasVerticalScroller: YES]; [self setHasVerticalScroller: YES];
} }
@ -774,7 +776,8 @@ static float scrollerWidth;
} }
} }
if ((_autohidesScrollers) && (documentFrame.size.width > clipViewBounds.size.width)) if ((_autohidesScrollers)
&& (documentFrame.size.width > clipViewBounds.size.width))
{ {
[self setHasHorizontalScroller: YES]; [self setHasHorizontalScroller: YES];
} }
@ -981,6 +984,7 @@ static float scrollerWidth;
NSInterfaceStyle style; NSInterfaceStyle style;
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil); style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
if (style == NSMacintoshInterfaceStyle if (style == NSMacintoshInterfaceStyle
|| style == NSWindows95InterfaceStyle) || style == NSWindows95InterfaceStyle)
{ {
@ -1113,6 +1117,20 @@ static float scrollerWidth;
- (void) drawRect: (NSRect)rect - (void) drawRect: (NSRect)rect
{ {
NSGraphicsContext *ctxt = GSCurrentContext(); NSGraphicsContext *ctxt = GSCurrentContext();
GSTheme *theme = [GSTheme theme];
NSColor *color;
NSString *name;
name = [theme nameForElement: self];
if (name == nil)
{
name = @"NSScrollView";
}
color = [[theme extraColors] colorWithKey: name];
if (color == nil)
{
color = [NSColor controlDarkShadowColor];
}
switch (_borderType) switch (_borderType)
{ {
@ -1120,20 +1138,20 @@ static float scrollerWidth;
break; break;
case NSLineBorder: case NSLineBorder:
[[NSColor controlDarkShadowColor] set]; [color set];
NSFrameRect(_bounds); NSFrameRect(_bounds);
break; break;
case NSBezelBorder: case NSBezelBorder:
[[GSTheme theme] drawGrayBezel: _bounds withClip: rect]; [theme drawGrayBezel: _bounds withClip: rect];
break; break;
case NSGrooveBorder: case NSGrooveBorder:
[[GSTheme theme] drawGroove: _bounds withClip: rect]; [theme drawGroove: _bounds withClip: rect];
break; break;
} }
[[NSColor controlDarkShadowColor] set]; [color set];
DPSsetlinewidth(ctxt, 1); DPSsetlinewidth(ctxt, 1);
if (_hasVertScroller) if (_hasVertScroller)
@ -1595,6 +1613,12 @@ static float scrollerWidth;
NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n"); NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n");
} }
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_themeDidActivate:)
name: GSThemeDidActivateNotification
object: nil];
return self; return self;
} }