2 * Copyright (C) 2007 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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 COMPUTER, 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.
26 #ifndef WebScrollBar_h
27 #define WebScrollBar_h
31 #include <wtf/RefPtr.h>
32 #include <wtf/OwnPtr.h>
34 #include <WebCore/COMPtr.h>
35 #include <WebCore/Scrollbar.h>
36 #include <WebCore/ScrollableArea.h>
42 class WebScrollBar : public IWebScrollBarPrivate, WebCore::ScrollableArea {
44 static WebScrollBar* createInstance();
51 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
52 virtual ULONG STDMETHODCALLTYPE AddRef(void);
53 virtual ULONG STDMETHODCALLTYPE Release(void);
55 // IWebScrollBarPrivate
56 virtual HRESULT STDMETHODCALLTYPE init(
57 /* [in] */ IWebScrollBarDelegatePrivate* delegate,
58 /* [in] */ OLE_HANDLE containingWindow,
59 /* [in] */ WebScrollBarOrientation orientation,
60 /* [in] */ WebScrollBarControlSize controlSize);
62 virtual HRESULT STDMETHODCALLTYPE setEnabled(
63 /* [in] */ BOOL enabled);
65 virtual HRESULT STDMETHODCALLTYPE setSteps(
66 /* [in] */ int lineStep,
67 /* [in] */ int pageStep);
69 virtual HRESULT STDMETHODCALLTYPE setProportion(
70 /* [in] */ int visibleSize,
71 /* [in] */ int totalSize);
73 virtual HRESULT STDMETHODCALLTYPE setRect(
74 /* [in] */ RECT bounds);
76 virtual HRESULT STDMETHODCALLTYPE setValue(
77 /* [in] */ int value);
79 virtual HRESULT STDMETHODCALLTYPE value(
80 /* [retval][out] */ int* value);
82 virtual HRESULT STDMETHODCALLTYPE paint(
84 /* [in] */ RECT damageRect);
86 virtual HRESULT STDMETHODCALLTYPE frameRect(
87 /* [retval][out] */ RECT* bounds);
89 virtual HRESULT STDMETHODCALLTYPE width(
90 /* [retval][out] */ int* w);
92 virtual HRESULT STDMETHODCALLTYPE height(
93 /* [retval][out] */ int* h);
95 virtual HRESULT STDMETHODCALLTYPE requestedWidth(
96 /* [retval][out] */ int* w);
98 virtual HRESULT STDMETHODCALLTYPE requestedHeight(
99 /* [retval][out] */ int* h);
101 virtual HRESULT STDMETHODCALLTYPE handleMouseEvent(
102 /* [in] */ OLE_HANDLE window,
104 /* [in] */ WPARAM wParam,
105 /* [in] */ LPARAM lParam);
107 virtual HRESULT STDMETHODCALLTYPE scroll(
108 /* [in] */ WebScrollDirection direction,
109 /* [in] */ WebScrollGranularity granularity,
110 /* [in] */ float multiplier);
114 virtual int scrollSize(WebCore::ScrollbarOrientation) const;
115 virtual int scrollPosition(WebCore::Scrollbar*) const;
116 virtual void setScrollOffset(const WebCore::IntPoint&);
117 virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&);
118 virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { }
119 virtual WebCore::ScrollableArea* enclosingScrollableArea() const { return 0; }
121 // FIXME: We should provide a way to set this value.
122 virtual bool isActive() const { return true; }
124 virtual bool isScrollCornerVisible() const { return false; }
125 virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); }
127 virtual WebCore::Scrollbar* horizontalScrollbar() const;
128 virtual WebCore::Scrollbar* verticalScrollbar() const;
131 HWND m_containingWindow;
132 int m_currentPosition;
133 RefPtr<WebCore::Scrollbar> m_scrollBar;
134 COMPtr<IWebScrollBarDelegatePrivate> m_delegate;