* Headers/Additions/GNUstepGUI/GSTheme.h:

* Source/NSScrollView.m:
* Source/GSThemeDrawing.m:
* Source/GSTheme.m: Add GSScrollViewUseBottomCorner default,
which themes can set to NO to leave a square gap in the bottom-
left (or bottom-right) corner where the horizontal and vertical
scrollers meet.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37176 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-09-30 05:53:21 +00:00
parent 52f8843480
commit 3bbfcbaab2
5 changed files with 65 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2013-09-29 Eric Wasylishen <ewasylishen@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/NSScrollView.m:
* Source/GSThemeDrawing.m:
* Source/GSTheme.m: Add GSScrollViewUseBottomCorner default,
which themes can set to NO to leave a square gap in the bottom-
left (or bottom-right) corner where the horizontal and vertical
scrollers meet.
2013-09-29 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSBrowser.m: Fix some position calculations from the last

View file

@ -264,6 +264,9 @@ APPKIT_EXPORT NSString *GSScrollerUpArrow;
APPKIT_EXPORT NSString *GSScrollerVerticalKnob;
APPKIT_EXPORT NSString *GSScrollerVerticalSlot;
/* Scroll view parts */
APPKIT_EXPORT NSString *GSScrollViewBottomCorner;
/* Names for table view parts */
APPKIT_EXPORT NSString *GSTableHeader;
APPKIT_EXPORT NSString *GSTableCorner;
@ -838,6 +841,8 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*/
- (float) defaultScrollerWidth;
- (BOOL) scrolViewUseBottomCorner;
/**
* Method for toolbar theming.
*/

View file

@ -77,6 +77,9 @@ NSString *GSScrollerUpArrow = @"GSScrollerUpArrow";
NSString *GSScrollerVerticalKnob = @"GSScrollerVerticalKnob";
NSString *GSScrollerVerticalSlot = @"GSScrollerVerticalSlot";
// Scroll view parts
NSString *GSScrollViewBottomCorner = @"GSScrollViewBottomCorner";
// Table view part names
NSString *GSTableHeader = @"GSTableHeader";
NSString *GSTableCorner = @"GSTableCorner";

View file

@ -545,6 +545,16 @@
return defaultScrollerWidth;
}
- (BOOL) scrolViewUseBottomCorner
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
if ([defs objectForKey: @"GSScrollViewUseBottomCorner"] != nil)
{
return [defs boolForKey: @"GSScrollViewUseBottomCorner"];
}
return YES;
}
- (NSColor *) toolbarBackgroundColor
{
NSColor *color;
@ -2311,6 +2321,26 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
DPSstroke(ctxt);
}
}
if (![self scrolViewUseBottomCorner]
&& [scrollView hasHorizontalScroller]
&& [scrollView hasVerticalScroller])
{
NSScroller *vertScroller = [scrollView verticalScroller];
NSScroller *horizScroller = [scrollView horizontalScroller];
NSRect bottomCornerRect = NSMakeRect([vertScroller frame].origin.x,
[horizScroller frame].origin.y,
NSWidth([vertScroller frame]),
NSHeight([horizScroller frame]));
GSDrawTiles *tiles = [self tilesNamed: GSScrollViewBottomCorner
state: GSThemeNormalState];
[self fillRect: bottomCornerRect
withTiles: tiles
background: [NSColor clearColor]];
}
}
- (void) drawBarInside: (NSRect)rect

View file

@ -1075,6 +1075,8 @@ static CGFloat scrollerWidth;
CGFloat innerBorderWidth = [[NSUserDefaults standardUserDefaults]
boolForKey: @"GSScrollViewNoInnerBorder"] ? 0.0 : 1.0;
BOOL useBottomCorner = [[GSTheme theme] scrolViewUseBottomCorner];
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
if (style == NSMacintoshInterfaceStyle
@ -1140,6 +1142,15 @@ static CGFloat scrollerWidth;
NSDivideRect (contentRect, &vertScrollerRect, &contentRect,
scrollerWidth, verticalScrollerEdge);
/* If the theme requests it, leave a square gap in the bottom-
* left (or bottom-right) corner where the horizontal and vertical
* scrollers meet. */
if (_hasHorizScroller && !useBottomCorner)
{
NSDivideRect (vertScrollerRect, NULL, &vertScrollerRect,
scrollerWidth, bottomEdge);
}
[_vertScroller setFrame: vertScrollerRect];
/* Substract 1 for the line that separates the vertical scroller
@ -1288,7 +1299,12 @@ static CGFloat scrollerWidth;
- (BOOL) isOpaque
{
return [_contentView isOpaque];
// FIXME: Only needs to be NO in a corner case,
// when [[GSTheme theme] scrolViewUseBottomCorner] is NO
// and the theme tile for the bottom corner is transparent.
// So maybe cache the value of
// [[GSTheme theme] scrolViewUseBottomCorner] and check it here.
return NO;
}
- (NSBorderType) borderType