From eedfcb0e8ea72e3760cb26c14f59d69ebc4b07dd Mon Sep 17 00:00:00 2001 From: rfm Date: Thu, 8 Jan 2009 16:13:23 +0000 Subject: [PATCH] Minor theme fixups git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27560 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/NSScrollView.m | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf71e7b47..39b758396 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2009-01-08 Richard Frith-Macdonald * 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 diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m index 450447541..77fc43181 100644 --- a/Source/NSScrollView.m +++ b/Source/NSScrollView.m @@ -35,6 +35,7 @@ #include #include "AppKit/NSColor.h" +#include "AppKit/NSColorList.h" #include "AppKit/NSCell.h" #include "AppKit/NSClipView.h" #include "AppKit/NSEvent.h" @@ -737,7 +738,8 @@ static float scrollerWidth; } // 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]; } @@ -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]; } @@ -981,6 +984,7 @@ static float scrollerWidth; NSInterfaceStyle style; style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil); + if (style == NSMacintoshInterfaceStyle || style == NSWindows95InterfaceStyle) { @@ -1113,6 +1117,20 @@ static float scrollerWidth; - (void) drawRect: (NSRect)rect { 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) { @@ -1120,20 +1138,20 @@ static float scrollerWidth; break; case NSLineBorder: - [[NSColor controlDarkShadowColor] set]; + [color set]; NSFrameRect(_bounds); break; case NSBezelBorder: - [[GSTheme theme] drawGrayBezel: _bounds withClip: rect]; + [theme drawGrayBezel: _bounds withClip: rect]; break; case NSGrooveBorder: - [[GSTheme theme] drawGroove: _bounds withClip: rect]; + [theme drawGroove: _bounds withClip: rect]; break; } - [[NSColor controlDarkShadowColor] set]; + [color set]; DPSsetlinewidth(ctxt, 1); if (_hasVertScroller) @@ -1595,6 +1613,12 @@ static float scrollerWidth; NSDebugLLog(@"NSScrollView", @"NSScrollView: finish decoding\n"); } + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(_themeDidActivate:) + name: GSThemeDidActivateNotification + object: nil]; + return self; }