KHTML
khtmladaptorpart.h
Go to the documentation of this file.00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (C) 2007 Harri Porten (porten@kde.org) 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef KHTMLADAPTORPART_H 00021 #define KHTMLADAPTORPART_H 00022 00023 #include <khtml_export.h> 00024 #include <kparts/part.h> 00025 #include <kparts/browserextension.h> 00026 #include <kparts/factory.h> 00027 00028 namespace KJS 00029 { 00030 class ExecState; 00031 class JSObject; 00032 } 00033 00034 class ScriptingInterface 00035 { 00036 public: 00037 virtual ~ScriptingInterface() { } 00038 00039 virtual void initScripting(KJS::ExecState *exec) = 0; 00040 virtual void stopScripting() = 0; 00041 00042 virtual KJS::JSObject* scriptObject() = 0; 00043 }; 00044 00045 Q_DECLARE_INTERFACE(ScriptingInterface, "org.kde.khtml.ScriptingInterface") 00046 00047 class KHTMLAdaptorPartFactory : public KParts::Factory { 00048 Q_OBJECT 00049 public: 00050 KHTMLAdaptorPartFactory (); 00051 virtual KParts::Part *createPartObject(QWidget *wparent, 00052 QObject *parent, 00053 const char *className, 00054 const QStringList &args); 00055 }; 00056 00057 class AdaptorView : public KParts::ReadOnlyPart, 00058 public ScriptingInterface { 00059 Q_OBJECT 00060 Q_INTERFACES(ScriptingInterface) 00061 public: 00062 AdaptorView(QWidget* wparent, QObject* parent, const QStringList& args); 00063 00064 void initScripting(KJS::ExecState *exec); 00065 void stopScripting() { } 00066 KJS::JSObject* scriptObject(); 00067 00068 protected: 00069 bool openFile(); 00070 }; 00071 00072 #endif