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

KHTML

  • khtml
khtml_events.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "khtml_events.h"
21#include "rendering/render_object.h"
22#include "xml/dom_nodeimpl.h"
23#include "xml/dom_position.h"
24
25using namespace khtml;
26using namespace DOM;
27
28class khtml::MouseEvent::MouseEventPrivate
29{
30};
31
32khtml::MouseEvent::MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y,
33 const DOM::DOMString &url, const DOM::DOMString& target,
34 const DOM::Node &innerNode )
35: KParts::Event( name ), m_qmouseEvent( qmouseEvent ), m_x( x ), m_y( y ),
36 m_url( url ), m_target(target), m_innerNode( innerNode )
37{
38 d = 0;
39 if (innerNode.handle() && innerNode.handle()->renderer())
40 innerNode.handle()->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
41}
42
43khtml::MouseEvent::~MouseEvent()
44{
45 delete d;
46}
47
48long khtml::MouseEvent::offset() const
49{
50 Position pos;
51 if (innerNode().handle()) {
52 // FIXME: Shouldn't be necessary to skip text nodes.
53 DOM::Node inner = innerNode();
54 if (inner.nodeType() == Node::TEXT_NODE)
55 inner = inner.parentNode();
56 pos = inner.handle()->positionForCoordinates(m_x, m_y).position();
57 }
58 return pos.offset();
59}
60
61const char *khtml::MousePressEvent::s_strMousePressEvent = "khtml/Events/MousePressEvent";
62
63const char *khtml::MouseDoubleClickEvent::s_strMouseDoubleClickEvent = "khtml/Events/MouseDoubleClickEvent";
64
65const char *khtml::MouseMoveEvent::s_strMouseMoveEvent = "khtml/Events/MouseMoveEvent";
66
67const char *khtml::MouseReleaseEvent::s_strMouseReleaseEvent = "khtml/Events/MouseReleaseEvent";
68
69const char *khtml::DrawContentsEvent::s_strDrawContentsEvent = "khtml/Events/DrawContentsEvent";
70
71class khtml::DrawContentsEvent::DrawContentsEventPrivate
72{
73public:
74 DrawContentsEventPrivate()
75 {
76 }
77 ~DrawContentsEventPrivate()
78 {
79 }
80};
81
82khtml::DrawContentsEvent::DrawContentsEvent( QPainter *painter, int clipx, int clipy, int clipw, int cliph )
83 : KParts::Event( s_strDrawContentsEvent ), m_painter( painter ), m_clipx( clipx ), m_clipy( clipy ),
84 m_clipw( clipw ), m_cliph( cliph )
85{
86 d = new DrawContentsEventPrivate;
87}
88
89khtml::DrawContentsEvent::~DrawContentsEvent()
90{
91 delete d;
92}
93
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Event
Introduced in DOM Level 2.
Definition: dom2_events.h:117
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:271
DOM::Node::handle
NodeImpl * handle() const
Definition: dom_node.h:925
DOM::Node::TEXT_NODE
@ TEXT_NODE
Definition: dom_node.h:384
DOM::Node::parentNode
Node parentNode() const
The parent of this node.
Definition: dom_node.cpp:199
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:193
khtml::DrawContentsEvent::DrawContentsEvent
DrawContentsEvent(QPainter *painter, int clipx, int clipy, int clipw, int cliph)
Definition: khtml_events.cpp:82
khtml::DrawContentsEvent::~DrawContentsEvent
virtual ~DrawContentsEvent()
Definition: khtml_events.cpp:89
khtml::MouseEvent::MouseEvent
MouseEvent(const char *name, QMouseEvent *qmouseEvent, int x, int y, const DOM::DOMString &url, const DOM::DOMString &target, const DOM::Node &innerNode)
Definition: khtml_events.cpp:32
khtml::MouseEvent::innerNode
DOM::Node innerNode() const
Definition: khtml_events.h:46
khtml::MouseEvent::offset
long offset() const
Definition: khtml_events.cpp:48
khtml::MouseEvent::~MouseEvent
virtual ~MouseEvent()
Definition: khtml_events.cpp:43
khtml_events.h
d
#define d
Definition: khtmlfind.cpp:42
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
KParts
name
const char * name(StandardAction id)
khtml
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