khtmlview.h
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 #ifndef KHTML_H
00026 #define KHTML_H
00027
00028
00029 #include <qscrollview.h>
00030
00031 class QPainter;
00032 class QRect;
00033
00034 namespace DOM {
00035 class HTMLDocumentImpl;
00036 class DocumentImpl;
00037 class ElementImpl;
00038 class HTMLElementImpl;
00039 class HTMLTitleElementImpl;
00040 class HTMLGenericFormElementImpl;
00041 class HTMLFormElementImpl;
00042 class HTMLAnchorElementImpl;
00043 class Range;
00044 class NodeImpl;
00045 class CSSProperty;
00046 }
00047
00048 namespace KJS {
00049 class WindowFunc;
00050 }
00051
00052 namespace khtml {
00053 class RenderObject;
00054 class RenderRoot;
00055 class RenderStyle;
00056 class RenderLineEdit;
00057 class RenderPartObject;
00058 class RenderWidget;
00059 class CSSStyleSelector;
00060 void applyRule(DOM::CSSProperty *prop);
00061 }
00062
00063 class KHTMLPart;
00064 class KHTMLViewPrivate;
00065
00071 class KHTMLView : public QScrollView
00072 {
00073 Q_OBJECT
00074
00075 friend class DOM::HTMLDocumentImpl;
00076 friend class DOM::HTMLTitleElementImpl;
00077 friend class DOM::HTMLGenericFormElementImpl;
00078 friend class DOM::HTMLFormElementImpl;
00079 friend class DOM::HTMLAnchorElementImpl;
00080 friend class DOM::DocumentImpl;
00081 friend class KHTMLPart;
00082 friend class khtml::RenderRoot;
00083 friend class khtml::RenderObject;
00084 friend class khtml::RenderLineEdit;
00085 friend class khtml::RenderPartObject;
00086 friend class khtml::RenderWidget;
00087 friend class khtml::CSSStyleSelector;
00088 friend class KJS::WindowFunc;
00089 friend void khtml::applyRule(DOM::CSSProperty *prop);
00090
00091
00092 public:
00096 KHTMLView( KHTMLPart *part, QWidget *parent, const char *name=0 );
00097 virtual ~KHTMLView();
00098
00103 KHTMLPart *part() const { return m_part; }
00104
00105 int frameWidth() const { return _width; }
00106
00110 void setMarginWidth(int x);
00111
00117 int marginWidth() const { return _marginWidth; }
00118
00119
00120
00121
00122 void setMarginHeight(int y);
00123
00129 int marginHeight() { return _marginHeight; }
00130
00134 virtual void setVScrollBarMode ( ScrollBarMode mode );
00135
00139 virtual void setHScrollBarMode ( ScrollBarMode mode );
00140
00144 void print();
00145
00149 void layout();
00150
00151 signals:
00152 void cleared();
00153 void zoomView( int );
00154
00155 protected:
00156 void clear();
00157
00158 virtual void resizeEvent ( QResizeEvent * event );
00159 virtual void showEvent ( QShowEvent * );
00160 virtual void hideEvent ( QHideEvent *);
00161 virtual bool focusNextPrevChild( bool next );
00162 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
00163 virtual void drawContents( QPainter* );
00164 virtual void viewportMousePressEvent( QMouseEvent * );
00165 virtual void focusOutEvent( QFocusEvent * );
00166 virtual void viewportMouseDoubleClickEvent( QMouseEvent * );
00167 virtual void viewportMouseMoveEvent(QMouseEvent *);
00168 virtual void viewportMouseReleaseEvent(QMouseEvent *);
00169 virtual void viewportResizeEvent(QResizeEvent*);
00170 #ifndef QT_NO_WHEELEVENT
00171 virtual void viewportWheelEvent(QWheelEvent*);
00172 #endif
00173 virtual void dragEnterEvent( QDragEnterEvent* );
00174 virtual void dropEvent( QDropEvent* );
00175 virtual void closeEvent ( QCloseEvent * );
00176
00177 void keyPressEvent( QKeyEvent *_ke );
00178 void keyReleaseEvent ( QKeyEvent *_ke );
00179 void contentsContextMenuEvent ( QContextMenuEvent *_ce );
00180 void doAutoScroll();
00181
00182 void timerEvent ( QTimerEvent * );
00183
00184 protected slots:
00185 void slotPaletteChanged();
00186 void slotScrollBarMoved();
00187
00188 private slots:
00189 void tripleClickTimeout();
00190
00191 private:
00192 void scheduleRelayout();
00193
00194 void scheduleRepaint(int x, int y, int w, int h);
00195 void closeChildDialogs();
00196 bool dialogsAllowed();
00197
00206 void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
00207
00218 void setMediaType( const QString &medium );
00219 QString mediaType() const;
00220
00221 bool scrollTo(const QRect &);
00222
00223 void focusNextPrevNode(bool next);
00224
00225 void useSlowRepaints();
00226
00227 void setIgnoreWheelEvents(bool e);
00228
00229 void init();
00230
00231 DOM::NodeImpl *nodeUnderMouse() const;
00232
00233 void restoreScrollBar();
00234
00235 QStringList formCompletionItems(const QString &name) const;
00236 void clearCompletionHistory( const QString& name );
00237 void addFormCompletionItem(const QString &name, const QString &value);
00238
00239 bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool cancelable,
00240 int detail,QMouseEvent *_mouse, bool setUnder,
00241 int mouseEventType);
00242
00243 void complete();
00244
00245
00246 private:
00247
00248 void setWidgetVisible(::khtml::RenderWidget*, bool visible);
00249
00250 int _width;
00251 int _height;
00252
00253 int _marginWidth;
00254 int _marginHeight;
00255
00256 KHTMLPart *m_part;
00257 KHTMLViewPrivate *d;
00258
00259 QString m_medium;
00260 };
00261
00262 #endif
00263
This file is part of the documentation for kdelibs Version 3.1.5.