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

KHTML

  • 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
34class QPainter;
35class QRect;
36template< typename T > class QVector;
37template <class T> class QStack;
38
39namespace 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
52namespace KJS {
53 class WindowFunc;
54 class ExternalFunc;
55}
56
57namespace 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
80class KHTMLPart;
81class KHTMLViewPrivate;
82
83namespace khtml {
84
85}
86
92class 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
124public:
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
324public Q_SLOTS:
330 virtual void resizeContents(int w, int h);
331
335 void layout();
336
337
338Q_SIGNALS:
343 void finishedLayout();
344 void cleared();
345 void zoomView( int );
346 void hideAccessKeys();
347 void repaintAccessKeys();
348 void findAheadActive( bool );
349
350protected:
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
383protected Q_SLOTS:
384 void slotPaletteChanged();
385
386private Q_SLOTS:
387 void tripleClickTimeout();
388 void accessKeysTimeout();
389 void scrollTick();
390
395 void slotMouseScrollTimer();
396
397private:
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
KHTMLFind
This class implements the find activity for the KHTMLPart.
Definition: khtmlfind_p.h:47
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:207
KHTMLView
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:93
KHTMLView::part
KHTMLPart * part() const
Returns a pointer to the KHTMLPart that is rendering the page.
Definition: khtmlview.h:135
KHTMLView::finishedLayout
void finishedLayout()
This signal is used for internal layouting.
KHTMLView::repaintAccessKeys
void repaintAccessKeys()
KHTMLView::marginHeight
int marginHeight()
Returns the margin height.
Definition: khtmlview.h:161
KHTMLView::marginWidth
int marginWidth() const
Returns the margin width.
Definition: khtmlview.h:149
KHTMLView::findAheadActive
void findAheadActive(bool)
KHTMLView::hideAccessKeys
void hideAccessKeys()
KHTMLView::cleared
void cleared()
KHTMLView::frameWidth
int frameWidth() const
Definition: khtmlview.h:137
KHTMLView::zoomView
void zoomView(int)
KHTMLView::SmoothScrollingMode
SmoothScrollingMode
Smooth Scrolling Mode enumeration.
Definition: khtmlview.h:305
QEvent
QMap
QObject
QScrollArea
QStack
Definition: khtmlview.h:37
QVector
Definition: khtmlview.h:36
QWidget
StorePass
Definition: storepassbar.h:46
khtml::KHTMLWidget
Definition: khtmlview.h:71
khtml::KHTMLWidget::~KHTMLWidget
~KHTMLWidget()
khtml::KHTMLWidget::m_kwp
KHTMLWidgetPrivate * m_kwp
Definition: khtmlview.h:75
khtml::KHTMLWidget::KHTMLWidget
KHTMLWidget()
khtml_export.h
d
#define d
Definition: khtmlfind.cpp:42
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
KJS
Definition: dom_node.h:37
print
KAction * print(const QObject *recvr, const char *slot, QObject *parent)
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
khtml
khtml::applyRule
void applyRule(DOM::CSSProperty *prop)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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