khtml Library API Documentation

khtmlview.h

00001 /* This file is part of the KDE project 00002 00003 Copyright (C) 1997 Martin Jones (mjones@kde.org) 00004 (C) 1998 Waldo Bastian (bastian@kde.org) 00005 (C) 1998, 1999 Torben Weis (weis@kde.org) 00006 (C) 1999 Lars Knoll (knoll@kde.org) 00007 (C) 1999 Antti Koivisto (koivisto@kde.org) 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License as published by the Free Software Foundation; either 00012 version 2 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Library General Public License for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with this library; see the file COPYING.LIB. If not, write to 00021 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00022 Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef KHTML_H 00026 #define KHTML_H 00027 00028 // qt includes and classes 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 * Sets a margin in y direction. 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 ); // KDE 4.0: merge with above 00158 00162 void layout(); // KDE 4.0: make private 00163 00164 signals: 00165 void finishedLayout(); 00166 void cleared(); 00167 void zoomView( int ); 00168 00169 protected: 00170 void clear(); 00171 00172 virtual void resizeEvent ( QResizeEvent * event ); 00173 virtual void showEvent ( QShowEvent * ); 00174 virtual void hideEvent ( QHideEvent *); 00175 virtual bool focusNextPrevChild( bool next ); 00176 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); 00177 virtual void drawContents( QPainter* ); 00178 virtual void viewportMousePressEvent( QMouseEvent * ); 00179 virtual void focusInEvent( QFocusEvent * ); 00180 virtual void focusOutEvent( QFocusEvent * ); 00181 virtual void viewportMouseDoubleClickEvent( QMouseEvent * ); 00182 virtual void viewportMouseMoveEvent(QMouseEvent *); 00183 virtual void viewportMouseReleaseEvent(QMouseEvent *); 00184 virtual void viewportResizeEvent(QResizeEvent*); 00185 #ifndef QT_NO_WHEELEVENT 00186 virtual void viewportWheelEvent(QWheelEvent*); 00187 #endif 00188 virtual void dragEnterEvent( QDragEnterEvent* ); 00189 virtual void dropEvent( QDropEvent* ); 00190 virtual void closeEvent ( QCloseEvent * ); 00191 virtual bool eventFilter(QObject *, QEvent *); 00192 00193 void keyPressEvent( QKeyEvent *_ke ); 00194 void keyReleaseEvent ( QKeyEvent *_ke ); 00195 void contentsContextMenuEvent ( QContextMenuEvent *_ce ); 00196 void doAutoScroll(); 00197 00198 void timerEvent ( QTimerEvent * ); 00199 00200 protected slots: 00201 void slotPaletteChanged(); 00202 void slotScrollBarMoved(); 00203 00204 private slots: 00205 void tripleClickTimeout(); 00206 00207 private: 00208 void scheduleRelayout(khtml::RenderObject* clippedObj=0); 00209 void unscheduleRelayout(); 00210 00211 void scheduleRepaint(int x, int y, int w, int h); 00212 void unscheduleRepaint(); 00213 00214 void closeChildDialogs(); 00215 bool dialogsAllowed(); 00216 00225 void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0); 00226 00237 void setMediaType( const QString &medium ); 00238 QString mediaType() const; 00239 00240 bool scrollTo(const QRect &); 00241 00242 void focusNextPrevNode(bool next); 00243 bool handleAccessKey(const QKeyEvent* ev); 00244 bool focusNodeWithAccessKey(QChar c, KHTMLView* caller = NULL); 00245 00246 void useSlowRepaints(); 00247 00248 void setIgnoreWheelEvents(bool e); 00249 00250 void init(); 00251 00252 DOM::NodeImpl *nodeUnderMouse() const; 00253 00254 void restoreScrollBar(); 00255 00256 QStringList formCompletionItems(const QString &name) const; 00257 void clearCompletionHistory(const QString& name); 00258 void addFormCompletionItem(const QString &name, const QString &value); 00259 00260 void addNonPasswordStorableSite( const QString& host ); 00261 bool nonPasswordStorableSite( const QString& host ) const; 00262 00263 bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool cancelable, 00264 int detail,QMouseEvent *_mouse, bool setUnder, 00265 int mouseEventType); 00266 bool dispatchKeyEvent( QKeyEvent *_ke ); 00267 bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress ); 00268 00269 void complete(); 00270 00271 #ifndef KHTML_NO_CARET 00272 // -- caret-related member functions (for caretMode as well as designMode) 00273 00284 void initCaret(bool keepSelection = false); 00287 bool caretOverrides() const; 00295 void ensureNodeHasFocus(DOM::NodeImpl *node); 00302 void recalcAndStoreCaretPos(khtml::InlineBox *hintBox = 0); 00309 void caretOn(); 00315 void caretOff(); 00324 void showCaret(bool forceRepaint = false); 00331 void hideCaret(); 00336 void ensureCaretVisible(); 00337 00353 bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset, 00354 DOM::NodeImpl *endNode, long endOffset); 00355 00365 bool placeCaret(khtml::InlineBox *hintBox = 0); 00366 00383 bool extendSelection(DOM::NodeImpl *startNode, long startOffset, 00384 DOM::NodeImpl *endNode, long endOffset); 00385 00395 void updateSelection(DOM::NodeImpl *startNode, long startOffset, 00396 DOM::NodeImpl *endNode, long endOffset); 00397 00402 int caretDisplayPolicyNonFocused() const; 00403 00410 void setCaretDisplayPolicyNonFocused(int policy); 00411 00412 // -- caret event handler 00413 00417 void caretKeyPressEvent(QKeyEvent *); 00418 00419 // -- caret navigation member functions 00420 00432 bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection); 00433 00439 enum CaretMovement { CaretByCharacter, CaretByWord }; 00440 00451 void moveCaretBy(bool next, CaretMovement cmv, int n); 00452 00456 void moveCaretByLine(bool next, int n); 00457 00462 void moveCaretToLineBoundary(bool end); 00463 00468 void moveCaretToDocumentBoundary(bool end); 00469 00478 void placeCaretOnChar(khtml::InlineBox *hintBox); 00479 00496 void placeCaretOnLine(khtml::InlineBox *caretBox, int x, int absx, int absy); 00497 00501 void moveCaretByPage(bool next); 00502 00505 void moveCaretPrevWord(); 00506 00509 void moveCaretNextWord(); 00510 00515 void moveCaretPrevLine(int n = 1); 00516 00521 void moveCaretNextLine(int n = 1); 00522 00525 void moveCaretPrevPage(); 00526 00529 void moveCaretNextPage(); 00530 00533 void moveCaretToLineBegin(); 00534 00537 void moveCaretToLineEnd(); 00538 00539 #endif // KHTML_NO_CARET 00540 00541 // ------------------------------------- member variables ------------------------------------ 00542 private: 00543 00544 void setWidgetVisible(::khtml::RenderWidget*, bool visible); 00545 00546 int _width; 00547 int _height; 00548 00549 int _marginWidth; 00550 int _marginHeight; 00551 00552 KHTMLPart *m_part; 00553 KHTMLViewPrivate *d; 00554 00555 QString m_medium; // media type 00556 }; 00557 00558 #endif 00559
KDE Logo
This file is part of the documentation for khtml Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:56:29 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003