#ifndef KHTML_H
#define KHTML_H
#include <qscrollview.h>
class QPainter;
class QRect;
#define INCREMENTAL_REPAINTING
namespace DOM {
class HTMLDocumentImpl;
class DocumentImpl;
class ElementImpl;
class HTMLElementImpl;
class HTMLTitleElementImpl;
class HTMLGenericFormElementImpl;
class HTMLFormElementImpl;
class HTMLAnchorElementImpl;
class Range;
class NodeImpl;
class CSSProperty;
};
namespace khtml {
class RenderObject;
class RenderBox;
class RenderCanvas;
class RenderStyle;
class RenderLineEdit;
class RenderPart;
class RenderPartObject;
class RenderWidget;
class CSSStyleSelector;
void applyRule(DOM::CSSProperty *prop);
};
class KHTMLPart;
class KHTMLViewPrivate;
class KHTMLView : public QScrollView
{
Q_OBJECT
friend class DOM::HTMLDocumentImpl;
friend class DOM::HTMLTitleElementImpl;
friend class DOM::HTMLGenericFormElementImpl;
friend class DOM::HTMLFormElementImpl;
friend class DOM::HTMLAnchorElementImpl;
friend class DOM::DocumentImpl;
friend class KHTMLPart;
friend class khtml::RenderCanvas;
friend class khtml::RenderObject;
friend class khtml::RenderBox;
friend class khtml::RenderLineEdit;
friend class khtml::RenderPart;
friend class khtml::RenderPartObject;
friend class khtml::RenderWidget;
friend class khtml::CSSStyleSelector;
friend void khtml::applyRule(DOM::CSSProperty *prop);
#if APPLE_CHANGES
friend class KWQKHTMLPart;
#endif
public:
KHTMLView( KHTMLPart *part, QWidget *parent, const char *name=0 );
virtual ~KHTMLView();
KHTMLPart *part() const { return m_part; }
int frameWidth() const { return _width; }
void setMarginWidth(int x);
int marginWidth() const { return _marginWidth; }
void setMarginHeight(int y);
int marginHeight() { return _marginHeight; }
virtual void setVScrollBarMode ( ScrollBarMode mode );
virtual void setHScrollBarMode ( ScrollBarMode mode );
virtual void setScrollBarsMode(ScrollBarMode mode);
void print();
void layout();
bool inLayout() const;
int layoutCount() const;
#ifdef INCREMENTAL_REPAINTING
bool needsFullRepaint() const;
#endif
#if APPLE_CHANGES
void resetScrollBars();
#endif
signals:
void cleared();
protected:
void clear();
#if APPLE_CHANGES
public:
void clearPart();
#endif
virtual void resizeEvent ( QResizeEvent * event );
virtual void showEvent ( QShowEvent * );
virtual void hideEvent ( QHideEvent *);
virtual bool focusNextPrevChild( bool next );
#if !APPLE_CHANGES
virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
virtual void drawContents( QPainter* );
#endif
virtual void viewportMousePressEvent( QMouseEvent * );
virtual void focusOutEvent( QFocusEvent * );
virtual void viewportMouseDoubleClickEvent( QMouseEvent * );
virtual void viewportMouseMoveEvent(QMouseEvent *);
virtual void viewportMouseReleaseEvent(QMouseEvent *);
#ifndef QT_NO_WHEELEVENT
virtual void viewportWheelEvent(QWheelEvent*);
#endif
#if !APPLE_CHANGES
virtual void dragEnterEvent( QDragEnterEvent* );
virtual void dropEvent( QDropEvent* );
#endif
void keyPressEvent( QKeyEvent *_ke );
void keyReleaseEvent ( QKeyEvent *_ke );
void contentsContextMenuEvent ( QContextMenuEvent *_ce );
void doAutoScroll();
void timerEvent ( QTimerEvent * );
void repaintRectangle(const QRect& r, bool immediate);
#if APPLE_CHANGES
QWidget *topLevelWidget() const;
QPoint mapToGlobal(const QPoint &) const;
void adjustViewSize();
void initScrollBars();
#endif
void ref() { ++_refCount; }
void deref() { if (!--_refCount) delete this; }
protected slots:
void slotPaletteChanged();
void slotScrollBarMoved();
private:
void resetCursor();
#ifdef INCREMENTAL_REPAINTING
void scheduleRelayout();
#else
void scheduleRelayout(khtml::RenderObject* clippedObj=0);
#endif
void unscheduleRelayout();
void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
void setMediaType( const QString &medium );
QString mediaType() const;
bool scrollTo(const QRect &);
void focusNextPrevNode(bool next);
void useSlowRepaints();
void setIgnoreWheelEvents(bool e);
void init();
DOM::NodeImpl *nodeUnderMouse() const;
void restoreScrollBar();
QStringList formCompletionItems(const QString &name) const;
void addFormCompletionItem(const QString &name, const QString &value);
bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool cancelable,
int detail,QMouseEvent *_mouse, bool setUnder,
int mouseEventType);
void complete();
void applyBodyScrollQuirk(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
#ifndef INCREMENTAL_REPAINTING
khtml::RenderObject* layoutObject() { return m_layoutObject; }
#endif
private:
unsigned _refCount;
int _width;
int _height;
int _marginWidth;
int _marginHeight;
KHTMLPart *m_part;
KHTMLViewPrivate *d;
QString m_medium;
#ifndef INCREMENTAL_REPAINTING
khtml::RenderObject* m_layoutObject;
#endif
};
#endif