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 "DeprecatedString.h"
30 #include "ScrollView.h"
32 class DeprecatedStringList;
38 class CSSStyleSelector;
43 class FrameViewPrivate;
44 class GraphicsContext;
45 class HTMLAnchorElement;
48 class HTMLFormElement;
49 class HTMLFrameSetElement;
50 class HTMLGenericFormElement;
51 class HTMLTitleElement;
54 class PlatformKeyboardEvent;
56 class PlatformMouseEvent;
57 class MouseEventWithHitTestResults;
64 class RenderPartObject;
67 class PlatformWheelEvent;
69 template <typename T> class Timer;
71 void applyRule(CSSProperty*);
73 class FrameView : public ScrollView {
74 friend class CSSStyleSelector;
75 friend class Document;
77 friend class HTMLAnchorElement;
78 friend class HTMLDocument;
79 friend class HTMLFormElement;
80 friend class HTMLGenericFormElement;
81 friend class HTMLTitleElement;
82 friend class FrameMac;
83 friend class RenderBox;
84 friend class RenderCanvas;
85 friend class RenderLineEdit;
86 friend class RenderObject;
87 friend class RenderPart;
88 friend class RenderPartObject;
89 friend class RenderWidget;
90 friend void applyRule(CSSProperty *prop);
96 Frame* frame() const { return m_frame.get(); }
98 int frameWidth() const { return _width; }
100 void setMarginWidth(int x);
103 * Returns the margin width.
105 * A return value of -1 means the default value will be used.
107 int marginWidth() const { return _marginWidth; }
109 void setMarginHeight(int y);
112 * Returns the margin height.
114 * A return value of -1 means the default value will be used.
116 int marginHeight() { return _marginHeight; }
118 virtual void setVScrollBarMode(ScrollBarMode);
119 virtual void setHScrollBarMode(ScrollBarMode);
120 virtual void setScrollBarsMode(ScrollBarMode);
126 bool inLayout() const;
127 int layoutCount() const;
129 bool needsFullRepaint() const;
131 void addRepaintInfo(RenderObject* o, const IntRect& r);
133 void resetScrollBars();
140 void handleMousePressEvent(const PlatformMouseEvent&);
141 void handleMouseDoubleClickEvent(const PlatformMouseEvent&);
142 void handleMouseMoveEvent(const PlatformMouseEvent&);
143 void handleMouseReleaseEvent(const PlatformMouseEvent&);
144 void handleWheelEvent(PlatformWheelEvent&);
148 bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
149 void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
150 bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
152 void layoutTimerFired(Timer<FrameView>*);
153 void hoverTimerFired(Timer<FrameView>*);
155 void repaintRectangle(const IntRect& r, bool immediate);
157 bool isTransparent() const;
158 void setTransparent(bool isTransparent);
160 void scheduleRelayout();
161 void unscheduleRelayout();
162 bool haveDelayedLayoutScheduled();
163 bool layoutPending();
165 void scheduleHoverStateUpdate();
167 void adjustViewSize();
168 void initScrollBars();
170 void setHasBorder(bool);
171 bool hasBorder() const;
173 void setResizingFrameSet(HTMLFrameSetElement *);
176 void updateDashboardRegions();
179 void ref() { ++_refCount; }
180 void deref() { if (!--_refCount) delete this; }
184 void scrollBarMoved();
187 void invalidateClick();
190 * Get/set the CSS Media Type.
192 * Media type is set to "screen" for on-screen rendering and "print"
193 * during printing. Other media types lack the proper support in the
194 * renderer and are not activated. The DOM tree and the parser itself,
195 * however, properly handle other media types. To make them actually work
196 * you only need to enable the media type in the view and if necessary
197 * add the media type dependent changes to the renderer.
199 void setMediaType(const DeprecatedString&);
200 DeprecatedString mediaType() const;
202 bool scrollTo(const IntRect&);
204 void focusNextPrevNode(bool next);
206 void useSlowRepaints();
208 void setIgnoreWheelEvents(bool e);
212 Node *nodeUnderMouse() const;
214 void restoreScrollBar();
216 DeprecatedStringList formCompletionItems(const DeprecatedString &name) const;
217 void addFormCompletionItem(const DeprecatedString &name, const DeprecatedString &value);
219 MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent&);
221 bool dispatchMouseEvent(const AtomicString& eventType, Node* target,
222 bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
223 bool dispatchDragEvent(const AtomicString& eventType, Node* target,
224 const PlatformMouseEvent&, Clipboard*);
226 void applyOverflowToViewport(RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
228 virtual bool isFrameView() const;
240 RefPtr<Frame> m_frame;
243 DeprecatedString m_medium; // media type