• 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
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 
25 using namespace khtml;
26 using namespace DOM;
27 
28 class khtml::MouseEvent::MouseEventPrivate
29 {
30 };
31 
32 khtml::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 
43 khtml::MouseEvent::~MouseEvent()
44 {
45  delete d;
46 }
47 
48 long 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 
61 const char *khtml::MousePressEvent::s_strMousePressEvent = "khtml/Events/MousePressEvent";
62 
63 const char *khtml::MouseDoubleClickEvent::s_strMouseDoubleClickEvent = "khtml/Events/MouseDoubleClickEvent";
64 
65 const char *khtml::MouseMoveEvent::s_strMouseMoveEvent = "khtml/Events/MouseMoveEvent";
66 
67 const char *khtml::MouseReleaseEvent::s_strMouseReleaseEvent = "khtml/Events/MouseReleaseEvent";
68 
69 const char *khtml::DrawContentsEvent::s_strDrawContentsEvent = "khtml/Events/DrawContentsEvent";
70 
71 class khtml::DrawContentsEvent::DrawContentsEventPrivate
72 {
73 public:
74  DrawContentsEventPrivate()
75  {
76  }
77  ~DrawContentsEventPrivate()
78  {
79  }
80 };
81 
82 khtml::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 
89 khtml::DrawContentsEvent::~DrawContentsEvent()
90 {
91  delete d;
92 }
93 
khtml::MouseEvent::offset
long offset() const
Definition: khtml_events.cpp:48
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:270
d
#define d
Definition: khtmlfind.cpp:42
khtml::DrawContentsEvent::~DrawContentsEvent
virtual ~DrawContentsEvent()
Definition: khtml_events.cpp:89
DOM::Node::parentNode
Node parentNode() const
The parent of this node.
Definition: dom_node.cpp:199
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
khtml_events.h
khtml::MouseEvent::~MouseEvent
virtual ~MouseEvent()
Definition: khtml_events.cpp:43
DOM::Event
Introduced in DOM Level 2.
Definition: dom2_events.h:117
khtml::DrawContentsEvent::DrawContentsEvent
DrawContentsEvent(QPainter *painter, int clipx, int clipy, int clipw, int cliph)
Definition: khtml_events.cpp:82
DOM::Node::handle
NodeImpl * handle() const
Definition: dom_node.h:925
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
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:193
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