summaryrefslogtreecommitdiffstats
path: root/webkit/port/platform/chromium/FramelessScrollView.h
blob: dd940a0ea4919b4b941d4d54e45a2bff0adde4b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FramelessScrollView_h
#define FramelessScrollView_h

#include "ScrollView.h"

namespace WebCore {
    class FramelessScrollViewClient;
    class PlatformKeyboardEvent;
    class PlatformMouseEvent;
    class PlatformWheelEvent;

    // A FramelessScrollView is a ScrollView that can be used to render custom
    // content, which does not have an associated Frame.
    //
    // TODO: It may be better to just develop a custom subclass of Widget that
    // can have scroll bars for this instead of trying to reuse ScrollView.
    //
    class FramelessScrollView : public ScrollView {
    public:
        FramelessScrollView() : m_client(0) {}
        ~FramelessScrollView();

        FramelessScrollViewClient* client() const { return m_client; }
        void setClient(FramelessScrollViewClient* client) { m_client = client; }

        // Event handlers that subclasses must implement.
        virtual bool handleMouseDownEvent(const PlatformMouseEvent&) = 0;
        virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) = 0;
        virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) = 0;
        virtual bool handleWheelEvent(const PlatformWheelEvent&) = 0;
        virtual bool handleKeyEvent(const PlatformKeyboardEvent&) = 0;

        // ScrollbarClient public methods:
        virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
        virtual bool isActive() const;

        // Widget public methods:
        virtual void invalidateRect(const IntRect&);

        // ScrollView public methods:
        virtual HostWindow* hostWindow() const;
        virtual IntRect windowClipRect(bool clipToContents = true) const;

    protected:
        // ScrollView protected methods:
        virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
        virtual void contentsResized();
        virtual void visibleContentsResized();

    private:
        FramelessScrollViewClient* m_client;
    };
}

#endif // FramelessScrollView_h