1 /* This file is part of the KDE project
3 Copyright (C) 1997 Martin Jones (mjones@kde.org)
4 (C) 1998 Waldo Bastian (bastian@kde.org)
5 (C) 1998, 1999 Torben Weis (weis@kde.org)
6 (C) 1999 Lars Knoll (knoll@kde.org)
7 (C) 1999 Antti Koivisto (koivisto@kde.org)
8 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public
12 License as published by the Free Software Foundation; either
13 version 2 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA.
29 #include "ScrollView.h"
31 #include "PlatformString.h"
33 class DeprecatedStringList;
39 class CSSStyleSelector;
44 class FrameViewPrivate;
45 class GraphicsContext;
46 class HTMLAnchorElement;
49 class HTMLFormElement;
50 class HTMLFrameSetElement;
51 class HTMLGenericFormElement;
52 class HTMLTitleElement;
55 class PlatformKeyboardEvent;
57 class PlatformMouseEvent;
58 class MouseEventWithHitTestResults;
65 class RenderPartObject;
68 class PlatformWheelEvent;
71 template <typename T> class Timer;
73 void applyRule(CSSProperty*);
75 class FrameView : public ScrollView {
76 friend class CSSStyleSelector;
77 friend class Document;
79 friend class HTMLAnchorElement;
80 friend class HTMLDocument;
81 friend class HTMLFormElement;
82 friend class HTMLGenericFormElement;
83 friend class HTMLTitleElement;
84 friend class FrameMac;
85 friend class RenderBox;
86 friend class RenderView;
87 friend class RenderLineEdit;
88 friend class RenderObject;
89 friend class RenderPart;
90 friend class RenderPartObject;
91 friend class RenderWidget;
92 friend void applyRule(CSSProperty *prop);
98 Frame* frame() const { return m_frame.get(); }
100 int frameWidth() const { return m_size.width(); }
103 * Gets/Sets the margin width/height
105 * A return value of -1 means the default value will be used.
107 int marginWidth() const { return m_margins.width(); }
108 int marginHeight() { return m_margins.height(); }
109 void setMarginWidth(int);
110 void setMarginHeight(int);
112 virtual void setVScrollBarMode(ScrollBarMode);
113 virtual void setHScrollBarMode(ScrollBarMode);
114 virtual void setScrollBarsMode(ScrollBarMode);
118 void layout(bool allowSubtree = true);
120 Node* layoutRoot() const;
121 int layoutCount() const;
123 bool needsFullRepaint() const;
125 void addRepaintInfo(RenderObject*, const IntRect&);
127 void resetScrollBars();
134 void handleMousePressEvent(const PlatformMouseEvent&);
135 void handleMouseDoubleClickEvent(const PlatformMouseEvent&);
136 void handleMouseMoveEvent(const PlatformMouseEvent&);
137 void handleMouseReleaseEvent(const PlatformMouseEvent&);
138 void handleWheelEvent(PlatformWheelEvent&);
144 bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
145 void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
146 bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
148 void layoutTimerFired(Timer<FrameView>*);
149 void hoverTimerFired(Timer<FrameView>*);
151 void repaintRectangle(const IntRect& r, bool immediate);
153 bool isTransparent() const;
154 void setTransparent(bool isTransparent);
156 void scheduleRelayout();
157 void scheduleRelayoutOfSubtree(Node*);
158 void unscheduleRelayout();
159 bool haveDelayedLayoutScheduled();
160 bool layoutPending() const;
162 void scheduleHoverStateUpdate();
164 void adjustViewSize();
165 void initScrollBars();
167 void setHasBorder(bool);
168 bool hasBorder() const;
170 void setResizingFrameSet(HTMLFrameSetElement *);
173 void updateDashboardRegions();
176 void ref() { ++m_refCount; }
177 void deref() { if (!--m_refCount) delete this; }
181 void scrollBarMoved();
184 void invalidateClick();
187 * Get/set the CSS Media Type.
189 * Media type is set to "screen" for on-screen rendering and "print"
190 * during printing. Other media types lack the proper support in the
191 * renderer and are not activated. The DOM tree and the parser itself,
192 * however, properly handle other media types. To make them actually work
193 * you only need to enable the media type in the view and if necessary
194 * add the media type dependent changes to the renderer.
196 void setMediaType(const String&);
197 String mediaType() const;
199 bool scrollTo(const IntRect&);
201 void focusNextPrevNode(bool next);
203 void useSlowRepaints();
205 void setIgnoreWheelEvents(bool e);
209 Node *nodeUnderMouse() const;
211 void restoreScrollBar();
213 DeprecatedStringList formCompletionItems(const String& name) const;
214 void addFormCompletionItem(const String& name, const String& value);
216 MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent&);
218 bool dispatchMouseEvent(const AtomicString& eventType, Node* target,
219 bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
220 bool dispatchDragEvent(const AtomicString& eventType, Node* target,
221 const PlatformMouseEvent&, Clipboard*);
223 void applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
225 virtual bool isFrameView() const;
234 RefPtr<Frame> m_frame;