• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • 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              (C) 2006 Germain Garand (germain@ebooksfrance.org)
00009 
00010    This library is free software; you can redistribute it and/or
00011    modify it under the terms of the GNU Library General Public
00012    License as published by the Free Software Foundation; either
00013    version 2 of the License, or (at your option) any later version.
00014 
00015    This library is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018    Library General Public License for more details.
00019 
00020    You should have received a copy of the GNU Library General Public License
00021    along with this library; see the file COPYING.LIB.  If not, write to
00022    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00023    Boston, MA 02110-1301, USA.
00024 */
00025 
00026 #ifndef KHTMLVIEW_H
00027 #define KHTMLVIEW_H
00028 
00029 #include <khtml_export.h>
00030 
00031 // qt includes and classes
00032 #include <QtGui/QScrollArea>
00033 
00034 class QPainter;
00035 class QRect;
00036 template< typename T > class QVector;
00037 template <class T> class QStack;
00038 
00039 namespace DOM {
00040     class HTMLDocumentImpl;
00041     class DocumentImpl;
00042     class ElementImpl;
00043     class HTMLTitleElementImpl;
00044     class HTMLGenericFormElementImpl;
00045     class HTMLFormElementImpl;
00046     class HTMLAnchorElementImpl;
00047     class HTMLInputElementImpl;
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 RenderLineEdit;
00061     class RenderPartObject;
00062     class RenderWidget;
00063     class RenderLayer;
00064     class RenderBox;
00065     class CSSStyleSelector;
00066     class LineEditWidget;
00067     class CaretBox;
00068     class KHTMLWidgetPrivate;
00069     class KHTMLWidget
00070     {
00071     public:
00072         KHTMLWidget();
00073         ~KHTMLWidget();
00074         KHTMLWidgetPrivate* m_kwp;
00075     };
00076     void applyRule(DOM::CSSProperty *prop);
00077 }
00078 
00079 class KHTMLPart;
00080 class KHTMLViewPrivate;
00081 
00082 namespace khtml {
00083 
00084 }
00085 
00091 class KHTML_EXPORT KHTMLView : public QScrollArea, public khtml::KHTMLWidget
00092 {
00093     Q_OBJECT
00094 
00095     friend class DOM::HTMLDocumentImpl;
00096     friend class DOM::HTMLTitleElementImpl;
00097     friend class DOM::HTMLGenericFormElementImpl;
00098     friend class DOM::HTMLFormElementImpl;
00099     friend class DOM::HTMLAnchorElementImpl;
00100     friend class DOM::HTMLInputElementImpl;
00101     friend class DOM::NodeImpl;
00102     friend class DOM::DocumentImpl;
00103     friend class KHTMLPart;
00104     friend class khtml::RenderCanvas;
00105     friend class khtml::RenderObject;
00106     friend class khtml::RenderLineEdit;
00107     friend class khtml::RenderPartObject;
00108     friend class khtml::RenderWidget;
00109     friend class khtml::RenderLayer;
00110     friend class khtml::RenderBox;
00111     friend class khtml::CSSStyleSelector;
00112     friend class khtml::LineEditWidget;
00113     friend class KJS::WindowFunc;
00114     friend class KJS::ExternalFunc;
00115     friend void khtml::applyRule(DOM::CSSProperty *prop);
00116 
00117 
00118 public:
00122     KHTMLView( KHTMLPart *part, QWidget *parent );
00123     virtual ~KHTMLView();
00124 
00129     KHTMLPart *part() const { return m_part; }
00130 
00131     int frameWidth() const { return _width; }
00132 
00136     void setMarginWidth(int x);
00137 
00143     int marginWidth() const { return _marginWidth; }
00144 
00145     /*
00146      * Sets a margin in y direction.
00147      */
00148     void setMarginHeight(int y);
00149 
00155     int marginHeight() { return _marginHeight; }
00156 
00164     virtual void setVerticalScrollBarPolicy( Qt::ScrollBarPolicy policy );
00165 
00173     virtual void setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy policy );
00174 
00179     void print( bool quick = false );
00180 
00184     void displayAccessKeys();
00185 
00189     int contentsWidth() const;
00190 
00194     int contentsHeight() const;
00195 
00200     int contentsX() const;
00201 
00206     int contentsY() const;
00207 
00211     int visibleWidth() const;
00212 
00216     int visibleHeight() const;
00217 
00222     void setContentsPos(int x, int y);
00223 
00229     QPoint contentsToViewport(const QPoint& p) const;
00230 
00236     QPoint viewportToContents(const QPoint& p) const;
00237 
00246     void viewportToContents(int x, int y, int& cx, int& cy) const;
00247 
00256     void contentsToViewport(int x, int y, int& cx, int& cy) const;
00257 
00263     void scrollBy(int x, int y);
00264 
00269     void updateContents( const QRect& r );
00270     void updateContents(int x, int y, int w, int h);
00271 
00272     void addChild(QWidget *child, int dx, int dy);
00273 
00278     void repaintContents( const QRect& r );
00279     void repaintContents(int x, int y, int w, int h);
00280 
00285     void setZoomLevel( int percent );
00286 
00291     int zoomLevel() const;
00292 
00299     enum SmoothScrollingMode { SSMDisabled = 0, SSMWhenEfficient, SSMEnabled };
00300 
00309     void setSmoothScrollingMode( SmoothScrollingMode m );
00310 
00316     SmoothScrollingMode smoothScrollingMode() const;
00317 
00318 public Q_SLOTS:
00324     virtual void resizeContents(int w, int h);
00325 
00329     void layout();
00330 
00331 
00332 Q_SIGNALS:
00337     void finishedLayout();
00338     void cleared();
00339     void zoomView( int );
00340     void hideAccessKeys();
00341     void repaintAccessKeys();
00342     void findAheadActive( bool );
00343 
00344 protected:
00345     void clear();
00346 
00347     virtual bool event ( QEvent * event );
00348     virtual void paintEvent( QPaintEvent * );
00349     virtual void resizeEvent ( QResizeEvent * event );
00350     virtual void showEvent ( QShowEvent * );
00351     virtual void hideEvent ( QHideEvent *);
00352     virtual bool focusNextPrevChild( bool next );
00353     virtual void mousePressEvent( QMouseEvent * );
00354     virtual void focusInEvent( QFocusEvent * );
00355     virtual void focusOutEvent( QFocusEvent * );
00356     virtual void mouseDoubleClickEvent( QMouseEvent * );
00357     virtual void mouseMoveEvent(QMouseEvent *);
00358     virtual void mouseReleaseEvent(QMouseEvent *);
00359 #ifndef QT_NO_WHEELEVENT
00360     virtual void wheelEvent(QWheelEvent*);
00361 #endif
00362     virtual void dragEnterEvent( QDragEnterEvent* );
00363     virtual void dropEvent( QDropEvent* );
00364     virtual void closeEvent ( QCloseEvent * );
00365     virtual bool widgetEvent( QEvent * );
00366     virtual bool viewportEvent( QEvent * e );
00367     virtual bool eventFilter(QObject *, QEvent *);
00368     virtual void scrollContentsBy( int dx, int dy );
00369 
00370     void keyPressEvent( QKeyEvent *_ke );
00371     void keyReleaseEvent ( QKeyEvent *_ke );
00372     void doAutoScroll();
00373     void timerEvent ( QTimerEvent * );
00374 
00375     void setSmoothScrollingModeDefault( SmoothScrollingMode m );
00376 
00377 protected Q_SLOTS:
00378     void slotPaletteChanged();
00379 
00380 private Q_SLOTS:
00381     void tripleClickTimeout();
00382     void findTimeout();
00383     void accessKeysTimeout();
00384     void scrollTick();
00385 
00390     void slotMouseScrollTimer();
00391 
00392 private:
00393     void resizeContentsToViewport();
00394 
00395     void scheduleRelayout(khtml::RenderObject* clippedObj=0);
00396     void unscheduleRelayout();
00397 
00398     void scheduleRepaint(int x, int y, int w, int h, bool asap=false);
00399     void unscheduleRepaint();
00400 
00401     bool needsFullRepaint() const;
00402 
00403     void closeChildDialogs();
00404     bool dialogsAllowed();
00405 
00406     void setMouseEventsTarget( QWidget* w );
00407     QWidget* mouseEventsTarget() const;
00408 
00409     QStack<QRegion>* clipHolder() const;
00410     void setClipHolder( QStack<QRegion>* ch );
00411 
00412     void setPart(KHTMLPart *part);
00413 
00422     void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
00423 
00424     void render(QPainter *p, const QRect& r, const QPoint& off);
00425 
00436     void setMediaType( const QString &medium );
00437     QString mediaType() const;
00438 
00439     bool pagedMode() const;
00440 
00441     bool scrollTo(const QRect &);
00442 
00443     bool focusNextPrevNode(bool next);
00444     bool handleAccessKey(const QKeyEvent* ev);
00445     bool focusNodeWithAccessKey(QChar c, KHTMLView* caller = NULL);
00446     QMap< DOM::ElementImpl*, QChar > buildFallbackAccessKeys() const;
00447     void displayAccessKeys( KHTMLView* caller, KHTMLView* origview, QVector< QChar >& taken, bool use_fallbacks );
00448     bool isScrollingFromMouseWheel() const;
00449     void setHasStaticBackground(bool partial=false);
00450     void setHasNormalBackground();
00451     void addStaticObject(bool fixed);
00452     void removeStaticObject(bool fixed);
00453     void applyTransforms( int& x, int& y, int& w, int& h) const;
00454     void revertTransforms( int& x, int& y, int& w, int& h) const;
00455     void revertTransforms( int& x, int& y ) const;
00456     void checkExternalWidgetsPosition();
00457 
00458     void setIgnoreWheelEvents(bool e);
00459 
00460     void init();
00461 
00462     DOM::NodeImpl *nodeUnderMouse() const;
00463     DOM::NodeImpl *nonSharedNodeUnderMouse() const;
00464 
00465     void restoreScrollBar();
00466 
00467     QStringList formCompletionItems(const QString &name) const;
00468     void clearCompletionHistory(const QString& name);
00469     void addFormCompletionItem(const QString &name, const QString &value);
00470 
00471     void addNonPasswordStorableSite( const QString& host );
00472     bool nonPasswordStorableSite( const QString& host ) const;
00473 
00474     bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode,
00475                 DOM::NodeImpl *targetNodeNonShared, bool cancelable,
00476                 int detail,QMouseEvent *_mouse, bool setUnder,
00477                 int mouseEventType, int orientation=0);
00478     bool dispatchKeyEvent( QKeyEvent *_ke );
00479     bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress );
00480 
00481     void complete( bool pendingAction );
00482 
00483     void updateScrollBars();
00484     void setupSmoothScrolling(int dx, int dy);
00485 
00486 #ifndef KHTML_NO_TYPE_AHEAD_FIND
00487     void findAhead(bool increase);
00488     void updateFindAheadTimeout();
00489     void startFindAhead( bool linksOnly );
00490 #endif // KHTML_NO_TYPE_AHEAD_FIND
00491 
00496     int caretDisplayPolicyNonFocused() const;
00497 
00503     void setCaretDisplayPolicyNonFocused(int policy);
00504 
00505     // -- caret event handler
00506 
00511     bool caretKeyPressEvent(QKeyEvent *);
00512 
00513     // ------------------------------------- member variables ------------------------------------
00514  private:
00515     friend class KHTMLViewPrivate;
00516     enum LinkCursor { LINK_NORMAL, LINK_MAILTO, LINK_NEWWINDOW };
00517 
00518     void setWidgetVisible(::khtml::RenderWidget*, bool visible);
00519 
00520 
00521     int _width;
00522     int _height;
00523 
00524     int _marginWidth;
00525     int _marginHeight;
00526 
00527     KHTMLPart *m_part;
00528     KHTMLViewPrivate* const d;
00529 
00530     QString m_medium;   // media type
00531 };
00532 
00533 #endif
00534 

KHTML

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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