NSScroller: define scroller styles

As of macOS 10.7, scrollers gained two types: Legacy and Overlay. Here,
we define these styles as well as a method to determine which is the
"default" style to be used.
This commit is contained in:
Daniel Ferreira 2017-07-18 03:42:40 +10:00 committed by Ivan Vučica
parent e85a1a0664
commit fcb11edca8
2 changed files with 30 additions and 0 deletions

View file

@ -37,6 +37,21 @@
@class NSEvent;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
enum {
NSScrollerStyleLegacy = 0,
NSScrollerStyleOverlay = 1
};
typedef NSInteger NSScrollerStyle;
enum {
NSScrollerKnobStyleDefault = 0,
NSScrollerKnobStyleDark = 1,
NSScrollerKnobStyleLight = 2
};
typedef NSInteger NSScrollerKnobStyle;
#endif
enum _NSScrollArrowPosition {
#if OS_API_VERSION(MAC_OS_X_VERSION_10_1, GS_API_LATEST)
NSScrollerArrowsDefaultSetting = 0,
@ -90,6 +105,10 @@ typedef NSUInteger NSScrollerArrow;
} _scFlags;
}
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
+ (NSScrollerStyle)preferredScrollerStyle;
#endif
//
// Laying out the NSScroller
//
@ -144,4 +163,6 @@ typedef NSUInteger NSScrollerArrow;
@end
APPKIT_EXPORT NSString *NSPreferredScrollerStyleDidChangeNotification;
#endif // _GNUstep_H_NSScroller

View file

@ -49,6 +49,9 @@
#import "GNUstepGUI/GSTheme.h"
NSString *NSPreferredScrollerStyleDidChangeNotification =
@"NSPreferredScrollerStyleDidChangeNotification";
/**<p>TODO Description</p>
*/
@implementation NSScroller
@ -130,6 +133,12 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
return scrollerWidth;
}
+ (NSScrollerStyle)preferredScrollerStyle
{
// FIXME: a theme should define this?
return NSScrollerStyleLegacy;
}
- (BOOL) isFlipped
{
return YES;