libplasma
webcontent.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program 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 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef PLASMA_WEBCONTENT_H 00021 #define PLASMA_WEBCONTENT_H 00022 00023 #include <plasma/plasma_export.h> 00024 #include <QtCore/QUrl> 00025 #include <QtGui/QGraphicsWidget> 00026 00027 class QWebPage; 00028 class QWebFrame; 00029 class QKeyEvent; 00030 class QGraphicsSceneDragDropEvent; 00031 class QGraphicsSceneMouseEvent; 00032 class QGraphicsSceneWheelEvent; 00033 00034 namespace Plasma 00035 { 00036 00037 class WebContentPrivate; 00038 00039 class PLASMA_EXPORT WebContent : public QGraphicsWidget 00040 { 00041 Q_OBJECT 00042 00043 public: 00044 explicit WebContent(QGraphicsItem *parent = 0); 00045 ~WebContent(); 00046 00052 void setUrl(const QUrl &url); 00053 00061 void setHtml(const QByteArray &html, const QUrl &baseUrl = QUrl()); 00062 00070 void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); 00071 00075 QRectF geometry() const; 00076 00084 void setPage(QWebPage *page); 00085 00090 QWebPage* page() const; 00091 00095 QWebFrame* mainFrame() const; 00096 00100 void setGeometry(const QRectF &geometry); 00101 00102 Q_SIGNALS: 00109 void loadProgress(int percent); 00110 00117 void loadFinished(bool success); 00118 00119 protected: 00123 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 00124 void mouseMoveEvent(QGraphicsSceneMouseEvent *event); 00125 void mousePressEvent(QGraphicsSceneMouseEvent *event); 00126 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); 00127 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); 00128 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); 00129 void wheelEvent(QGraphicsSceneWheelEvent *event); 00130 void keyPressEvent(QKeyEvent * event); 00131 void keyReleaseEvent(QKeyEvent * event); 00132 void focusInEvent(QFocusEvent * event); 00133 void focusOutEvent(QFocusEvent * event); 00134 void dragEnterEvent(QGraphicsSceneDragDropEvent * event); 00135 void dragLeaveEvent(QGraphicsSceneDragDropEvent * event); 00136 void dragMoveEvent(QGraphicsSceneDragDropEvent * event); 00137 void dropEvent(QGraphicsSceneDragDropEvent * event); 00138 00139 private: 00140 Q_PRIVATE_SLOT(d, void loadingFinished(bool success)) 00141 00142 WebContentPrivate * const d; 00143 friend class WebContentPrivate; 00144 }; 00145 00146 } // namespace Plasma 00147 00148 #endif // Multiple incluson guard 00149