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 HTMLInputElementImpl;
00044 class Range;
00045 class NodeImpl;
00046 class CSSProperty;
00047 }
00048
00049 namespace KJS {
00050 class WindowFunc;
00051 class ExternalFunc;
00052 }
00053
00054 namespace khtml {
00055 class RenderObject;
00056 class RenderCanvas;
00057 class RenderStyle;
00058 class RenderLineEdit;
00059 class RenderPartObject;
00060 class RenderWidget;
00061 class CSSStyleSelector;
00062 class LineEditWidget;
00063 class InlineBox;
00064 void applyRule(DOM::CSSProperty *prop);
00065 }
00066
00067 class KHTMLPart;
00068 class KHTMLViewPrivate;
00069
00075 class KHTMLView : public QScrollView
00076 {
00077 Q_OBJECT
00078
00079 friend class DOM::HTMLDocumentImpl;
00080 friend class DOM::HTMLTitleElementImpl;
00081 friend class DOM::HTMLGenericFormElementImpl;
00082 friend class DOM::HTMLFormElementImpl;
00083 friend class DOM::HTMLAnchorElementImpl;
00084 friend class DOM::HTMLInputElementImpl;
00085 friend class DOM::DocumentImpl;
00086 friend class KHTMLPart;
00087 friend class khtml::RenderCanvas;
00088 friend class khtml::RenderObject;
00089 friend class khtml::RenderLineEdit;
00090 friend class khtml::RenderPartObject;
00091 friend class khtml::RenderWidget;
00092 friend class khtml::CSSStyleSelector;
00093 friend class khtml::LineEditWidget;
00094 friend class KJS::WindowFunc;
00095 friend class KJS::ExternalFunc;
00096 friend void khtml::applyRule(DOM::CSSProperty *prop);
00097
00098
00099 public:
00103 KHTMLView( KHTMLPart *part, QWidget *parent, const char *name=0 );
00104 virtual ~KHTMLView();
00105
00110 KHTMLPart *part() const { return m_part; }
00111
00112 int frameWidth() const { return _width; }
00113
00117 void setMarginWidth(int x);
00118
00124 int marginWidth() const { return _marginWidth; }
00125
00126
00127
00128
00129 void setMarginHeight(int y);
00130
00136 int marginHeight() { return _marginHeight; }
00137
00141 virtual void setVScrollBarMode ( ScrollBarMode mode );
00142
00146 virtual void setHScrollBarMode ( ScrollBarMode mode );
00147
00151 void print();
00152
00157 void print( bool quick );
00158
00162 void layout();
00163
00164 signals:
00165 void cleared();
00166 void zoomView( int );
00167
00168 protected:
00169 void clear();
00170
00171 virtual void resizeEvent ( QResizeEvent * event );
00172 virtual void showEvent ( QShowEvent * );
00173 virtual void hideEvent ( QHideEvent *);
00174 virtual bool focusNextPrevChild( bool next );
00175 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
00176 virtual void drawContents( QPainter* );
00177 virtual void viewportMousePressEvent( QMouseEvent * );
00178 virtual void focusInEvent( QFocusEvent * );
00179 virtual void focusOutEvent( QFocusEvent * );
00180 virtual void viewportMouseDoubleClickEvent( QMouseEvent * );
00181 virtual void viewportMouseMoveEvent(QMouseEvent *);
00182 virtual void viewportMouseReleaseEvent(QMouseEvent *);
00183 virtual void viewportResizeEvent(QResizeEvent*);
00184 #ifndef QT_NO_WHEELEVENT
00185 virtual void viewportWheelEvent(QWheelEvent*);
00186 #endif
00187 virtual void dragEnterEvent( QDragEnterEvent* );
00188 virtual void dropEvent( QDropEvent* );
00189 virtual void closeEvent ( QCloseEvent * );
00190 virtual bool eventFilter(QObject *, QEvent *);
00191
00192 void keyPressEvent( QKeyEvent *_ke );
00193 void keyReleaseEvent ( QKeyEvent *_ke );
00194 void contentsContextMenuEvent ( QContextMenuEvent *_ce );
00195 void doAutoScroll();
00196
00197 void timerEvent ( QTimerEvent * );
00198
00199 protected slots:
00200 void slotPaletteChanged();
00201 void slotScrollBarMoved();
00202
00203 private slots:
00204 void tripleClickTimeout();
00205
00206 private:
00207 void scheduleRelayout(khtml::RenderObject* clippedObj=0);
00208 void unscheduleRelayout();
00209
00210 void scheduleRepaint(int x, int y, int w, int h);
00211 void unscheduleRepaint();
00212
00213 void closeChildDialogs();
00214 bool dialogsAllowed();
00215
00224 void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
00225
00236 void setMediaType( const QString &medium );
00237 QString mediaType() const;
00238
00239 bool scrollTo(const QRect &);
00240
00241 void focusNextPrevNode(bool next);
00242
00243 void useSlowRepaints();
00244
00245 void setIgnoreWheelEvents(bool e);
00246
00247 void init();
00248
00249 DOM::NodeImpl *nodeUnderMouse() const;
00250
00251 void restoreScrollBar();
00252
00253 QStringList formCompletionItems(const QString &name) const;
00254 void clearCompletionHistory(const QString& name);
00255 void addFormCompletionItem(const QString &name, const QString &value);
00256
00257 void addNonPasswordStorableSite( const QString& host );
00258 bool nonPasswordStorableSite( const QString& host ) const;
00259
00260 bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool cancelable,
00261 int detail,QMouseEvent *_mouse, bool setUnder,
00262 int mouseEventType);
00263 bool dispatchKeyEvent( QKeyEvent *_ke );
00264 bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress );
00265
00266 void complete();
00267
00268 #ifndef KHTML_NO_CARET
00269
00270
00281 void initCaret(bool keepSelection = false);
00284 bool caretOverrides() const;
00292 void ensureNodeHasFocus(DOM::NodeImpl *node);
00299 void recalcAndStoreCaretPos(khtml::InlineBox *hintBox = 0);
00306 void caretOn();
00312 void caretOff();
00321 void showCaret(bool forceRepaint = false);
00328 void hideCaret();
00333 void ensureCaretVisible();
00334
00350 bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset,
00351 DOM::NodeImpl *endNode, long endOffset);
00352
00362 bool placeCaret(khtml::InlineBox *hintBox = 0);
00363
00380 bool extendSelection(DOM::NodeImpl *startNode, long startOffset,
00381 DOM::NodeImpl *endNode, long endOffset);
00382
00392 void updateSelection(DOM::NodeImpl *startNode, long startOffset,
00393 DOM::NodeImpl *endNode, long endOffset);
00394
00399 int caretDisplayPolicyNonFocused() const;
00400
00407 void setCaretDisplayPolicyNonFocused(int policy);
00408
00409
00410
00414 void caretKeyPressEvent(QKeyEvent *);
00415
00416
00417
00429 bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection);
00430
00436 enum CaretMovement { CaretByCharacter, CaretByWord };
00437
00448 void moveCaretBy(bool next, CaretMovement cmv, int n);
00449
00453 void moveCaretByLine(bool next, int n);
00454
00459 void moveCaretToLineBoundary(bool end);
00460
00465 void moveCaretToDocumentBoundary(bool end);
00466
00475 void placeCaretOnChar(khtml::InlineBox *hintBox);
00476
00493 void placeCaretOnLine(khtml::InlineBox *caretBox, int x, int absx, int absy);
00494
00498 void moveCaretByPage(bool next);
00499
00502 void moveCaretPrevWord();
00503
00506 void moveCaretNextWord();
00507
00512 void moveCaretPrevLine(int n = 1);
00513
00518 void moveCaretNextLine(int n = 1);
00519
00522 void moveCaretPrevPage();
00523
00526 void moveCaretNextPage();
00527
00530 void moveCaretToLineBegin();
00531
00534 void moveCaretToLineEnd();
00535
00536 #endif // KHTML_NO_CARET
00537
00538
00539 private:
00540
00541 void setWidgetVisible(::khtml::RenderWidget*, bool visible);
00542
00543 int _width;
00544 int _height;
00545
00546 int _marginWidth;
00547 int _marginHeight;
00548
00549 KHTMLPart *m_part;
00550 KHTMLViewPrivate *d;
00551
00552 QString m_medium;
00553 };
00554
00555 #endif
00556
This file is part of the documentation for khtml Library Version 3.2.0.