tdehtmlimage.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., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __tdehtmlimage_h__ 00021 #define __tdehtmlimage_h__ 00022 00023 #include "tdehtml_part.h" 00024 #include <tdeparts/factory.h> 00025 #include <tdeparts/browserextension.h> 00026 00027 #include "misc/loader_client.h" 00028 00029 class TDEHTMLPart; 00030 class TDEInstance; 00031 00032 namespace tdehtml 00033 { 00034 class CachedImage; 00035 } 00036 00040 class TDEHTMLImageFactory : public KParts::Factory 00041 { 00042 Q_OBJECT 00043 public: 00044 TDEHTMLImageFactory(); 00045 virtual ~TDEHTMLImageFactory(); 00046 00047 virtual KParts::Part *createPartObject( TQWidget *parentWidget, const char *widgetName, 00048 TQObject *parent, const char *name, 00049 const char *className, const TQStringList &args ); 00050 00051 static TDEInstance *instance() { return s_instance; } 00052 00053 private: 00054 static TDEInstance *s_instance; 00055 }; 00056 00060 class TDEHTMLImage : public KParts::ReadOnlyPart, public tdehtml::CachedObjectClient 00061 { 00062 Q_OBJECT 00063 public: 00064 TDEHTMLImage( TQWidget *parentWidget, const char *widgetName, 00065 TQObject *parent, const char *name, TDEHTMLPart::GUIProfile prof ); 00066 virtual ~TDEHTMLImage(); 00067 00068 virtual bool openFile() { return true; } // grmbl, should be non-pure in part.h, IMHO 00069 00070 virtual bool openURL( const KURL &url ); 00071 00072 virtual bool closeURL(); 00073 00074 TDEHTMLPart *doc() const { return m_tdehtml; } 00075 00076 virtual void notifyFinished( tdehtml::CachedObject *o ); 00077 00078 protected: 00079 virtual void guiActivateEvent( KParts::GUIActivateEvent *e ); 00080 virtual bool eventFilter( TQObject *filterTarget, TQEvent *e ); 00081 00082 private slots: 00083 void restoreScrollPosition(); 00084 // void slotImageJobFinished( TDEIO::Job *job ); 00085 00086 // void updateWindowCaption(); 00087 00088 private: 00089 void disposeImage(); 00090 00091 TQGuardedPtr<TDEHTMLPart> m_tdehtml; 00092 KParts::BrowserExtension *m_ext; 00093 TQString m_mimeType; 00094 tdehtml::CachedImage *m_image; 00095 int m_xOffset, m_yOffset; 00096 }; 00097 00101 class TDEHTMLImageBrowserExtension : public KParts::BrowserExtension 00102 { 00103 Q_OBJECT 00104 public: 00105 TDEHTMLImageBrowserExtension( TDEHTMLImage *parent, const char *name = 0 ); 00106 00107 virtual int xOffset(); 00108 virtual int yOffset(); 00109 00110 protected slots: 00111 void print(); 00112 void reparseConfiguration(); 00113 void disableScrolling(); 00114 00115 private: 00116 TDEHTMLImage *m_imgPart; 00117 }; 00118 00119 #endif