#ifndef ScrollView_h
#define ScrollView_h
#include "IntRect.h"
#include "ScrollTypes.h"
#include "Widget.h"
#include <wtf/HashSet.h>
#if PLATFORM(GTK)
typedef struct _GtkAdjustment GtkAdjustment;
#endif
#if PLATFORM(WIN)
typedef struct HRGN__* HRGN;
#endif
#if PLATFORM(WX)
class wxScrollWinEvent;
#endif
namespace WebCore {
class FloatRect;
class IntRect;
class PlatformWheelEvent;
class PlatformScrollbar;
class ScrollView : public Widget {
public:
int visibleWidth() const;
int visibleHeight() const;
FloatRect visibleContentRect() const;
FloatRect visibleContentRectConsideringExternalScrollers() const;
int contentsWidth() const;
int contentsHeight() const;
int contentsX() const;
int contentsY() const;
int actualVisibleWidth() const;
int actualVisibleHeight() const;
int actualContentsX() const;
int actualContentsY() const;
IntSize scrollOffset() const;
void scrollBy(int dx, int dy);
virtual void scrollRectIntoViewRecursively(const IntRect&);
virtual void setContentsPos(int x, int y);
virtual void setVScrollbarMode(ScrollbarMode);
virtual void setHScrollbarMode(ScrollbarMode);
virtual void setScrollbarsMode(ScrollbarMode);
void suppressScrollbars(bool suppressed, bool repaintOnUnsuppress = false);
ScrollbarMode vScrollbarMode() const;
ScrollbarMode hScrollbarMode() const;
void addChild(Widget*);
void removeChild(Widget*);
virtual void resizeContents(int w, int h);
virtual void updateContents(const IntRect& r, bool now = false) { updateWindowContents(r, now); }
virtual void update() { updateWindow(); }
void updateWindowContents(const IntRect&, bool now = false);
void updateWindow();
IntPoint windowToContents(const IntPoint&) const;
IntPoint contentsToWindow(const IntPoint&) const;
#if PLATFORM(MAC)
IntRect windowToContents(const IntRect&) const;
IntRect contentsToWindow(const IntRect&) const;
#else
IntRect contentsToWindow(const IntRect& rect) const { return IntRect(contentsToWindow(rect.location()), rect.size()); }
IntRect windowToContents(const IntRect& rect) const { return IntRect(windowToContents(rect.location()), rect.size()); }
#endif
void setStaticBackground(bool);
bool inWindow() const;
bool inSuspendedWindow();
void setVisibleSizeOverrideEnabled(bool);
PlatformScrollbar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
void wheelEvent(PlatformWheelEvent&);
bool scroll(ScrollDirection, ScrollGranularity);
#if PLATFORM(MAC)
NSView* getDocumentView() const;
#if ENABLE(HW_COMP)
virtual void hostCompositingLayer(LCLayer* inLayer);
#endif // ENABLE(HW_COMP)
#endif
#if PLATFORM(WIN)
ScrollView();
~ScrollView();
virtual void paint(GraphicsContext*, const IntRect&);
virtual void themeChanged();
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
virtual void geometryChanged() const;
virtual void setFrameGeometry(const IntRect&);
IntRect windowResizerRect();
bool resizerOverlapsContent() const;
void adjustOverlappingScrollbarCount(int overlapDelta);
virtual void setParent(ScrollView*);
virtual void attachToWindow();
virtual void detachFromWindow();
bool isAttachedToWindow() const;
virtual void show();
virtual void hide();
void addToDirtyRegion(const IntRect&);
void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
void updateBackingStore();
void setAllowsScrolling(bool);
bool allowsScrolling() const;
HashSet<Widget*>* children();
private:
void updateScrollbars(const IntSize& desiredOffset);
IntSize maximumScroll() const;
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
#endif
#if PLATFORM(GTK)
ScrollView();
~ScrollView();
virtual void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj);
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
virtual void geometryChanged() const;
virtual void paint(GraphicsContext*, const IntRect&);
virtual void setFrameGeometry(const IntRect&);
void addToDirtyRegion(const IntRect&);
void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
void updateBackingStore();
protected:
HashSet<Widget*>* children() const;
private:
IntSize maximumScroll() const;
void updateScrollbars(const IntSize& desiredOffset);
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
#endif
#if PLATFORM(QT)
ScrollView();
~ScrollView();
virtual void paint(GraphicsContext*, const IntRect&);
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
virtual void geometryChanged() const;
virtual void setFrameGeometry(const IntRect&);
IntRect windowResizerRect();
bool resizerOverlapsContent() const;
void adjustOverlappingScrollbarCount(int overlapDelta);
virtual void setParent(ScrollView*);
void addToDirtyRegion(const IntRect&);
void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
void updateBackingStore();
PlatformScrollbar *horizontalScrollBar() const;
PlatformScrollbar *verticalScrollBar() const;
HashSet<Widget*>* children();
private:
void updateScrollbars(const IntSize& desiredOffset);
IntSize maximumScroll() const;
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
#endif
#if PLATFORM(WX)
ScrollView();
~ScrollView();
HashSet<Widget*>* children();
virtual void setNativeWindow(wxWindow* window);
private:
void adjustScrollbars(int x = -1, int y = -1, bool refresh = true);
IntSize maximumScroll() const;
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
#endif
};
}
#endif // ScrollView_h