khtml Library API Documentation

khtml_events.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 2000 Simon Hausmann <hausmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 #ifndef __khtml_events_h__ 00020 #define __khtml_events_h__ 00021 00022 #include <kparts/event.h> 00023 00024 #include "dom/dom_node.h" 00025 #include "dom/dom_string.h" 00026 00027 namespace khtml 00028 { 00029 00030 class MouseEvent : public KParts::Event 00031 { 00032 public: 00033 MouseEvent( const char *name, QMouseEvent *qmouseEvent, int x, int y, 00034 const DOM::DOMString &url, const DOM::DOMString& target, 00035 const DOM::Node &innerNode); 00036 virtual ~MouseEvent(); 00037 00038 QMouseEvent *qmouseEvent() const { return m_qmouseEvent; } 00039 int x() const { return m_x; } 00040 int y() const { return m_y; } 00041 int absX() const { return m_nodeAbsX; } 00042 int absY() const { return m_nodeAbsY; } 00043 00044 DOM::DOMString url() const { return m_url; } 00045 DOM::DOMString target() const { return m_target; } 00046 DOM::Node innerNode() const { return m_innerNode; } 00047 00048 // return the offset of innerNode 00049 long offset() const; 00050 00051 private: 00052 QMouseEvent *m_qmouseEvent; 00053 int m_x; 00054 int m_y; 00055 int m_nodeAbsX, m_nodeAbsY; 00056 DOM::DOMString m_url; 00057 DOM::DOMString m_target; 00058 DOM::Node m_innerNode; 00059 class MouseEventPrivate; 00060 MouseEventPrivate *d; 00061 }; 00062 00063 class MousePressEvent : public MouseEvent 00064 { 00065 public: 00066 MousePressEvent( QMouseEvent *mouseEvent, int x, int y, 00067 const DOM::DOMString &url, const DOM::DOMString& target, 00068 const DOM::Node &innerNode) 00069 : MouseEvent( s_strMousePressEvent, mouseEvent, x, y, url, target, innerNode ) 00070 {} 00071 00072 static bool test( const QEvent *event ) { return KParts::Event::test( event, s_strMousePressEvent ); } 00073 00074 00075 private: 00076 static const char *s_strMousePressEvent; 00077 }; 00078 00079 class MouseDoubleClickEvent : public MouseEvent 00080 { 00081 public: 00082 // clickCount is 3 for a triple-click event 00083 MouseDoubleClickEvent( QMouseEvent *mouseEvent, int x, int y, 00084 const DOM::DOMString &url, const DOM::DOMString& target, 00085 const DOM::Node &innerNode, int clickCount = 2 ) 00086 : MouseEvent( s_strMouseDoubleClickEvent, mouseEvent, x, y, url, target, innerNode ), 00087 m_clickCount( clickCount ) 00088 {} 00089 00090 static bool test( const QEvent *event ) 00091 { return KParts::Event::test( event, s_strMouseDoubleClickEvent ); } 00092 00093 int clickCount() const { return m_clickCount; } 00094 00095 private: 00096 int m_clickCount; 00097 static const char *s_strMouseDoubleClickEvent; 00098 }; 00099 00100 class MouseMoveEvent : public MouseEvent 00101 { 00102 public: 00103 MouseMoveEvent( QMouseEvent *mouseEvent, int x, int y, 00104 const DOM::DOMString &url, const DOM::DOMString& target, 00105 const DOM::Node &innerNode) 00106 : MouseEvent( s_strMouseMoveEvent, mouseEvent, x, y, url, target, innerNode ) 00107 {} 00108 00109 static bool test( const QEvent *event ) { return KParts::Event::test( event, s_strMouseMoveEvent ); } 00110 00111 private: 00112 static const char *s_strMouseMoveEvent; 00113 }; 00114 00115 class MouseReleaseEvent : public MouseEvent 00116 { 00117 public: 00118 MouseReleaseEvent( QMouseEvent *mouseEvent, int x, int y, 00119 const DOM::DOMString &url, const DOM::DOMString& target, 00120 const DOM::Node &innerNode, long = 0 ) 00121 : MouseEvent( s_strMouseReleaseEvent, mouseEvent, x, y, url, target, innerNode ) 00122 {} 00123 00124 static bool test( const QEvent *event ) { return KParts::Event::test( event, s_strMouseReleaseEvent ); } 00125 00126 private: 00127 static const char *s_strMouseReleaseEvent; 00128 }; 00129 00130 class DrawContentsEvent : public KParts::Event 00131 { 00132 public: 00133 DrawContentsEvent( QPainter *painter, int clipx, int clipy, int clipw, int cliph ); 00134 virtual ~DrawContentsEvent(); 00135 00136 QPainter *painter() const { return m_painter; } 00137 int clipx() const { return m_clipx; } 00138 int clipy() const { return m_clipy; } 00139 int clipw() const { return m_clipw; } 00140 int cliph() const { return m_cliph; } 00141 00142 static bool test( const QEvent *event ) { return KParts::Event::test( event, s_strDrawContentsEvent ); } 00143 00144 private: 00145 QPainter *m_painter; 00146 int m_clipx; 00147 int m_clipy; 00148 int m_clipw; 00149 int m_cliph; 00150 class DrawContentsEventPrivate; 00151 DrawContentsEventPrivate *d; 00152 static const char *s_strDrawContentsEvent; 00153 }; 00154 00155 } 00156 00157 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:56:26 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003