mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Add scroller styling options.
This commit is contained in:
parent
2303052e50
commit
a91815f70a
4 changed files with 79 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
|||
#import <AppKit/AppKitDefines.h>
|
||||
|
||||
#import <AppKit/NSView.h>
|
||||
#import <AppKit/NSScroller.h>
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -76,6 +77,8 @@ APPKIT_EXPORT_CLASS
|
|||
BOOL _autohidesScrollers;
|
||||
NSScrollElasticity _horizScrollElasticity;
|
||||
NSScrollElasticity _vertScrollElasticity;
|
||||
NSScrollerStyle _scrollerStyle;
|
||||
NSScrollerKnobStyle _scrollerKnobStyle;
|
||||
}
|
||||
|
||||
/* Calculating layout */
|
||||
|
@ -188,6 +191,19 @@ APPKIT_EXPORT_CLASS
|
|||
/* Arranging components */
|
||||
- (void)tile;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
||||
/** The scroller style. By default, NSScrollerStyleDefault. */
|
||||
- (NSScrollerStyle)scrollerStyle;
|
||||
/** Sets the scroller style. In the default theme, this must be NSScrollerStyleDefault. */
|
||||
- (void)setScrollerStyle:(NSScrollerStyle)style;
|
||||
/** The scroller knob style. By default, NSScrollerStyleDefault. */
|
||||
- (NSScrollerKnobStyle)scrollerKnobStyle;
|
||||
/** Sets the scroller knob style. In the default theme, this must be NSScrollerKnobStyleDefault. */
|
||||
- (void)setScrollerKnobStyle:(NSScrollerKnobStyle)style;
|
||||
/** Shows the scrollers if they're overlay scrollers. */
|
||||
- (void)flashScrollers;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_NSScrollView */
|
||||
|
|
|
@ -104,10 +104,33 @@ APPKIT_EXPORT_CLASS
|
|||
unsigned control_tint: 3;
|
||||
unsigned control_size: 2;
|
||||
} _scFlags;
|
||||
NSScrollerStyle _scrollerStyle;
|
||||
NSScrollerKnobStyle _knobStyle;
|
||||
}
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
|
||||
+ (NSScrollerStyle)preferredScrollerStyle;
|
||||
/** The scroller style. By default, NSScrollerStyleDefault.
|
||||
If your theme implements other scroller styles, you must override this method.
|
||||
You may use the ivar _scrollerStyle for this. */
|
||||
- (NSScrollerStyle)scrollerStyle;
|
||||
/** Sets the scroller style. In the default theme, this must be NSScrollerStyleDefault.
|
||||
If your theme implements other scroller styles, you must override this method.
|
||||
You may use the ivar _scrollerStyle for this. */
|
||||
- (void)setScrollerStyle:(NSScrollerStyle)style;
|
||||
/** The scroller knob style. By default, NSScrollerStyleDefault.
|
||||
If your theme implements other scroller styles, you must override this method.
|
||||
You may use the ivar _knobStyle for this. */
|
||||
- (NSScrollerKnobStyle)knobStyle;
|
||||
/** Sets the scroller knob style. In the default theme, this must be NSScrollerKnobStyleDefault.
|
||||
If your theme implements other scroller knob styles, you must override this method.
|
||||
You may use the ivar _scrollerKnobStyle for this. */
|
||||
- (void)setKnobStyle:(NSScrollerKnobStyle)style;
|
||||
#endif
|
||||
#if GS_API_VERSION(013000,GS_API_LATEST)
|
||||
/** Shows the scroller if it's an overlay scroller.
|
||||
If your theme supports overlay scrollers, you must override this method. */
|
||||
- (void)flashScroller;
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -1831,6 +1831,28 @@ GSOppositeEdge(NSRectEdge edge)
|
|||
}
|
||||
}
|
||||
|
||||
- (NSScrollerStyle)scrollerStyle {
|
||||
return _scrollerStyle;
|
||||
}
|
||||
|
||||
- (void)setScrollerStyle:(NSScrollerStyle)style {
|
||||
[[self horizontalScroller] setScrollerStyle:style];
|
||||
[[self verticalScroller] setScrollerStyle:style];
|
||||
_scrollerStyle = style;
|
||||
}
|
||||
- (NSScrollerKnobStyle)scrollerKnobStyle {
|
||||
return _scrollerKnobStyle;
|
||||
}
|
||||
- (void)setScrollerKnobStyle:(NSScrollerKnobStyle)style {
|
||||
[[self horizontalScroller] setKnobStyle:style];
|
||||
[[self verticalScroller] setKnobStyle:style];
|
||||
_scrollerKnobStyle = style;
|
||||
}
|
||||
- (void)flashScrollers {
|
||||
[[self horizontalScroller] flashScroller];
|
||||
[[self verticalScroller] flashScroller];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSScrollView (GSPrivate)
|
||||
|
|
|
@ -139,6 +139,24 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
return NSScrollerStyleLegacy;
|
||||
}
|
||||
|
||||
- (NSScrollerStyle)scrollerStyle {
|
||||
// FIXME: we should support other scroller styles.
|
||||
return NSScrollerStyleLegacy;
|
||||
}
|
||||
|
||||
- (void)setScrollerStyle:(NSScrollerStyle)style {
|
||||
if(style == NSScrollerStyleOverlay) NSWarnLog(@"GNUstep does not support overlay scrollbars.");
|
||||
}
|
||||
- (NSScrollerKnobStyle)scrollerKnobStyle {
|
||||
// FIXME: We should set this as an ivar so themes can use this.
|
||||
return NSScrollerKnobStyleDefault;
|
||||
}
|
||||
- (void)setScrollerKnobStyle:(NSScrollerKnobStyle)style {
|
||||
NSWarnLog(@"GNUstep does not support custom scroller knob styles.");
|
||||
}
|
||||
- (void)flashScroller {
|
||||
}
|
||||
|
||||
- (BOOL) isFlipped
|
||||
{
|
||||
return YES;
|
||||
|
|
Loading…
Reference in a new issue