KHTML
khtmlimage.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __khtmlimage_h__ 00021 #define __khtmlimage_h__ 00022 00023 #include "khtml_part.h" 00024 #include <kpluginfactory.h> 00025 #include <kparts/browserextension.h> 00026 #include <kparts/statusbarextension.h> 00027 00028 #include "misc/loader_client.h" 00029 00030 class KHTMLPart; 00031 class KComponentData; 00032 00033 namespace khtml 00034 { 00035 class CachedImage; 00036 } 00037 00042 class KHTML_EXPORT KHTMLImageFactory : public KPluginFactory 00043 { 00044 Q_OBJECT 00045 public: 00046 KHTMLImageFactory(); 00047 virtual ~KHTMLImageFactory(); 00048 00049 virtual QObject *create(const char* iface, 00050 QWidget *parentWidget, 00051 QObject *parent, 00052 const QVariantList& args, 00053 const QString &keyword); 00054 00055 static const KComponentData &componentData() { return *s_componentData; } 00056 00057 private: 00058 static KComponentData *s_componentData; 00059 }; 00060 00064 class KHTMLImage : public KParts::ReadOnlyPart, public khtml::CachedObjectClient 00065 { 00066 Q_OBJECT 00067 public: 00068 KHTMLImage( QWidget *parentWidget, 00069 QObject *parent, KHTMLPart::GUIProfile prof ); 00070 virtual ~KHTMLImage(); 00071 00072 virtual bool openFile() { return true; } // grmbl, should be non-pure in part.h, IMHO 00073 00074 virtual bool openUrl( const KUrl &url ); 00075 00076 virtual bool closeUrl(); 00077 00078 KHTMLPart *doc() const { return m_khtml; } 00079 00080 virtual void notifyFinished( khtml::CachedObject *o ); 00081 00082 protected: 00083 virtual void guiActivateEvent( KParts::GUIActivateEvent *e ); 00084 00085 private Q_SLOTS: 00086 void restoreScrollPosition(); 00087 00088 void slotPopupMenu( const QPoint &global, const KUrl &url, mode_t mode, 00089 const KParts::OpenUrlArguments &args, 00090 const KParts::BrowserArguments &browserArgs, 00091 KParts::BrowserExtension::PopupFlags flags, 00092 const KParts::BrowserExtension::ActionGroupMap& actionGroups ); 00093 00094 // void slotImageJobFinished( KIO::Job *job ); 00095 00096 // void updateWindowCaption(); 00097 00098 private: 00099 void disposeImage(); 00100 00101 QPointer<KHTMLPart> m_khtml; 00102 KParts::BrowserExtension *m_ext; 00103 KParts::StatusBarExtension *m_sbExt; 00104 QString m_mimeType; 00105 khtml::CachedImage *m_image; 00106 int m_xOffset, m_yOffset; 00107 }; 00108 00112 class KHTMLImageBrowserExtension : public KParts::BrowserExtension 00113 { 00114 Q_OBJECT 00115 public: 00116 KHTMLImageBrowserExtension( KHTMLImage *parent ); 00117 00118 virtual int xOffset(); 00119 virtual int yOffset(); 00120 00121 protected Q_SLOTS: 00122 void print(); 00123 void reparseConfiguration(); 00124 void disableScrolling(); 00125 00126 private: 00127 KHTMLImage *m_imgPart; 00128 }; 00129 00130 #endif
KDE 4.6 API Reference