KHTML
khtml_events.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "khtml_events.h"
00021 #include "rendering/render_object.h"
00022 #include "xml/dom_nodeimpl.h"
00023 #include "xml/dom_position.h"
00024
00025 using namespace khtml;
00026 using namespace DOM;
00027
00028 class khtml::MouseEvent::MouseEventPrivate
00029 {
00030 };
00031
00032 khtml::MouseEvent::MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y,
00033 const DOM::DOMString &url, const DOM::DOMString& target,
00034 const DOM::Node &innerNode )
00035 : KParts::Event( name ), m_qmouseEvent( qmouseEvent ), m_x( x ), m_y( y ),
00036 m_url( url ), m_target(target), m_innerNode( innerNode )
00037 {
00038 d = 0;
00039 if (innerNode.handle() && innerNode.handle()->renderer())
00040 innerNode.handle()->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
00041 }
00042
00043 khtml::MouseEvent::~MouseEvent()
00044 {
00045 delete d;
00046 }
00047
00048 long khtml::MouseEvent::offset() const
00049 {
00050 Position pos;
00051 if (innerNode().handle()) {
00052
00053 DOM::Node inner = innerNode();
00054 if (inner.nodeType() == Node::TEXT_NODE)
00055 inner = inner.parentNode();
00056 pos = inner.handle()->positionForCoordinates(m_x, m_y);
00057 }
00058 return pos.offset();
00059 }
00060
00061 const char *khtml::MousePressEvent::s_strMousePressEvent = "khtml/Events/MousePressEvent";
00062
00063 const char *khtml::MouseDoubleClickEvent::s_strMouseDoubleClickEvent = "khtml/Events/MouseDoubleClickEvent";
00064
00065 const char *khtml::MouseMoveEvent::s_strMouseMoveEvent = "khtml/Events/MouseMoveEvent";
00066
00067 const char *khtml::MouseReleaseEvent::s_strMouseReleaseEvent = "khtml/Events/MouseReleaseEvent";
00068
00069 const char *khtml::DrawContentsEvent::s_strDrawContentsEvent = "khtml/Events/DrawContentsEvent";
00070
00071 class khtml::DrawContentsEvent::DrawContentsEventPrivate
00072 {
00073 public:
00074 DrawContentsEventPrivate()
00075 {
00076 }
00077 ~DrawContentsEventPrivate()
00078 {
00079 }
00080 };
00081
00082 khtml::DrawContentsEvent::DrawContentsEvent( QPainter *painter, int clipx, int clipy, int clipw, int cliph )
00083 : KParts::Event( s_strDrawContentsEvent ), m_painter( painter ), m_clipx( clipx ), m_clipy( clipy ),
00084 m_clipw( clipw ), m_cliph( cliph )
00085 {
00086 d = new DrawContentsEventPrivate;
00087 }
00088
00089 khtml::DrawContentsEvent::~DrawContentsEvent()
00090 {
00091 delete d;
00092 }
00093