2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 #include <wtf/Platform.h>
40 typedef struct HWND__* HWND;
44 typedef struct _GdkDrawable GdkDrawable;
45 typedef struct _GtkWidget GtkWidget;
46 typedef struct _GtkContainer GtkContainer;
55 class wxScrolledWindow;
63 class GraphicsContext;
67 class PlatformMouseEvent;
77 virtual void setEnabled(bool);
78 virtual bool isEnabled() const;
85 void resize(int, int);
86 void resize(const IntSize&);
89 void move(const IntPoint&);
91 virtual void paint(GraphicsContext*, const IntRect&);
92 virtual void invalidate();
93 virtual void invalidateRect(const IntRect&);
95 virtual void setFrameGeometry(const IntRect&);
96 virtual IntRect frameGeometry() const;
98 virtual void setFocus();
100 void setCursor(const Cursor&);
106 void setIsSelected(bool);
108 void setClient(WidgetClient*);
109 WidgetClient* client() const;
111 virtual bool isFrameView() const;
113 virtual void removeFromParent();
115 // This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore,
116 // e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space.
117 // This clip includes any clips that the widget itself sets up for its children.
118 virtual IntRect windowClipRect() const;
120 virtual void handleEvent(Event*) { }
123 void setContainingWindow(HWND);
124 HWND containingWindow() const;
126 virtual void setParent(ScrollView*);
127 ScrollView* parent() const;
129 virtual void attachToWindow() { }
130 virtual void detachFromWindow() { }
132 virtual void geometryChanged() const {};
134 IntRect convertToContainingWindow(const IntRect&) const;
135 IntPoint convertToContainingWindow(const IntPoint&) const;
136 IntPoint convertFromContainingWindow(const IntPoint&) const;
138 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
139 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
141 bool suppressInvalidation() const;
142 void setSuppressInvalidation(bool);
147 virtual void setParent(ScrollView*);
148 ScrollView* parent() const;
150 void setContainingWindow(GtkContainer*);
151 GtkContainer* containingWindow() const;
153 virtual void geometryChanged() const;
155 IntRect convertToContainingWindow(const IntRect&) const;
156 IntPoint convertToContainingWindow(const IntPoint&) const;
157 IntPoint convertFromContainingWindow(const IntPoint&) const;
159 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
160 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
162 bool suppressInvalidation() const;
163 void setSuppressInvalidation(bool);
165 GtkWidget* gtkWidget() const;
167 void setGtkWidget(GtkWidget*);
171 QWidget* qwidget() const;
172 void setQWidget(QWidget *widget);
173 QWidget* containingWindow() const;
175 QWebFrame* qwebframe() const;
176 void setQWebFrame(QWebFrame *webFrame);
177 virtual void setParent(ScrollView*);
178 ScrollView* parent() const;
179 virtual void geometryChanged() const;
181 IntRect convertToContainingWindow(const IntRect&) const;
182 IntPoint convertToContainingWindow(const IntPoint&) const;
183 IntPoint convertFromContainingWindow(const IntPoint&) const;
185 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
186 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
192 NSView* getView() const;
193 NSView* getOuterView() const;
194 void setView(NSView*);
196 static void beforeMouseDown(NSView*, Widget*);
197 static void afterMouseDown(NSView*, Widget*);
199 void addToSuperview(NSView* superview);
200 void removeFromSuperview();
201 IntPoint convertToScreenCoordinate(NSView*, const IntPoint&);
205 Widget(wxScrolledWindow*);
206 wxScrolledWindow* nativeWindow() const;
207 void setNativeWindow(wxScrolledWindow*);
214 } // namespace WebCore