2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Collabora Ltd. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <wtf/Platform.h>
38 typedef NSView* PlatformWidget;
42 typedef struct HWND__* HWND;
43 typedef HWND PlatformWidget;
47 typedef struct _GdkDrawable GdkDrawable;
48 typedef struct _GtkWidget GtkWidget;
49 typedef struct _GtkContainer GtkContainer;
50 typedef GtkWidget* PlatformWidget;
55 typedef QWidget* PlatformWidget;
60 typedef wxWindow* PlatformWidget;
68 class GraphicsContext;
72 class PlatformMouseEvent;
82 virtual void setEnabled(bool);
83 virtual bool isEnabled() const;
90 void resize(int, int);
91 void resize(const IntSize&);
94 void move(const IntPoint&);
96 virtual void paint(GraphicsContext*, const IntRect&);
97 virtual void invalidate();
98 virtual void invalidateRect(const IntRect&);
100 virtual void setFrameGeometry(const IntRect&);
101 virtual IntRect frameGeometry() const;
103 virtual void setFocus();
105 void setCursor(const Cursor&);
111 void setIsSelected(bool);
113 void setClient(WidgetClient*);
114 WidgetClient* client() const;
116 virtual bool isFrameView() const;
118 virtual void removeFromParent();
120 // This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore,
121 // e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space.
122 // This clip includes any clips that the widget itself sets up for its children.
123 virtual IntRect windowClipRect() const;
125 virtual void handleEvent(Event*) { }
127 void setContainingWindow(PlatformWidget);
128 PlatformWidget containingWindow() const;
131 virtual void setParent(ScrollView*);
132 ScrollView* parent() const;
134 virtual void attachToWindow() { }
135 virtual void detachFromWindow() { }
137 virtual void geometryChanged() const {};
139 IntRect convertToContainingWindow(const IntRect&) const;
140 IntPoint convertToContainingWindow(const IntPoint&) const;
141 IntPoint convertFromContainingWindow(const IntPoint&) const;
143 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
144 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
146 bool suppressInvalidation() const;
147 void setSuppressInvalidation(bool);
152 virtual void setParent(ScrollView*);
153 ScrollView* parent() const;
155 virtual void geometryChanged() const;
157 IntRect convertToContainingWindow(const IntRect&) const;
158 IntPoint convertToContainingWindow(const IntPoint&) const;
159 IntPoint convertFromContainingWindow(const IntPoint&) const;
161 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
162 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
164 bool suppressInvalidation() const;
165 void setSuppressInvalidation(bool);
167 GtkWidget* gtkWidget() const;
169 void setGtkWidget(GtkWidget*);
173 void setNativeWidget(QWidget *widget);
174 QWidget* nativeWidget() const;
176 virtual void setParent(ScrollView*);
177 ScrollView* parent() const;
178 virtual void geometryChanged() const;
179 ScrollView* topLevel() 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;
188 bool suppressInvalidation() const;
189 void setSuppressInvalidation(bool);
195 NSView* getView() const;
196 NSView* getOuterView() const;
197 void setView(NSView*);
199 static void beforeMouseDown(NSView*, Widget*);
200 static void afterMouseDown(NSView*, Widget*);
202 void addToSuperview(NSView* superview);
203 void removeFromSuperview();
204 IntPoint convertToScreenCoordinate(NSView*, const IntPoint&);
209 wxWindow* nativeWindow() const;
210 virtual void setNativeWindow(wxWindow*);
217 } // namespace WebCore