# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 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
    00036 namespace DOM {
    00037     class HTMLDocumentImpl;
    00038     class DocumentImpl;
    00039     class ElementImpl;
    00040     class HTMLElementImpl;
    00041     class HTMLTitleElementImpl;
    00042     class HTMLGenericFormElementImpl;
    00043     class HTMLFormElementImpl;
    00044     class HTMLAnchorElementImpl;
    00045     class HTMLInputElementImpl;
    00046     class Range;
    00047     class NodeImpl;
    00048     class CSSProperty;
    00049 }
    00050
    00051 namespace KJS {
    00052     class WindowFunc;
    00053     class ExternalFunc;
    00054 }
    00055
    00056 namespace khtml {
    00057     class RenderObject;
    00058     class RenderCanvas;
    00059     class RenderStyle;
    00060     class RenderLineEdit;
    00061     class RenderPartObject;
    00062     class RenderWidget;
    00063     class CSSStyleSelector;
    00064     class LineEditWidget;
    00065     class CaretBox;
    00066     void applyRule(DOM::CSSProperty *prop);
    00067 }
    00068
    00069 class KHTMLPart;
    00070 class KHTMLViewPrivate;
    00071
    00077 class KHTML_EXPORT KHTMLView : public QScrollView
    00078 {
    00079     Q_OBJECT
    00080
    00081     friend class DOM::HTMLDocumentImpl;
    00082     friend class DOM::HTMLTitleElementImpl;
    00083     friend class DOM::HTMLGenericFormElementImpl;
    00084     friend class DOM::HTMLFormElementImpl;
    00085     friend class DOM::HTMLAnchorElementImpl;
    00086     friend class DOM::HTMLInputElementImpl;
    00087     friend class DOM::DocumentImpl;
    00088     friend class KHTMLPart;
    00089     friend class khtml::RenderCanvas;
    00090     friend class khtml::RenderObject;
    00091     friend class khtml::RenderLineEdit;
    00092     friend class khtml::RenderPartObject;
    00093     friend class khtml::RenderWidget;
    00094     friend class khtml::CSSStyleSelector;
    00095     friend class khtml::LineEditWidget;
    00096     friend class KJS::WindowFunc;
    00097     friend class KJS::ExternalFunc;
    00098     friend void khtml::applyRule(DOM::CSSProperty *prop);
    00099
    00100
    00101 public:
    00105     KHTMLView( KHTMLPart *part, QWidget *parent, const char *name=0 );
    00106     virtual ~KHTMLView();
    00107
    00112     KHTMLPart *part() const { return m_part; }
    00113
    00114     int frameWidth() const { return _width; }
    00115
    00119     void setMarginWidth(int x);
    00120
    00126     int marginWidth() const { return _marginWidth; }
    00127
    00128     /*
    00129      * Sets a margin in y direction.
    00130      */
    00131     void setMarginHeight(int y);
    00132
    00138     int marginHeight() { return _marginHeight; }
    00139
    00143     virtual void setVScrollBarMode ( ScrollBarMode mode );
    00144
    00148     virtual void setHScrollBarMode ( ScrollBarMode mode );
    00149
    00153     void print();
    00154
    00159     void print( bool quick ); // KDE 4.0: merge with above
    00160
    00164     void layout(); // KDE 4.0: make private
    00168     void displayAccessKeys();
    00169
    00170
    00171
    00172 signals:
    00173     void finishedLayout();
    00174     void cleared();
    00175     void zoomView( int );
    00176     void hideAccessKeys();
    00177     void repaintAccessKeys();
    00178
    00179 protected:
    00180     void clear();
    00181
    00182     virtual void resizeEvent ( QResizeEvent * event );
    00183     virtual void showEvent ( QShowEvent * );
    00184     virtual void hideEvent ( QHideEvent *);
    00185     virtual bool focusNextPrevChild( bool next );
    00186     virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
    00187     virtual void drawContents( QPainter* );
    00188     virtual void viewportMousePressEvent( QMouseEvent * );
    00189     virtual void focusInEvent( QFocusEvent * );
    00190     virtual void focusOutEvent( QFocusEvent * );
    00191     virtual void viewportMouseDoubleClickEvent( QMouseEvent * );
    00192     virtual void viewportMouseMoveEvent(QMouseEvent *);
    00193     virtual void viewportMouseReleaseEvent(QMouseEvent *);
    00194     virtual void viewportResizeEvent(QResizeEvent*);
    00195 #ifndef QT_NO_WHEELEVENT
    00196     virtual void viewportWheelEvent(QWheelEvent*);
    00197 #endif
    00198     virtual void dragEnterEvent( QDragEnterEvent* );
    00199     virtual void dropEvent( QDropEvent* );
    00200     virtual void closeEvent ( QCloseEvent * );
    00201     virtual bool eventFilter(QObject *, QEvent *);
    00202
    00203     void keyPressEvent( QKeyEvent *_ke );
    00204     void keyReleaseEvent ( QKeyEvent *_ke );
    00205     void contentsContextMenuEvent ( QContextMenuEvent *_ce );
    00206     void doAutoScroll();
    00207     void timerEvent ( QTimerEvent * );
    00208
    00209 protected slots:
    00210     void slotPaletteChanged();
    00211     void slotScrollBarMoved();
    00212
    00213 private slots:
    00214     void tripleClickTimeout();
    00215     void findTimeout();
    00216     void accessKeysTimeout();
    00217
    00223     void slotMouseScrollTimer();
    00224
    00225 private:
    00226
    00227     void scheduleRelayout(khtml::RenderObject* clippedObj=0);
    00228     void unscheduleRelayout();
    00229
    00230     void scheduleRepaint(int x, int y, int w, int h, bool asap=false);
    00231     void unscheduleRepaint();
    00232
    00233     bool needsFullRepaint() const;
    00234
    00235     void closeChildDialogs();
    00236     bool dialogsAllowed();
    00237
    00246     void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
    00247
    00258     void setMediaType( const QString &medium );
    00259     QString mediaType() const;
    00260
    00261     bool scrollTo(const QRect &);
    00262
    00263     bool focusNextPrevNode(bool next);
    00264     bool handleAccessKey(const QKeyEvent* ev);
    00265     bool focusNodeWithAccessKey(QChar c, KHTMLView* caller = NULL);
    00266
    00267     void useSlowRepaints();
    00268
    00269     void setIgnoreWheelEvents(bool e);
    00270
    00271     void init();
    00272
    00273     DOM::NodeImpl *nodeUnderMouse() const;
    00274     DOM::NodeImpl *nonSharedNodeUnderMouse() const;
    00275
    00276     void restoreScrollBar();
    00277
    00278     QStringList formCompletionItems(const QString &name) const;
    00279     void clearCompletionHistory(const QString& name);
    00280     void addFormCompletionItem(const QString &name, const QString &value);
    00281
    00282     void addNonPasswordStorableSite( const QString& host );
    00283     bool nonPasswordStorableSite( const QString& host ) const;
    00284
    00285     bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode,
    00286                 DOM::NodeImpl *targetNodeNonShared, bool cancelable,
    00287                 int detail,QMouseEvent *_mouse, bool setUnder,
    00288                 int mouseEventType);
    00289     bool dispatchKeyEvent( QKeyEvent *_ke );
    00290     bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress );
    00291
    00292     void complete( bool pendingAction );
    00293
    00294 #ifndef KHTML_NO_TYPE_AHEAD_FIND
    00295     void findAhead(bool increase);
    00296     void updateFindAheadTimeout();
    00297 #endif // KHTML_NO_TYPE_AHEAD_FIND
    00298
    00299 #ifndef KHTML_NO_CARET
    00300     // -- caret-related member functions (for caretMode as well as designMode)
    00301
    00312     void initCaret(bool keepSelection = false);
    00315     bool caretOverrides() const;
    00323     void ensureNodeHasFocus(DOM::NodeImpl *node);
    00330     void recalcAndStoreCaretPos(khtml::CaretBox *hintBox = 0);
    00337     void caretOn();
    00343     void caretOff();
    00352     void showCaret(bool forceRepaint = false);
    00359     void hideCaret();
    00364     void ensureCaretVisible();
    00365
    00381     bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset,
    00382                     DOM::NodeImpl *endNode, long endOffset);
    00383
    00393     bool placeCaret(khtml::CaretBox *hintBox = 0);
    00394
    00411     bool extendSelection(DOM::NodeImpl *startNode, long startOffset,
    00412                 DOM::NodeImpl *endNode, long endOffset);
    00413
    00423     void updateSelection(DOM::NodeImpl *startNode, long startOffset,
    00424             DOM::NodeImpl *endNode, long endOffset);
    00425
    00430     int caretDisplayPolicyNonFocused() const;
    00431
    00438     void setCaretDisplayPolicyNonFocused(int policy);
    00439
    00440     // -- caret event handler
    00441
    00445     void caretKeyPressEvent(QKeyEvent *);
    00446
    00447     // -- caret navigation member functions
    00448
    00460     bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection);
    00461
    00467     enum CaretMovement { CaretByCharacter, CaretByWord };
    00468
    00479     void moveCaretBy(bool next, CaretMovement cmv, int n);
    00480
    00483     void moveCaretByLine(bool next, int n);
    00484
    00489     void moveCaretToLineBoundary(bool end);
    00490
    00495     void moveCaretToDocumentBoundary(bool end);
    00496
    00505     void placeCaretOnChar(khtml::CaretBox *hintBox);
    00506
    00523     void placeCaretOnLine(khtml::CaretBox *caretBox, int x, int absx, int absy);
    00524
    00528     void moveCaretByPage(bool next);
    00529
    00532     void moveCaretPrevWord();
    00533
    00536     void moveCaretNextWord();
    00537
    00542     void moveCaretPrevLine(int n = 1);
    00543
    00548     void moveCaretNextLine(int n = 1);
    00549
    00552     void moveCaretPrevPage();
    00553
    00556     void moveCaretNextPage();
    00557
    00560     void moveCaretToLineBegin();
    00561
    00564     void moveCaretToLineEnd();
    00565
    00566 #endif // KHTML_NO_CARET
    00567
    00568     // ------------------------------------- member variables ------------------------------------
    00569  private:
    00570
    00571     void setWidgetVisible(::khtml::RenderWidget*, bool visible);
    00572
    00573     int _width;
    00574     int _height;
    00575
    00576     int _marginWidth;
    00577     int _marginHeight;
    00578
    00579     KHTMLPart *m_part;
    00580     KHTMLViewPrivate *d;
    00581
    00582     QString m_medium;   // media type
    00583 };
    00584
    00585 #endif
    00586

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:16 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003