193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)/* 293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Copyright (C) 2012 Google Inc. All rights reserved. 393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * modification, are permitted provided that the following conditions 693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * are met: 793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 1093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 1193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 1293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 1493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 1593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 1793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 1893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 1993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 2093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 2293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) */ 2493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 2593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#ifndef WebScrollbar_h 2693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#define WebScrollbar_h 2793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 2893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebPoint.h" 2993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebRect.h" 3093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebSize.h" 3193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebVector.h" 32a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#if INSIDE_BLINK 33c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)#include "wtf/PassOwnPtr.h" 3493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif 3593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 3693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)namespace WebCore { 3793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)class Scrollbar; 3893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)} 3993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 4051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink { 4193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 4293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)// A const accessor interface for a WebKit scrollbar 43a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)class BLINK_PLATFORM_EXPORT WebScrollbar { 4493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)public: 4593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum Orientation { 4693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) Horizontal, 4793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) Vertical 4893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 4993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 5093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum ScrollDirection { 5193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollBackward, 5293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollForward 5393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 5493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 5593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum ScrollGranularity { 5693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollByLine, 5793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollByPage, 5893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollByDocument, 5993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollByPixel 6093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 6193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 6293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum ScrollbarControlSize { 6393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) RegularScrollbar, 6493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) SmallScrollbar 6593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 6693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 6793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum ScrollbarPart { 6893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) NoPart = 0, 6993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) BackButtonStartPart = 1, 7093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ForwardButtonStartPart = 1 << 1, 7193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) BackTrackPart = 1 << 2, 7293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ThumbPart = 1 << 3, 7393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ForwardTrackPart = 1 << 4, 7493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) BackButtonEndPart = 1 << 5, 7593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ForwardButtonEndPart = 1 << 6, 7693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollbarBGPart = 1 << 7, 7793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) TrackBGPart = 1 << 8, 7893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) AllParts = 0xffffffff 7993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 8093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) enum ScrollbarOverlayStyle { 8293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollbarOverlayStyleDefault, 8393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollbarOverlayStyleDark, 8493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) ScrollbarOverlayStyleLight 8593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 8693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ~WebScrollbar() { } 8893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // Return true if this is an overlay scrollbar. 9093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool isOverlay() const = 0; 9193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 9293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // Gets the current value (i.e. position inside the region). 9393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual int value() const = 0; 9493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 9593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual WebPoint location() const = 0; 9693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual WebSize size() const = 0; 9793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool enabled() const = 0; 9893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual int maximum() const = 0; 9993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual int totalSize() const = 0; 10093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool isScrollViewScrollbar() const = 0; 10193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool isScrollableAreaActive() const = 0; 10293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void getTickmarks(WebVector<WebRect>& tickmarks) const = 0; 10393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ScrollbarControlSize controlSize() const = 0; 10493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ScrollbarPart pressedPart() const = 0; 10593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ScrollbarPart hoveredPart() const = 0; 10693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const = 0; 10793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool isCustomScrollbar() const = 0; 10893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual Orientation orientation() const = 0; 1098abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles) virtual bool isLeftSideVerticalScrollbar() const = 0; 11093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool isAlphaLocked() const { return false; } 11193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual void setIsAlphaLocked(bool) { } 11293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)}; 11393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 11451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink 11593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 11693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif 117