• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KHTML

khtmlview.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00022    Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #ifndef KHTMLVIEW_H
00026 #define KHTMLVIEW_H
00027 
00028 // qt includes and classes
00029 #include <qscrollview.h>
00030 
00031 #include <kdelibs_export.h>
00032 
00033 class QPainter;
00034 class QRect;
00035 template< typename T > class QValueVector;
00036 
00037 namespace DOM {
00038     class HTMLDocumentImpl;
00039     class DocumentImpl;
00040     class ElementImpl;
00041     class HTMLElementImpl;
00042     class HTMLTitleElementImpl;
00043     class HTMLGenericFormElementImpl;
00044     class HTMLFormElementImpl;
00045     class HTMLAnchorElementImpl;
00046     class HTMLInputElementImpl;
00047     class Range;
00048     class NodeImpl;
00049     class CSSProperty;
00050 }
00051 
00052 namespace KJS {
00053     class WindowFunc;
00054     class ExternalFunc;
00055 }
00056 
00057 namespace khtml {
00058     class RenderObject;
00059     class RenderCanvas;
00060     class RenderStyle;
00061     class RenderLineEdit;
00062     class RenderPartObject;
00063     class RenderWidget;
00064     class CSSStyleSelector;
00065     class LineEditWidget;
00066     class CaretBox;
00067     void applyRule(DOM::CSSProperty *prop);
00068 }
00069 
00070 class KHTMLPart;
00071 class KHTMLViewPrivate;
00072 
00078 class KHTML_EXPORT KHTMLView : public QScrollView
00079 {
00080     Q_OBJECT
00081 
00082     friend class DOM::HTMLDocumentImpl;
00083     friend class DOM::HTMLTitleElementImpl;
00084     friend class DOM::HTMLGenericFormElementImpl;
00085     friend class DOM::HTMLFormElementImpl;
00086     friend class DOM::HTMLAnchorElementImpl;
00087     friend class DOM::HTMLInputElementImpl;
00088     friend class DOM::DocumentImpl;
00089     friend class KHTMLPart;
00090     friend class khtml::RenderCanvas;
00091     friend class khtml::RenderObject;
00092     friend class khtml::RenderLineEdit;
00093     friend class khtml::RenderPartObject;
00094     friend class khtml::RenderWidget;
00095     friend class khtml::CSSStyleSelector;
00096     friend class khtml::LineEditWidget;
00097     friend class KJS::WindowFunc;
00098     friend class KJS::ExternalFunc;
00099     friend void khtml::applyRule(DOM::CSSProperty *prop);
00100 
00101 
00102 public:
00106     KHTMLView( KHTMLPart *part, QWidget *parent, const char *name=0 );
00107     virtual ~KHTMLView();
00108 
00113     KHTMLPart *part() const { return m_part; }
00114 
00115     int frameWidth() const { return _width; }
00116 
00120     void setMarginWidth(int x);
00121 
00127     int marginWidth() const { return _marginWidth; }
00128 
00129     /*
00130      * Sets a margin in y direction.
00131      */
00132     void setMarginHeight(int y);
00133 
00139     int marginHeight() { return _marginHeight; }
00140 
00144     virtual void setVScrollBarMode ( ScrollBarMode mode );
00145 
00149     virtual void setHScrollBarMode ( ScrollBarMode mode );
00150 
00154     void print();
00155 
00160     void print( bool quick ); // KDE 4.0: merge with above
00161 
00165     void layout(); // KDE 4.0: make private
00169     void displayAccessKeys();
00170 
00171 
00172 
00173 signals:
00178     void finishedLayout();
00179     void cleared();
00180     void zoomView( int );
00181     void hideAccessKeys();
00182     void repaintAccessKeys();
00183     void findAheadActive( bool );
00184 
00185 protected:
00186     void clear();
00187 
00188     virtual void resizeEvent ( QResizeEvent * event );
00189     virtual void showEvent ( QShowEvent * );
00190     virtual void hideEvent ( QHideEvent *);
00191     virtual bool focusNextPrevChild( bool next );
00192     virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
00193     virtual void drawContents( QPainter* );
00194     virtual void viewportMousePressEvent( QMouseEvent * );
00195     virtual void focusInEvent( QFocusEvent * );
00196     virtual void focusOutEvent( QFocusEvent * );
00197     virtual void viewportMouseDoubleClickEvent( QMouseEvent * );
00198     virtual void viewportMouseMoveEvent(QMouseEvent *);
00199     virtual void viewportMouseReleaseEvent(QMouseEvent *);
00200     virtual void viewportResizeEvent(QResizeEvent*);
00201 #ifndef QT_NO_WHEELEVENT
00202     virtual void viewportWheelEvent(QWheelEvent*);
00203 #endif
00204     virtual void dragEnterEvent( QDragEnterEvent* );
00205     virtual void dropEvent( QDropEvent* );
00206     virtual void closeEvent ( QCloseEvent * );
00207     virtual bool eventFilter(QObject *, QEvent *);
00208 
00209     void keyPressEvent( QKeyEvent *_ke );
00210     void keyReleaseEvent ( QKeyEvent *_ke );
00211     void contentsContextMenuEvent ( QContextMenuEvent *_ce );
00212     void doAutoScroll();
00213     void timerEvent ( QTimerEvent * );
00214 protected slots:
00215     void slotPaletteChanged();
00216     void slotScrollBarMoved();
00217 
00218 private slots:
00219     void tripleClickTimeout();
00220     void findTimeout();
00221     void accessKeysTimeout();
00222 
00228     void slotMouseScrollTimer();
00229 
00230 private:
00231 
00232     void scheduleRelayout(khtml::RenderObject* clippedObj=0);
00233     void unscheduleRelayout();
00234 
00235     void scheduleRepaint(int x, int y, int w, int h, bool asap=false);
00236     void unscheduleRepaint();
00237 
00238     bool needsFullRepaint() const;
00239 
00240     void closeChildDialogs();
00241     bool dialogsAllowed();
00242 
00251     void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
00252 
00253 #if 0
00254 
00258     void paint(QPainter *p, int width);
00259 #endif
00260 
00271     void setMediaType( const QString &medium );
00272     QString mediaType() const;
00273 
00274     bool pagedMode() const;
00275 
00276     bool scrollTo(const QRect &);
00277 
00278     bool focusNextPrevNode(bool next);
00279     bool handleAccessKey(const QKeyEvent* ev);
00280     bool focusNodeWithAccessKey(QChar c, KHTMLView* caller = NULL);
00281     QMap< DOM::ElementImpl*, QChar > buildFallbackAccessKeys() const;
00282     void displayAccessKeys( KHTMLView* caller, KHTMLView* origview, QValueVector< QChar >& taken, bool use_fallbacks );
00283 
00284     void useSlowRepaints();
00285 
00286     void setIgnoreWheelEvents(bool e);
00287 
00288     void init();
00289 
00290     DOM::NodeImpl *nodeUnderMouse() const;
00291     DOM::NodeImpl *nonSharedNodeUnderMouse() const;
00292 
00293     void restoreScrollBar();
00294 
00295     QStringList formCompletionItems(const QString &name) const;
00296     void clearCompletionHistory(const QString& name);
00297     void addFormCompletionItem(const QString &name, const QString &value);
00298 
00299     void addNonPasswordStorableSite( const QString& host );
00300     bool nonPasswordStorableSite( const QString& host ) const;
00301 
00302     bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode,
00303                 DOM::NodeImpl *targetNodeNonShared, bool cancelable,
00304                 int detail,QMouseEvent *_mouse, bool setUnder,
00305                 int mouseEventType);
00306     bool dispatchKeyEvent( QKeyEvent *_ke );
00307     bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress );
00308 
00309     void complete( bool pendingAction );
00310 
00311 #ifndef KHTML_NO_TYPE_AHEAD_FIND
00312     void findAhead(bool increase);
00313     void updateFindAheadTimeout();
00314     void startFindAhead( bool linksOnly );
00315 #endif // KHTML_NO_TYPE_AHEAD_FIND
00316 
00317 #ifndef KHTML_NO_CARET
00318     // -- caret-related member functions (for caretMode as well as designMode)
00319 
00330     void initCaret(bool keepSelection = false);
00333     bool caretOverrides() const;
00341     void ensureNodeHasFocus(DOM::NodeImpl *node);
00348     void recalcAndStoreCaretPos(khtml::CaretBox *hintBox = 0);
00355     void caretOn();
00361     void caretOff();
00370     void showCaret(bool forceRepaint = false);
00377     void hideCaret();
00382     void ensureCaretVisible();
00383 
00399     bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset,
00400                     DOM::NodeImpl *endNode, long endOffset);
00401 
00411     bool placeCaret(khtml::CaretBox *hintBox = 0);
00412 
00429     bool extendSelection(DOM::NodeImpl *startNode, long startOffset,
00430                 DOM::NodeImpl *endNode, long endOffset);
00431 
00441     void updateSelection(DOM::NodeImpl *startNode, long startOffset,
00442             DOM::NodeImpl *endNode, long endOffset);
00443 
00448     int caretDisplayPolicyNonFocused() const;
00449 
00456     void setCaretDisplayPolicyNonFocused(int policy);
00457 
00458     // -- caret event handler
00459 
00463     void caretKeyPressEvent(QKeyEvent *);
00464 
00465     // -- caret navigation member functions
00466 
00478     bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection);
00479 
00485     enum CaretMovement { CaretByCharacter, CaretByWord };
00486 
00497     void moveCaretBy(bool next, CaretMovement cmv, int n);
00498 
00501     void moveCaretByLine(bool next, int n);
00502 
00507     void moveCaretToLineBoundary(bool end);
00508 
00513     void moveCaretToDocumentBoundary(bool end);
00514 
00523     void placeCaretOnChar(khtml::CaretBox *hintBox);
00524 
00541     void placeCaretOnLine(khtml::CaretBox *caretBox, int x, int absx, int absy);
00542 
00546     void moveCaretByPage(bool next);
00547 
00550     void moveCaretPrevWord();
00551 
00554     void moveCaretNextWord();
00555 
00560     void moveCaretPrevLine(int n = 1);
00561 
00566     void moveCaretNextLine(int n = 1);
00567 
00570     void moveCaretPrevPage();
00571 
00574     void moveCaretNextPage();
00575 
00578     void moveCaretToLineBegin();
00579 
00582     void moveCaretToLineEnd();
00583 
00584 #endif // KHTML_NO_CARET
00585 
00586     // ------------------------------------- member variables ------------------------------------
00587  private:
00588 
00589     void setWidgetVisible(::khtml::RenderWidget*, bool visible);
00590 
00591     int _width;
00592     int _height;
00593 
00594     int _marginWidth;
00595     int _marginHeight;
00596 
00597     KHTMLPart *m_part;
00598     KHTMLViewPrivate *d;
00599 
00600     QString m_medium;   // media type
00601 };
00602 
00603 #endif
00604 

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal