• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
khtmlview.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 1997 Martin Jones (mjones@kde.org)
4  (C) 1998 Waldo Bastian (bastian@kde.org)
5  (C) 1998, 1999 Torben Weis (weis@kde.org)
6  (C) 1999 Lars Knoll (knoll@kde.org)
7  (C) 1999 Antti Koivisto (koivisto@kde.org)
8  (C) 2006 Germain Garand (germain@ebooksfrance.org)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Library General Public
12  License as published by the Free Software Foundation; either
13  version 2 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Library General Public License for more details.
19 
20  You should have received a copy of the GNU Library General Public License
21  along with this library; see the file COPYING.LIB. If not, write to
22  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  Boston, MA 02110-1301, USA.
24 */
25 
26 #ifndef KHTMLVIEW_H
27 #define KHTMLVIEW_H
28 
29 #include <khtml_export.h>
30 
31 // qt includes and classes
32 #include <QtGui/QScrollArea>
33 
34 class QPainter;
35 class QRect;
36 template< typename T > class QVector;
37 template <class T> class QStack;
38 
39 namespace DOM {
40  class HTMLDocumentImpl;
41  class DocumentImpl;
42  class ElementImpl;
43  class HTMLTitleElementImpl;
44  class HTMLGenericFormElementImpl;
45  class HTMLFormElementImpl;
46  class HTMLAnchorElementImpl;
47  class HTMLInputElementImpl;
48  class NodeImpl;
49  class CSSProperty;
50 }
51 
52 namespace KJS {
53  class WindowFunc;
54  class ExternalFunc;
55 }
56 
57 namespace khtml {
58  class RenderObject;
59  class RenderCanvas;
60  class RenderLineEdit;
61  class RenderPartObject;
62  class RenderWidget;
63  class RenderLayer;
64  class RenderBox;
65  class CSSStyleSelector;
66  class LineEditWidget;
67  class CaretBox;
68  class HTMLTokenizer;
69  class KHTMLWidgetPrivate;
70  class KHTMLWidget
71  {
72  public:
73  KHTMLWidget();
74  ~KHTMLWidget();
75  KHTMLWidgetPrivate* m_kwp;
76  };
77  void applyRule(DOM::CSSProperty *prop);
78 }
79 
80 class KHTMLPart;
81 class KHTMLViewPrivate;
82 
83 namespace khtml {
84 
85 }
86 
92 class KHTML_EXPORT KHTMLView : public QScrollArea, public khtml::KHTMLWidget
93 {
94  Q_OBJECT
95 
96  friend class DOM::HTMLDocumentImpl;
97  friend class DOM::HTMLTitleElementImpl;
98  friend class DOM::HTMLGenericFormElementImpl;
99  friend class DOM::HTMLFormElementImpl;
100  friend class DOM::HTMLAnchorElementImpl;
101  friend class DOM::HTMLInputElementImpl;
102  friend class DOM::NodeImpl;
103  friend class DOM::ElementImpl;
104  friend class DOM::DocumentImpl;
105  friend class KHTMLPart;
106  friend class KHTMLFind;
107  friend class StorePass;
108  friend class khtml::RenderCanvas;
109  friend class khtml::RenderObject;
110  friend class khtml::RenderLineEdit;
111  friend class khtml::RenderPartObject;
112  friend class khtml::RenderWidget;
113  friend class khtml::KHTMLWidgetPrivate;
114  friend class khtml::RenderLayer;
115  friend class khtml::RenderBox;
116  friend class khtml::CSSStyleSelector;
117  friend class khtml::LineEditWidget;
118  friend class khtml::HTMLTokenizer;
119  friend class KJS::WindowFunc;
120  friend class KJS::ExternalFunc;
121  friend void khtml::applyRule(DOM::CSSProperty *prop);
122 
123 
124 public:
128  KHTMLView( KHTMLPart *part, QWidget *parent );
129  virtual ~KHTMLView();
130 
135  KHTMLPart *part() const { return m_part; }
136 
137  int frameWidth() const { return _width; }
138 
142  void setMarginWidth(int x);
143 
149  int marginWidth() const { return _marginWidth; }
150 
151  /*
152  * Sets a margin in y direction.
153  */
154  void setMarginHeight(int y);
155 
161  int marginHeight() { return _marginHeight; }
162 
170  virtual void setVerticalScrollBarPolicy( Qt::ScrollBarPolicy policy );
171 
179  virtual void setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy policy );
180 
185  void print( bool quick = false );
186 
190  void displayAccessKeys();
191 
195  int contentsWidth() const;
196 
200  int contentsHeight() const;
201 
206  int contentsX() const;
207 
212  int contentsY() const;
213 
217  int visibleWidth() const;
218 
222  int visibleHeight() const;
223 
228  void setContentsPos(int x, int y);
229 
235  QPoint contentsToViewport(const QPoint& p) const;
236 
242  QPoint viewportToContents(const QPoint& p) const;
243 
252  void viewportToContents(int x, int y, int& cx, int& cy) const;
253 
262  void contentsToViewport(int x, int y, int& cx, int& cy) const;
263 
269  void scrollBy(int x, int y);
270 
275  void updateContents( const QRect& r );
276  void updateContents(int x, int y, int w, int h);
277 
278  void addChild(QWidget *child, int dx, int dy);
279 
284  void repaintContents( const QRect& r );
285  void repaintContents(int x, int y, int w, int h);
286 
291  void setZoomLevel( int percent );
292 
297  int zoomLevel() const;
298 
305  enum SmoothScrollingMode { SSMDisabled = 0, SSMWhenEfficient, SSMEnabled };
306 
315  void setSmoothScrollingMode( SmoothScrollingMode m );
316 
322  SmoothScrollingMode smoothScrollingMode() const;
323 
324 public Q_SLOTS:
330  virtual void resizeContents(int w, int h);
331 
335  void layout();
336 
337 
338 Q_SIGNALS:
343  void finishedLayout();
344  void cleared();
345  void zoomView( int );
346  void hideAccessKeys();
347  void repaintAccessKeys();
348  void findAheadActive( bool );
349 
350 protected:
351  void clear();
352 
353  virtual bool event ( QEvent * event );
354  virtual void paintEvent( QPaintEvent * );
355  virtual void resizeEvent ( QResizeEvent * event );
356  virtual void showEvent ( QShowEvent * );
357  virtual void hideEvent ( QHideEvent *);
358  virtual bool focusNextPrevChild( bool next );
359  virtual void mousePressEvent( QMouseEvent * );
360  virtual void focusInEvent( QFocusEvent * );
361  virtual void focusOutEvent( QFocusEvent * );
362  virtual void mouseDoubleClickEvent( QMouseEvent * );
363  virtual void mouseMoveEvent(QMouseEvent *);
364  virtual void mouseReleaseEvent(QMouseEvent *);
365 #ifndef QT_NO_WHEELEVENT
366  virtual void wheelEvent(QWheelEvent*);
367 #endif
368  virtual void dragEnterEvent( QDragEnterEvent* );
369  virtual void dropEvent( QDropEvent* );
370  virtual void closeEvent ( QCloseEvent * );
371  virtual bool widgetEvent( QEvent * );
372  virtual bool viewportEvent( QEvent * e );
373  virtual bool eventFilter(QObject *, QEvent *);
374  virtual void scrollContentsBy( int dx, int dy );
375 
376  void keyPressEvent( QKeyEvent *_ke );
377  void keyReleaseEvent ( QKeyEvent *_ke );
378  void doAutoScroll();
379  void timerEvent ( QTimerEvent * );
380 
381  void setSmoothScrollingModeDefault( SmoothScrollingMode m );
382 
383 protected Q_SLOTS:
384  void slotPaletteChanged();
385 
386 private Q_SLOTS:
387  void tripleClickTimeout();
388  void accessKeysTimeout();
389  void scrollTick();
390 
395  void slotMouseScrollTimer();
396 
397 private:
398  void resizeContentsToViewport();
399 
400  void scheduleRelayout(khtml::RenderObject* clippedObj=0);
401  void unscheduleRelayout();
402 
403  bool hasLayoutPending();
404 
405  void scheduleRepaint(int x, int y, int w, int h, bool asap=false);
406  void unscheduleRepaint();
407 
408  bool needsFullRepaint() const;
409 
410  void closeChildDialogs();
411  bool dialogsAllowed();
412 
413  void setMouseEventsTarget( QWidget* w );
414  QWidget* mouseEventsTarget() const;
415 
416  QStack<QRegion>* clipHolder() const;
417  void setClipHolder( QStack<QRegion>* ch );
418 
419  void setPart(KHTMLPart *part);
420 
429  void paint(QPainter *p, const QRect &rc, int yOff = 0, bool *more = 0);
430 
431  void render(QPainter *p, const QRect& r, const QPoint& off);
432 
443  void setMediaType( const QString &medium );
444  QString mediaType() const;
445 
446  bool pagedMode() const;
447 
448  bool scrollTo(const QRect &);
449 
450  bool focusNextPrevNode(bool next);
451  bool handleAccessKey(const QKeyEvent* ev);
452  bool focusNodeWithAccessKey(QChar c, KHTMLView* caller = NULL);
453  QMap< DOM::ElementImpl*, QChar > buildFallbackAccessKeys() const;
454  void displayAccessKeys( KHTMLView* caller, KHTMLView* origview, QVector< QChar >& taken, bool use_fallbacks );
455  bool isScrollingFromMouseWheel() const;
456  void setHasStaticBackground(bool partial=false);
457  void setHasNormalBackground();
458  void addStaticObject(bool fixed);
459  void removeStaticObject(bool fixed);
460  void applyTransforms( int& x, int& y, int& w, int& h) const;
461  void revertTransforms( int& x, int& y, int& w, int& h) const;
462  void revertTransforms( int& x, int& y ) const;
463  void checkExternalWidgetsPosition();
464 
465  void setIgnoreWheelEvents(bool e);
466 
467  void init();
468 
469  DOM::NodeImpl *nodeUnderMouse() const;
470  DOM::NodeImpl *nonSharedNodeUnderMouse() const;
471 
472  void restoreScrollBar();
473 
474  QStringList formCompletionItems(const QString &name) const;
475  void clearCompletionHistory(const QString& name);
476  void addFormCompletionItem(const QString &name, const QString &value);
477 
478  void addNonPasswordStorableSite( const QString& host );
479  void delNonPasswordStorableSite( const QString& host );
480  bool nonPasswordStorableSite( const QString& host ) const;
481 
482  bool dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode,
483  DOM::NodeImpl *targetNodeNonShared, bool cancelable,
484  int detail,QMouseEvent *_mouse, bool setUnder,
485  int mouseEventType, int orientation=0);
486  bool dispatchKeyEvent( QKeyEvent *_ke );
487  bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress );
488 
489  void complete( bool pendingAction );
490 
491  void updateScrollBars();
492  void setupSmoothScrolling(int dx, int dy);
493 
498  int caretDisplayPolicyNonFocused() const;
499 
505  void setCaretDisplayPolicyNonFocused(int policy);
506 
507  // -- caret event handler
508 
513  bool caretKeyPressEvent(QKeyEvent *);
514 
515  // ------------------------------------- member variables ------------------------------------
516  private:
517  friend class KHTMLViewPrivate;
518  enum LinkCursor { LINK_NORMAL, LINK_MAILTO, LINK_NEWWINDOW };
519 
520  void setWidgetVisible(::khtml::RenderWidget*, bool visible);
521 
522 
523  int _width;
524  int _height;
525 
526  int _marginWidth;
527  int _marginHeight;
528 
529  KHTMLPart *m_part;
530  KHTMLViewPrivate* const d;
531 
532  QString m_medium; // media type
533 };
534 
535 #endif
536 
khtml::KHTMLWidget::m_kwp
KHTMLWidgetPrivate * m_kwp
Definition: khtmlview.h:75
KHTMLView::SmoothScrollingMode
SmoothScrollingMode
Smooth Scrolling Mode enumeration.
Definition: khtmlview.h:305
print
KAction * print(const QObject *recvr, const char *slot, QObject *parent)
KHTMLView::marginWidth
int marginWidth() const
Returns the margin width.
Definition: khtmlview.h:149
khtml::KHTMLWidget::KHTMLWidget
KHTMLWidget()
WebCore::SVGNames::init
void init()
Definition: SVGNames.cpp:350
d
#define d
Definition: khtmlfind.cpp:42
QWidget
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:206
QStack
Definition: khtmlview.h:37
KHTMLView
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:92
StorePass
Definition: storepassbar.h:45
QString
QVector
Definition: khtmlview.h:36
QObject
KHTMLView::frameWidth
int frameWidth() const
Definition: khtmlview.h:137
QScrollArea
khtml::KHTMLWidget::~KHTMLWidget
~KHTMLWidget()
KHTMLFind
This class implements the find activity for the KHTMLPart.
Definition: khtmlfind_p.h:46
KHTMLView::part
KHTMLPart * part() const
Returns a pointer to the KHTMLPart that is rendering the page.
Definition: khtmlview.h:135
KHTMLView::SSMWhenEfficient
Definition: khtmlview.h:305
khtml::KHTMLWidget
Definition: khtmlview.h:70
QStringList
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
QPoint
khtml_export.h
QRect
KHTMLView::marginHeight
int marginHeight()
Returns the margin height.
Definition: khtmlview.h:161
QEvent
QMap
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal