webengine/osswebengine/WebKit/win/WebScrollBar.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * Copyright (C) 2007 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 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. 
       
    24  */
       
    25 
       
    26 #ifndef WebScrollBar_h
       
    27 #define WebScrollBar_h
       
    28 
       
    29 #include "IWebScrollBarDelegatePrivate.h"
       
    30 #include "IWebScrollBarPrivate.h"
       
    31 
       
    32 #include <wtf/RefPtr.h>
       
    33 #include <wtf/OwnPtr.h>
       
    34 
       
    35 #pragma warning(push, 0)
       
    36 #include <WebCore/COMPtr.h>
       
    37 #include <WebCore/ScrollBar.h>
       
    38 #pragma warning(pop)
       
    39 
       
    40 namespace WebCore {
       
    41 class PlatformScrollbar;
       
    42 }
       
    43 
       
    44 using namespace WebCore;
       
    45 
       
    46 class WebScrollBar : public IWebScrollBarPrivate, ScrollbarClient
       
    47 {
       
    48 public:
       
    49     static WebScrollBar* createInstance();
       
    50 protected:
       
    51     WebScrollBar();
       
    52     ~WebScrollBar();
       
    53 
       
    54 public:
       
    55     // IUnknown
       
    56     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
       
    57     virtual ULONG STDMETHODCALLTYPE AddRef(void);
       
    58     virtual ULONG STDMETHODCALLTYPE Release(void);
       
    59 
       
    60     // IWebScrollBarPrivate
       
    61     virtual HRESULT STDMETHODCALLTYPE init( 
       
    62         /* [in] */ IWebScrollBarDelegatePrivate* delegate,
       
    63         /* [in] */ OLE_HANDLE containingWindow,
       
    64         /* [in] */ WebScrollBarOrientation orientation,
       
    65         /* [in] */ WebScrollBarControlSize controlSize);
       
    66     
       
    67     virtual HRESULT STDMETHODCALLTYPE setEnabled( 
       
    68         /* [in] */ BOOL enabled);
       
    69     
       
    70     virtual HRESULT STDMETHODCALLTYPE setSteps( 
       
    71         /* [in] */ int lineStep,
       
    72         /* [in] */ int pageStep);
       
    73     
       
    74     virtual HRESULT STDMETHODCALLTYPE setProportion( 
       
    75         /* [in] */ int visibleSize,
       
    76         /* [in] */ int totalSize);
       
    77     
       
    78     virtual HRESULT STDMETHODCALLTYPE setRect( 
       
    79         /* [in] */ RECT bounds);
       
    80     
       
    81     virtual HRESULT STDMETHODCALLTYPE setValue( 
       
    82         /* [in] */ int value);
       
    83     
       
    84     virtual HRESULT STDMETHODCALLTYPE value( 
       
    85         /* [retval][out] */ int* value);
       
    86    
       
    87     virtual HRESULT STDMETHODCALLTYPE paint( 
       
    88         /* [in] */ HDC dc,
       
    89         /* [in] */ RECT damageRect);
       
    90     
       
    91     virtual HRESULT STDMETHODCALLTYPE frameGeometry( 
       
    92         /* [retval][out] */ RECT* bounds);
       
    93     
       
    94     virtual HRESULT STDMETHODCALLTYPE width( 
       
    95         /* [retval][out] */ int* w);
       
    96     
       
    97     virtual HRESULT STDMETHODCALLTYPE height( 
       
    98         /* [retval][out] */ int* h);
       
    99     
       
   100     virtual HRESULT STDMETHODCALLTYPE requestedWidth( 
       
   101         /* [retval][out] */ int* w);
       
   102     
       
   103     virtual HRESULT STDMETHODCALLTYPE requestedHeight( 
       
   104         /* [retval][out] */ int* h);
       
   105 
       
   106     virtual HRESULT STDMETHODCALLTYPE handleMouseEvent( 
       
   107         /* [in] */ OLE_HANDLE window,
       
   108         /* [in] */ UINT msg,
       
   109         /* [in] */ WPARAM wParam,
       
   110         /* [in] */ LPARAM lParam);
       
   111     
       
   112     virtual HRESULT STDMETHODCALLTYPE scroll( 
       
   113         /* [in] */ WebScrollDirection direction,
       
   114         /* [in] */ WebScrollGranularity granularity,
       
   115         /* [in] */ float multiplier);
       
   116 
       
   117 protected:
       
   118     // ScrollbarClient
       
   119     virtual void valueChanged(Scrollbar*);
       
   120 
       
   121     // Used to obtain a window clip rect.
       
   122     virtual IntRect windowClipRect() const;
       
   123 
       
   124     ULONG m_refCount;
       
   125     RefPtr<WebCore::PlatformScrollbar> m_scrollBar;
       
   126     COMPtr<IWebScrollBarDelegatePrivate> m_delegate;
       
   127 };
       
   128 
       
   129 #endif