FrameView.h 4.5 KB
Newer Older
darin's avatar
darin committed
1
/*
kocienda's avatar
kocienda committed
2 3 4 5 6
   Copyright (C) 1997 Martin Jones (mjones@kde.org)
             (C) 1998 Waldo Bastian (bastian@kde.org)
             (C) 1998, 1999 Torben Weis (weis@kde.org)
             (C) 1999 Lars Knoll (knoll@kde.org)
             (C) 1999 Antti Koivisto (koivisto@kde.org)
darin's avatar
darin committed
7
   Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
kocienda's avatar
kocienda committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

25 26
#ifndef FrameView_h
#define FrameView_h
kocienda's avatar
kocienda committed
27

darin's avatar
darin committed
28
#include "ScrollView.h"
29
#include "IntSize.h"
darin's avatar
darin committed
30
#include <wtf/Forward.h>
darin's avatar
darin committed
31

darin's avatar
darin committed
32
namespace WebCore {
kocienda's avatar
kocienda committed
33

thatcher's avatar
thatcher committed
34
class Color;
andersca's avatar
andersca committed
35 36
class Event;
class EventTargetNode;
darin's avatar
darin committed
37
class Frame;
38
class FrameViewPrivate;
darin's avatar
darin committed
39
class IntRect;
darin's avatar
darin committed
40 41
class PlatformMouseEvent;
class Node;
42
class RenderLayer;
darin's avatar
darin committed
43
class RenderObject;
darin's avatar
darin committed
44
class String;
darin's avatar
darin committed
45 46 47

template <typename T> class Timer;

darin's avatar
darin committed
48
class FrameView : public ScrollView {
kocienda's avatar
kocienda committed
49
public:
darin's avatar
darin committed
50
    FrameView(Frame*);
51
    virtual ~FrameView();
kocienda's avatar
kocienda committed
52

darin's avatar
darin committed
53
    Frame* frame() const { return m_frame.get(); }
darin's avatar
darin committed
54
    void clearFrame();
kocienda's avatar
kocienda committed
55

darin's avatar
darin committed
56 57 58 59 60 61
    void ref() { ++m_refCount; }
    void deref() { if (!--m_refCount) delete this; }
    bool hasOneRef() { return m_refCount == 1; }

    int marginWidth() const { return m_margins.width(); } // -1 means default
    int marginHeight() const { return m_margins.height(); } // -1 means default
62 63
    void setMarginWidth(int);
    void setMarginHeight(int);
kocienda's avatar
kocienda committed
64

ggaren's avatar
ggaren committed
65 66 67
    virtual void setVScrollbarMode(ScrollbarMode);
    virtual void setHScrollbarMode(ScrollbarMode);
    virtual void setScrollbarsMode(ScrollbarMode);
darin's avatar
darin committed
68

adele's avatar
adele committed
69
    void layout(bool allowSubtree = true);
darin's avatar
darin committed
70 71 72 73 74 75
    bool didFirstLayout() const;
    void layoutTimerFired(Timer<FrameView>*);
    void scheduleRelayout();
    void scheduleRelayoutOfSubtree(Node*);
    void unscheduleRelayout();
    bool layoutPending() const;
kocienda's avatar
kocienda committed
76

ap's avatar
ap committed
77
    Node* layoutRoot() const;
78
    int layoutCount() const;
79

80 81 82 83
    // These two helper functions just pass through to the RenderView.
    bool needsLayout() const;
    void setNeedsLayout();

84
    bool needsFullRepaint() const;
darin's avatar
darin committed
85
    void repaintRectangle(const IntRect&, bool immediate);
86
    void addRepaintInfo(RenderObject*, const IntRect&);
87

ggaren's avatar
ggaren committed
88
    void resetScrollbars();
89

90
    void clear();
91

darin's avatar
darin committed
92 93
    bool isTransparent() const;
    void setTransparent(bool isTransparent);
94

darin's avatar
darin committed
95 96 97 98 99 100 101 102 103 104
    Color baseBackgroundColor() const;
    void setBaseBackgroundColor(Color);

    void adjustViewSize();
    void initScrollbars();
    
    virtual IntRect windowClipRect() const;
    IntRect windowClipRect(bool clipToContents) const;
    IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const;

darin's avatar
darin committed
105
    virtual void scrollRectIntoViewRecursively(const IntRect&);
darin's avatar
darin committed
106 107 108
    virtual void setContentsPos(int x, int y);

    String mediaType() const;
darin's avatar
darin committed
109
    void setMediaType(const String&);
darin's avatar
darin committed
110 111 112 113 114 115 116

    void setUseSlowRepaints();

    void addSlowRepaintObject();
    void removeSlowRepaintObject();

    void updateDashboardRegions();
darin's avatar
darin committed
117
    void updateControlTints();
darin's avatar
darin committed
118

darin's avatar
darin committed
119 120
    void restoreScrollbar();

darin's avatar
darin committed
121
    void scheduleEvent(PassRefPtr<Event>, PassRefPtr<EventTargetNode>, bool tempEvent);
122 123
    void pauseScheduledEvents();
    void resumeScheduledEvents();
darin's avatar
darin committed
124

darin's avatar
darin committed
125 126 127
    bool wasScrolledByUser() const;
    void setWasScrolledByUser(bool);

aroben's avatar
aroben committed
128 129
    // FIXME: This method should be used by all platforms, but currently depends on ScrollView::children,
    // which not all methods have. Once FrameView and ScrollView are merged, this #if should be removed.
zecke's avatar
/:  
zecke committed
130
#if PLATFORM(WIN) || PLATFORM(GTK)
zecke's avatar
zecke committed
131
    void layoutIfNeededRecursive();
aroben's avatar
aroben committed
132
#endif
zecke's avatar
zecke committed
133

darin's avatar
darin committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
private:
    void init();

    virtual bool isFrameView() const;

    bool scrollTo(const IntRect&);

    bool useSlowRepaints() const;

    void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);

    void updateBorder();

    void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);

darin's avatar
darin committed
149 150
    void dispatchScheduledEvents();

darin's avatar
darin committed
151 152 153 154 155
    unsigned m_refCount;
    IntSize m_size;
    IntSize m_margins;
    RefPtr<Frame> m_frame;
    FrameViewPrivate* d;
kocienda's avatar
kocienda committed
156 157
};

darin's avatar
darin committed
158 159
}

kocienda's avatar
kocienda committed
160
#endif