mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
* Documentation/GuiUser/DefaultsSummary.gsdoc:
* Headers/Additions/GNUstepGUI/GSTheme.h: * Source/GSThemeDrawing.m: * Source/NSScroller.m: Add defaults GSScrollerScrollsByPage and GSScrollerArrowsSameEnd to allow customizing scroller behaviour beyond the combinations provided by NSInterfaceStyle. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37200 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
481d535880
commit
e72fe86870
5 changed files with 108 additions and 16 deletions
|
@ -1,3 +1,12 @@
|
|||
2013-10-06 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Documentation/GuiUser/DefaultsSummary.gsdoc:
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h:
|
||||
* Source/GSThemeDrawing.m:
|
||||
* Source/NSScroller.m: Add defaults GSScrollerScrollsByPage
|
||||
and GSScrollerArrowsSameEnd to allow customizing scroller
|
||||
behaviour beyond the combinations provided by NSInterfaceStyle.
|
||||
|
||||
2013-10-04 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSColor.m:
|
||||
|
|
|
@ -240,6 +240,28 @@
|
|||
Default "+".
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSScrollerArrowsSameEnd</term>
|
||||
<desc>
|
||||
<p>
|
||||
YES if the scroller arrows are at the same end.
|
||||
NO to get one scroller arrow at each end of the scroller.
|
||||
|
||||
If not set, the behaviour is delegated to NSScrollerInterfaceStyle.
|
||||
|
||||
Default YES.
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSScrollerScrollsByPage</term>
|
||||
<desc>
|
||||
<p>
|
||||
YES if clicking in the scroller slot should scroll by one page,
|
||||
NO if the scroller should jump to the location clicked.
|
||||
|
||||
If not set, the behaviour is delegated to NSScrollerInterfaceStyle.
|
||||
|
||||
Default NO.
|
||||
</p>
|
||||
</desc>
|
||||
<term>GSShiftKeyString</term>
|
||||
<desc>
|
||||
<p>
|
||||
|
|
|
@ -816,6 +816,23 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
|||
*/
|
||||
- (NSSize) sizeForImageFrameStyle: (NSImageFrameStyle)frameStyle;
|
||||
|
||||
/**
|
||||
* Return YES if the scroller arrows are at the same end.
|
||||
* Return NO to get one scroller arrow at each end of the scroller.
|
||||
*
|
||||
* The default implementation first checks the default GSScrollerArrowsSameEnd
|
||||
* and if that is not set, delegates to the NSInterfaceStyle.
|
||||
*/
|
||||
- (BOOL) scrollerArrowsSameEndForScroller: (NSScroller *)aScroller;
|
||||
|
||||
/**
|
||||
* Returns YES if clicking in the scroller slot should scroll by one page,
|
||||
* NO if the scroller should jump to the location clicked.
|
||||
*
|
||||
* The default implementation first checks the default GSScrollerScrollsByPage
|
||||
* and if that is not set, delegates to the NSInterfaceStyle.
|
||||
*/
|
||||
- (BOOL) scrollerScrollsByPageForScroller: (NSScroller *)aScroller;
|
||||
|
||||
/**
|
||||
* Creates and returns the cell to be used to draw a scroller arrow of the
|
||||
|
|
|
@ -416,6 +416,62 @@
|
|||
|
||||
/* NSScroller themeing.
|
||||
*/
|
||||
- (BOOL) scrollerArrowsSameEndForScroller: (NSScroller *)aScroller
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defs objectForKey: @"GSScrollerArrowsSameEnd"] != nil)
|
||||
{
|
||||
return [defs boolForKey: @"GSScrollerArrowsSameEnd"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSInterfaceStyle interfaceStyle =
|
||||
NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", aScroller);
|
||||
|
||||
if ((interfaceStyle == NSNextStepInterfaceStyle
|
||||
|| interfaceStyle == NSMacintoshInterfaceStyle
|
||||
|| interfaceStyle == GSWindowMakerInterfaceStyle))
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) scrollerScrollsByPageForScroller: (NSScroller *)aScroller
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defs objectForKey: @"GSScrollerScrollsByPage"] != nil)
|
||||
{
|
||||
return [defs boolForKey: @"GSScrollerScrollsByPage"];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSInterfaceStyle interfaceStyle =
|
||||
NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", aScroller);
|
||||
|
||||
if (interfaceStyle == NSNextStepInterfaceStyle
|
||||
|| interfaceStyle == NSMacintoshInterfaceStyle
|
||||
|| interfaceStyle == GSWindowMakerInterfaceStyle)
|
||||
{
|
||||
/* NeXTstep style is to scroll to point.
|
||||
*/
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Windows style is to scroll by a page.
|
||||
*/
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSButtonCell*) cellForScrollerArrow: (NSScrollerArrow)arrow
|
||||
horizontal: (BOOL)horizontal
|
||||
{
|
||||
|
|
|
@ -809,14 +809,10 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
fromView: nil]];
|
||||
if (doubleValue != _doubleValue)
|
||||
{
|
||||
NSInterfaceStyle interfaceStyle;
|
||||
const BOOL scrollsToPoint =
|
||||
![[GSTheme theme] scrollerScrollsByPageForScroller: self];
|
||||
|
||||
interfaceStyle
|
||||
= NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", self);
|
||||
|
||||
if (interfaceStyle == NSNextStepInterfaceStyle
|
||||
|| interfaceStyle == NSMacintoshInterfaceStyle
|
||||
|| interfaceStyle == GSWindowMakerInterfaceStyle)
|
||||
if (scrollsToPoint)
|
||||
{
|
||||
/* NeXTstep style is to scroll to point.
|
||||
*/
|
||||
|
@ -1166,15 +1162,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
CGFloat buttonsWidth;
|
||||
CGFloat buttonsSize;
|
||||
NSUsableScrollerParts usableParts;
|
||||
NSInterfaceStyle interfaceStyle;
|
||||
BOOL arrowsSameEnd = NO;
|
||||
|
||||
interfaceStyle = NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", self);
|
||||
|
||||
if ((interfaceStyle == NSNextStepInterfaceStyle
|
||||
|| interfaceStyle == NSMacintoshInterfaceStyle
|
||||
|| interfaceStyle == GSWindowMakerInterfaceStyle))
|
||||
arrowsSameEnd = YES;
|
||||
BOOL arrowsSameEnd = [[GSTheme theme] scrollerArrowsSameEndForScroller: self];
|
||||
|
||||
if (upCell == nil)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue