00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef BTWidget_h
00028 #define BTWidget_h
00029
00030
00031 #include <wtf/Platform.h>
00032 #ifdef __OWB__
00033 #include "IntRect.h"
00034 #include "GraphicsContext.h"
00035 #endif
00036 #if PLATFORM(MAC)
00037 #ifdef __OBJC__
00038 @class NSView;
00039 #else
00040 class NSView;
00041 #endif
00042 #endif
00043
00044 #if PLATFORM(WIN)
00045 typedef struct HWND__* HWND;
00046 #endif
00047
00048 #if PLATFORM(GTK)
00049 typedef struct _GdkDrawable GdkDrawable;
00050 typedef struct _GtkWidget GtkWidget;
00051 typedef struct _GtkContainer GtkContainer;
00052 #endif
00053
00054 #if PLATFORM(QT)
00055 class QWidget;
00056 class QWebFrame;
00057 #endif
00058
00059 namespace WebCore {
00060
00061 class Cursor;
00062 class Event;
00063 class GraphicsContext;
00064 class IntPoint;
00065 class IntSize;
00066 class PlatformMouseEvent;
00067 class ScrollView;
00068 class WidgetClient;
00069 class WidgetPrivate;
00070
00071 #ifdef __OWB__
00072 }
00073 using BAL::BTFont;
00074 using WebCore::IntSize;
00075 using WebCore::IntPoint;
00076 using WebCore::IntRect;
00077 using WebCore::Cursor;
00078 using WebCore::WidgetClient;
00079 using WebCore::WidgetPrivate;
00080 using WebCore::Event;
00081
00082 namespace BAL {
00083 class BINativeImage;
00084 class BTScrollView;
00085 class BIWindow;
00086 #endif
00087 class BTWidget {
00088 public:
00089 BTWidget();
00090 virtual ~BTWidget();
00091
00092 virtual void setEnabled(bool);
00093 virtual bool isEnabled() const;
00094
00095 int x() const;
00096 int y() const;
00097 int width() const;
00098 int height() const;
00099 IntSize size() const;
00100 void resize(int, int);
00101 void resize(const IntSize&);
00102 IntPoint pos() const;
00103 void move(int, int);
00104 void move(const IntPoint&);
00105
00106 virtual void paint(GraphicsContext*, const IntRect&);
00107 virtual void invalidate();
00108 virtual void invalidateRect(const IntRect&);
00109
00110 virtual void setFrameGeometry(const IntRect&);
00111 virtual IntRect frameGeometry() const;
00112
00113 virtual void setFocus();
00114
00115 void setCursor(const Cursor&);
00116 Cursor cursor();
00117
00118 virtual void show();
00119 virtual void hide();
00120
00121 void setIsSelected(bool);
00122
00123 void setClient(WidgetClient*);
00124 WidgetClient* client() const;
00125
00126 virtual bool isFrameView() const;
00127
00128 virtual void removeFromParent();
00129
00130
00131
00132
00133 virtual IntRect windowClipRect() const;
00134
00135 virtual void handleEvent(Event*) { }
00136
00137 #if PLATFORM(WIN)
00138 void setContainingWindow(HWND);
00139 HWND containingWindow() const;
00140
00141 virtual void setParent(ScrollView*);
00142 ScrollView* parent() const;
00143
00144 virtual void geometryChanged() const {};
00145
00146 IntRect convertToContainingWindow(const IntRect&) const;
00147 IntPoint convertToContainingWindow(const IntPoint&) const;
00148 IntPoint convertFromContainingWindow(const IntPoint&) const;
00149
00150 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
00151 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
00152
00153 bool suppressInvalidation() const;
00154 void setSuppressInvalidation(bool);
00155
00156 #endif
00157
00158 #if PLATFORM(GTK)
00159 virtual void setParent(ScrollView*);
00160 ScrollView* parent() const;
00161
00162 void setContainingWindow(GtkContainer*);
00163 GtkContainer* containingWindow() const;
00164
00165 virtual void geometryChanged() const;
00166
00167 IntRect convertToContainingWindow(const IntRect&) const;
00168 IntPoint convertToContainingWindow(const IntPoint&) const;
00169 IntPoint convertFromContainingWindow(const IntPoint&) const;
00170
00171 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
00172 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
00173
00174 bool suppressInvalidation() const;
00175 void setSuppressInvalidation(bool);
00176
00177 GtkWidget* gtkWidget() const;
00178 protected:
00179 void setGtkWidget(GtkWidget*);
00180 #endif
00181
00182 #if PLATFORM(QT)
00183 QWidget* qwidget() const;
00184 void setQWidget(QWidget *widget);
00185 QWidget* containingWindow() const;
00186
00187 QWebFrame* qwebframe() const;
00188 void setQWebFrame(QWebFrame *webFrame);
00189 virtual void setParent(ScrollView*);
00190 ScrollView* parent() const;
00191 virtual void geometryChanged() const;
00192
00193 IntRect convertToContainingWindow(const IntRect&) const;
00194 IntPoint convertToContainingWindow(const IntPoint&) const;
00195 IntPoint convertFromContainingWindow(const IntPoint&) const;
00196
00197 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
00198 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
00199 #endif
00200
00201 #if PLATFORM(MAC)
00202 Widget(NSView*);
00203
00204 NSView* getView() const;
00205 NSView* getOuterView() const;
00206 void setView(NSView*);
00207
00208 static void beforeMouseDown(NSView*, Widget*);
00209 static void afterMouseDown(NSView*, Widget*);
00210
00211 void addToSuperview(NSView* superview);
00212 void removeFromSuperview();
00213 IntPoint convertToScreenCoordinate(NSView*, const IntPoint&);
00214 #endif
00215
00216 #ifdef __OWB__
00217 virtual void setBackingStore(BINativeImage*) {}
00218 virtual BINativeImage* backingStore() const { return NULL; }
00219 virtual const IntRect* dirtyRect() const { return NULL; }
00220 virtual void setDirtyRect(IntRect) {}
00221 virtual void setParent(BTScrollView* parent);
00222 virtual BTScrollView* parent() const;
00223 #endif
00224
00225 private:
00226 WidgetPrivate* data;
00227 };
00228
00229 }
00230
00231 #endif // Widget_h