1 /* 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef WebCore_NSScrollerImpDetails_h 27 #define WebCore_NSScrollerImpDetails_h 28 29 #import <AvailabilityMacros.h> 30 31 // Public APIs not available on versions of Mac on which we build 32 #if __MAC_OS_X_VERSION_MAX_ALLOWED == 1060 33 enum { 34 NSScrollerStyleLegacy = 0, 35 NSScrollerStyleOverlay = 1 36 }; 37 typedef NSInteger NSScrollerStyle; 38 39 enum { 40 NSScrollerKnobStyleDefault = 0, 41 NSScrollerKnobStyleDark = 1, 42 NSScrollerKnobStyleLight = 2 43 }; 44 typedef NSInteger NSScrollerKnobStyle; 45 #endif 46 47 #if __MAC_OS_X_VERSION_MAX_ALLOWED == 1060 48 @interface NSScroller(NSObject) 49 + (NSScrollerStyle)preferredScrollerStyle; 50 @end 51 #endif 52 53 @interface NSObject (ScrollbarPainter) 54 + (id)scrollerImpWithStyle:(NSScrollerStyle)newScrollerStyle controlSize:(NSControlSize)newControlSize horizontal:(BOOL)horizontal replacingScrollerImp:(id)previous; 55 - (CGFloat)knobAlpha; 56 - (void)setKnobAlpha:(CGFloat)knobAlpha; 57 - (CGFloat)trackAlpha; 58 - (void)setTrackAlpha:(CGFloat)trackAlpha; 59 - (void)setEnabled:(BOOL)enabled; 60 - (void)setBoundsSize:(NSSize)boundsSize; 61 - (void)setDoubleValue:(double)doubleValue; 62 - (void)setKnobProportion:(CGFloat)proportion; 63 - (void)setKnobStyle:(NSScrollerKnobStyle)knobStyle; 64 - (void)setExpanded:(BOOL)expanded; 65 - (BOOL)isExpanded; 66 - (void)setDelegate:(id)delegate; 67 - (void)setUiStateTransitionProgress:(CGFloat)uiStateTransitionProgress; 68 - (void)setExpansionTransitionProgress:(CGFloat)expansionTransitionProgress; 69 - (BOOL)isHorizontal; 70 - (CGFloat)trackWidth; 71 - (CGFloat)trackBoxWidth; 72 - (CGFloat)knobMinLength; 73 - (CGFloat)trackOverlapEndInset; 74 - (CGFloat)knobOverlapEndInset; 75 - (CGFloat)trackEndInset; 76 - (CGFloat)knobEndInset; 77 - (CGFloat)uiStateTransitionProgress; 78 - (CGFloat)expansionTransitionProgress; 79 - (NSRect)rectForPart:(NSScrollerPart)partCode; 80 - (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag alpha:(CGFloat)alpha; 81 - (void)drawKnob; 82 - (void)mouseEnteredScroller; 83 - (void)mouseExitedScroller; 84 @end 85 86 @interface NSObject (ScrollbarPainterController) 87 - (void)setDelegate:(id)delegate; 88 - (void)hideOverlayScrollers; 89 - (void)flashScrollers; 90 - (id)horizontalScrollerImp; 91 - (void)setHorizontalScrollerImp:(id)horizontal; 92 - (id)verticalScrollerImp; 93 - (void)setVerticalScrollerImp:(id)vertical; 94 - (NSScrollerStyle)scrollerStyle; 95 - (void)setScrollerStyle:(NSScrollerStyle)scrollerStyle; 96 - (void)contentAreaScrolled; 97 - (void)contentAreaScrolledInDirection:(NSPoint)direction; 98 - (void)contentAreaWillDraw; 99 - (void)mouseEnteredContentArea; 100 - (void)mouseExitedContentArea; 101 - (void)mouseMovedInContentArea; 102 - (void)startLiveResize; 103 - (void)contentAreaDidResize; 104 - (void)endLiveResize; 105 - (void)windowOrderedIn; 106 - (void)windowOrderedOut; 107 - (void)beginScrollGesture; 108 - (void)endScrollGesture; 109 @end 110 111 namespace WebCore { 112 113 bool isScrollbarOverlayAPIAvailable(); 114 115 NSScrollerStyle recommendedScrollerStyle(); 116 117 } 118 119 #endif 120