#ifndef Widget_h
#define Widget_h
#include <wtf/Platform.h>
#if PLATFORM(MAC)
#ifdef __OBJC__
@class NSView;
#else
class NSView;
#endif
#endif
#if PLATFORM(WIN)
typedef struct HWND__* HWND;
#endif
#if PLATFORM(GTK)
typedef struct _GdkDrawable GdkDrawable;
typedef struct _GtkWidget GtkWidget;
typedef struct _GtkContainer GtkContainer;
#endif
#if PLATFORM(QT)
class QWidget;
class QWebFrame;
#endif
#if PLATFORM(WX)
class wxWindow;
#endif
namespace WebCore {
class Cursor;
class Event;
class Font;
class GraphicsContext;
class IntPoint;
class IntRect;
class IntSize;
#if ENABLE(HW_COMP)
class LCLayer; #endif
class PlatformMouseEvent;
class ScrollView;
class WidgetClient;
class WidgetPrivate;
class Widget {
public:
Widget();
virtual ~Widget();
virtual void setEnabled(bool);
virtual bool isEnabled() const;
int x() const;
int y() const;
int width() const;
int height() const;
IntSize size() const;
void resize(int, int);
void resize(const IntSize&);
IntPoint pos() const;
void move(int, int);
void move(const IntPoint&);
virtual void paint(GraphicsContext*, const IntRect&);
virtual void invalidate();
virtual void invalidateRect(const IntRect&);
virtual void setFrameGeometry(const IntRect&);
virtual IntRect frameGeometry() const;
virtual void setFocus();
void setCursor(const Cursor&);
Cursor cursor();
virtual void show();
virtual void hide();
void setIsSelected(bool);
void setClient(WidgetClient*);
WidgetClient* client() const;
virtual bool isFrameView() const;
virtual void removeFromParent();
virtual IntRect windowClipRect() const;
virtual void handleEvent(Event*) { }
#if PLATFORM(WIN)
void setContainingWindow(HWND);
HWND containingWindow() const;
virtual void setParent(ScrollView*);
ScrollView* parent() const;
virtual void attachToWindow() { }
virtual void detachFromWindow() { }
virtual void geometryChanged() const {};
IntRect convertToContainingWindow(const IntRect&) const;
IntPoint convertToContainingWindow(const IntPoint&) const;
IntPoint convertFromContainingWindow(const IntPoint&) const;
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
bool suppressInvalidation() const;
void setSuppressInvalidation(bool);
#endif
#if PLATFORM(GTK)
virtual void setParent(ScrollView*);
ScrollView* parent() const;
void setContainingWindow(GtkContainer*);
GtkContainer* containingWindow() const;
virtual void geometryChanged() const;
IntRect convertToContainingWindow(const IntRect&) const;
IntPoint convertToContainingWindow(const IntPoint&) const;
IntPoint convertFromContainingWindow(const IntPoint&) const;
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
bool suppressInvalidation() const;
void setSuppressInvalidation(bool);
GtkWidget* gtkWidget() const;
protected:
void setGtkWidget(GtkWidget*);
#endif
#if PLATFORM(QT)
void setNativeWidget(QWidget *widget);
QWidget* nativeWidget() const;
QWidget *containingWindow() const;
QWebFrame* qwebframe() const;
void setQWebFrame(QWebFrame *webFrame);
virtual void setParent(ScrollView*);
ScrollView* parent() const;
virtual void geometryChanged() const;
ScrollView* topLevel() const;
IntRect convertToContainingWindow(const IntRect&) const;
IntPoint convertToContainingWindow(const IntPoint&) const;
IntPoint convertFromContainingWindow(const IntPoint&) const;
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
bool suppressInvalidation() const;
void setSuppressInvalidation(bool);
#endif
#if PLATFORM(MAC)
Widget(NSView*);
NSView* getView() const;
NSView* getOuterView() const;
void setView(NSView*);
static void beforeMouseDown(NSView*, Widget*);
static void afterMouseDown(NSView*, Widget*);
void addToSuperview(NSView* superview);
void removeFromSuperview();
#if ENABLE(HW_COMP)
virtual void hostCompositingLayer(LCLayer* inLayer);
#endif // ENABLE(HW_COMP)
#endif // PLATFORM(MAC)
#if PLATFORM(WX)
Widget(wxWindow*);
wxWindow* nativeWindow() const;
virtual void setNativeWindow(wxWindow*);
#endif
private:
WidgetPrivate* data;
};
}
#endif // Widget_h