KDEWebKit
kgraphicswebview.cpp
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * 00004 * Copyright (C) 2007 Trolltech ASA 00005 * Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org> 00006 * Copyright (C) 2008 Laurent Montel <montel@kde.org> 00007 * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com> 00008 * Copyright (C) 2009 Dawit Alemayehu <adawit @ kde.org> 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Library General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Library General Public License 00021 * along with this library; see the file COPYING.LIB. If not, write to 00022 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00023 * Boston, MA 02110-1301, USA. 00024 * 00025 */ 00026 00027 #include "kgraphicswebview.h" 00028 #include "kwebpage.h" 00029 #include "kwebview_p.h" 00030 00031 #include <QtGui/QGraphicsSceneWheelEvent> 00032 #include <QtGui/QGraphicsSceneMouseEvent> 00033 00034 00035 KGraphicsWebView::KGraphicsWebView(QGraphicsItem *parent, bool createCustomPage) 00036 :QGraphicsWebView(parent), 00037 d(new KWebViewPrivate<KGraphicsWebView>(this)) 00038 { 00039 if (createCustomPage) 00040 setPage(new KWebPage(this)); 00041 } 00042 00043 KGraphicsWebView::~KGraphicsWebView() 00044 { 00045 delete d; 00046 } 00047 00048 bool KGraphicsWebView::isExternalContentAllowed() const 00049 { 00050 return d->isExternalContentAllowed(); 00051 } 00052 00053 void KGraphicsWebView::setAllowExternalContent(bool allow) 00054 { 00055 d->setAllowExternalContent(allow); 00056 } 00057 00058 void KGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent *event) 00059 { 00060 if (d->wheelEvent(event->delta())) { 00061 event->accept(); 00062 } else { 00063 QGraphicsWebView::wheelEvent(event); 00064 } 00065 } 00066 00067 00068 void KGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) 00069 { 00070 d->pressedButtons = event->buttons(); 00071 d->keyboardModifiers = event->modifiers(); 00072 QGraphicsWebView::mousePressEvent(event); 00073 } 00074 00075 void KGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) 00076 { 00077 if (d->mouseReleased(event->pos().toPoint()) || d->handleUrlPasteFromClipboard(event)) { 00078 event->accept(); 00079 return; 00080 } 00081 00082 QGraphicsWebView::mouseReleaseEvent(event); 00083 } 00084 00085 #include "kgraphicswebview.moc"
KDE 4.6 API Reference