diff options
Diffstat (limited to 'kview/kimageviewer')
-rw-r--r-- | kview/kimageviewer/Makefile.am | 18 | ||||
-rw-r--r-- | kview/kimageviewer/canvas.cpp | 35 | ||||
-rw-r--r-- | kview/kimageviewer/canvas.h | 348 | ||||
-rw-r--r-- | kview/kimageviewer/kimageviewer.desktop | 63 | ||||
-rw-r--r-- | kview/kimageviewer/kimageviewercanvas.desktop | 60 | ||||
-rw-r--r-- | kview/kimageviewer/viewer.cpp | 36 | ||||
-rw-r--r-- | kview/kimageviewer/viewer.h | 99 |
7 files changed, 659 insertions, 0 deletions
diff --git a/kview/kimageviewer/Makefile.am b/kview/kimageviewer/Makefile.am new file mode 100644 index 00000000..c451ac33 --- /dev/null +++ b/kview/kimageviewer/Makefile.am @@ -0,0 +1,18 @@ +# $Id$ + +lib_LTLIBRARIES = libkimageviewer.la + +noinst_HEADERS = canvas.h viewer.h + +libkimageviewer_la_SOURCES = canvas.cpp viewer.cpp +libkimageviewer_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 0:0 +libkimageviewer_la_LIBADD = $(LIB_KPARTS) + +INCLUDES = $(all_includes) + +# kimageviewerinclude_HEADERS = canvas.h viewer.h +# kimageviewerincludedir = $(includedir)/kimageviewer + +METASOURCES = AUTO + +kde_servicetypes_DATA = kimageviewercanvas.desktop kimageviewer.desktop diff --git a/kview/kimageviewer/canvas.cpp b/kview/kimageviewer/canvas.cpp new file mode 100644 index 00000000..9b2c987b --- /dev/null +++ b/kview/kimageviewer/canvas.cpp @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ +// $Id$ + +#include "canvas.h" + +namespace KImageViewer +{ + Canvas::Canvas() + : m_iBlendEffect( 0 ) + { + } + + Canvas::~Canvas() + { + } +} //namespace + +// vim: sw=4 ts=4 diff --git a/kview/kimageviewer/canvas.h b/kview/kimageviewer/canvas.h new file mode 100644 index 00000000..61b565b4 --- /dev/null +++ b/kview/kimageviewer/canvas.h @@ -0,0 +1,348 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ +// $Id$ + +#ifndef KIMAGEVIEWER_CANVAS_H +#define KIMAGEVIEWER_CANVAS_H + +class QColor; +class QSize; +class QImage; +class QRect; +class QPoint; +class QWidget; + +#include <qstring.h> +#include <qobjectdefs.h> +#include <kdemacros.h> +namespace KImageViewer +{ + +/** + * An image canvas widget + * + * @author Matthias Kretz <kretz@kde.org> + * + * You'll find an implementation in kdegraphics (KView). You may + * still use this interface in your program but it will only work + * if you have an implementation installed. + * + * This is what you have to do to get an image canvas embedded in + * your program: + * + * <pre> + QWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<QWidget>( "KImageViewer/Canvas", QString::null, this ); + m_canvas = static_cast<KImageViewer::Canvas *>( widget->qt_cast( "KImageViewer::Canvas" ) ); + if( ! ( widget && m_canvas ) ) + { + KMessageBox::error( this, "Could not find the Canvas!" ); + kapp->quit(); + } + setCentralWidget( widget ); + connect( widget, SIGNAL( contextPress( const QPoint & ) ), SLOT( mySlot( const QPoint & ) ) ); + connect( m_canvas->widget(), SIGNAL( contextPress( const QPoint & ) ), SLOT( mySlot( const QPoint & ) ) ); + </pre> + * + * You can't connect signals or slots using KImageViewer::Canvas, because this interface + * doesn't inherit from QObject. But you can cast to QWidget and use that instead (or just + * keep the original pointer to QWidget around, like shown in the example). + * + * This interface is not guaranteed to be kept binary or source compatible + * until it's finished. So if you're using this interface please get in contact + * with me. + */ +class KDE_EXPORT Canvas +{ + public: + /** + * set the background color of the canvas + */ + virtual void setBgColor( const QColor & ) = 0; + + /** + * returns the current background color + */ + virtual const QColor & bgColor() const = 0; + + /** + * the depth of the contained image + */ + virtual int imageDepth() const = 0; + + /** + * the size of the unzoomed image + */ + virtual QSize imageSize() const = 0; + + /** + * the size of the zoomed (current) image + */ + virtual QSize currentSize() const = 0; + + /** + * returns the zoom factor + */ + virtual double zoom() const = 0; + + /** + * @return The current (unzoomed) image + * Take care that the canas may delete the image so you probably need to + * make a copy of the image if you want to keep it around. + */ + virtual const QImage * image() const = 0; + + /** + * Scrolls the content so that the point (x, y) is in the top-left corner. + */ + virtual void setXYOffset( int x, int y ) = 0; + + /** + * Returns the leftmost visible X coordinate of the image. + */ + virtual int xOffset() const = 0; + + /** + * Returns the topmost visible Y coordinate of the image. + */ + virtual int yOffset() const = 0; + + /** + * Returns whether to use fast or smooth scaling + */ + virtual bool fastScale() const = 0; + + /** + * Return whether the image should always be centered. + */ + virtual bool centered() const = 0; + + /** + * Return the selected rectangle. If nothing is selected the rectangle is + * empty but doesn't have to be null. + */ + virtual QRect selection() const = 0; + + /** + * Returns whether the aspect ratio of the image is kept + */ + virtual bool keepAspectRatio() const = 0; + + /** + * @return the number of available blend effects + */ + virtual unsigned int numOfBlendEffects() const { return 0; } + + /** + * @return the description of the blend effect + */ + virtual QString blendEffectDescription( unsigned int ) const { return QString::null; } + + /** + * Sets the blending effect used to create a transition between images + */ + virtual void setBlendEffect( unsigned int idx ) { m_iBlendEffect = idx; } + + /** + * @return the current blend effect index + */ + virtual unsigned int blendEffect() const { return m_iBlendEffect; } + + /** + * @return the current maximum image size + */ + virtual const QSize & maximumImageSize() const = 0; + + /** + * @return the current minimum image size + */ + virtual const QSize & minimumImageSize() const = 0; + + /** + * @return a pointer to the QWidget interface of this object + */ + virtual QWidget * widget() = 0; + + signals: + /** + * a mouse button was pressed and a context menu should be openend + */ + virtual void contextPress( const QPoint & ) = 0; + + /** + * the size of the image has changed (a new image was loaded, or the + * image was zoomed or cropped) + * + * it passes the new size of the image + */ + virtual void imageSizeChanged( const QSize & ) = 0; + + /** + * The zoom of the image has changed. + */ + virtual void zoomChanged( double zoom ) = 0; + + /** + * The selection has changed. Connect to this signal if you want to + * do something with a selection of the image (e.g. crop). + */ + virtual void selectionChanged( const QRect & ) = 0; + + /** + * Emitted when an image is finished being shown. If a blend effect is being used + * the signal is emitted when the effect is finished. + */ + virtual void showingImageDone() = 0; + + /** + * This signal is emitted whenever the canvas changes between image/no-image. For + * example, if someone calls @ref clear() hasImage( false ) is emitted if an image + * was shown before. + */ + virtual void hasImage( bool ) = 0; + + /** + * Some methods of the canvas not only change the way the image is shown (e.g. zoom) + * but also change the image itself (e.g. rotation) - @ref image() returns something + * different. If such a change happens this signal is emitted. + * It is not emitted when a new image is set with the @ref setImage() methods. + */ + virtual void imageChanged() = 0; + + /** + * The current mouse cursor position on the image. + */ + virtual void cursorPos( const QPoint & ) = 0; + + public slots: + /** + * Set if the image should always be centered if the canvas is + * bigger than the image. + */ + virtual void setCentered( bool ) = 0; + + /** + * Give the canvas a new image to show. The zoom level is kept. + */ + virtual void setImage( const QImage & ) = 0; + + /** + * Give the canvas a new image to show. + * + * You have to pass the size the image should have when it appears + * on screen. + */ + virtual void setImage( const QImage &, const QSize & ) = 0; + + /** + * Set the zoom to be used when showing the image. + */ + virtual void setZoom( double ) = 0; + + /** + * Fit the image into the requested width and height. + */ + virtual void boundImageTo( const QSize & size ) = 0; + + /** + * Set the maximum size of the image. If this is set the image will + * never exceed this size. + * + * If you set this to 0x0 the image size may be as big as possible + */ + virtual void setMaximumImageSize( const QSize & ) = 0; + + /** + * Set the minimum size of the image. If this is set the image will + * never be smaller than this size. + * + * If you set this to 0x0 the image size can be as small as possible + */ + virtual void setMinimumImageSize( const QSize & ) = 0; + + /** + * Resize the image to the given size. It will keep the aspect ratio + * as long as keepAspectRatio is true (default). The image will be as + * large as possible within the given constraints. + */ + virtual void resizeImage( const QSize & ) = 0; + + /** + * Hides the scrollbars of the canvas. It's still possible to scroll + * by moving the image with the mouse. + */ + virtual void hideScrollbars( bool ) = 0; + + /** + * Changes the zoom behaviour: Normally the aspect ratio of the image + * won't change, but if you want to allow it you may do. + */ + virtual void setKeepAspectRatio( bool ) = 0; + + /** + * If the canvas supports different methods for scaling you may + * switch between fast and smooth scaling. + * + * It defaults to smooth scaling. + */ + virtual void setFastScale( bool ) = 0; + + /** + * clears the canvas (no image loaded) + */ + virtual void clear() = 0; + + /** + * flip the image horizontally + * + * @param change If set to true the internal image will be changed, else + * only the shown image changes and @ref image() still returns + * the same as before this call. + */ + virtual void flipHorizontal( bool change = false ) = 0; + + /** + * flip the image vertically + * + * @param change If set to true the internal image will be changed, else + * only the shown image changes and @ref image() still returns + * the same as before this call. + */ + virtual void flipVertical( bool change = false ) = 0; + + /** + * rotate the image a degrees counterclockwise + * + * @param angle The angle in degrees that the image should be rotated. + * @param change If set to true the internal image will be changed, else + * only the shown image changes and @ref image() still returns + * the same as before this call. + */ + virtual void rotate( double angle, bool change = false ) = 0; + + protected: + Canvas(); + virtual ~Canvas(); + unsigned int m_iBlendEffect; + +}; //class Canvas +} //namespace KImageViewer + +// vim:sw=4:ts=4 + +#endif // KIMAGEVIEWER_CANVAS_H diff --git a/kview/kimageviewer/kimageviewer.desktop b/kview/kimageviewer/kimageviewer.desktop new file mode 100644 index 00000000..6a5c1287 --- /dev/null +++ b/kview/kimageviewer/kimageviewer.desktop @@ -0,0 +1,63 @@ +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KImageViewer/Viewer +X-KDE-Derived=KParts/ReadWritePart +Icon=image +Comment=Embeddable Image Viewer Component +Comment[af]=Inlegbare Beeld Aansig Komponent +Comment[ar]=مكون عارض الصور القابل للدمج +Comment[bg]=Модул за преглед на изображения +Comment[br]=Parzh gweler skeudennoù enframmus +Comment[bs]=Ugradiva komponenta za pregled slika +Comment[ca]=Component visualitzador d'imatges encastable +Comment[cs]=Komponenta pro zobrazování obrázků +Comment[cy]=Cydran Mewnadeiladadwy Gwelydd Delweddau +Comment[da]=Indlejrbar billedviserkomponent +Comment[de]=Einbettungsfähige Bildbetrachter-Komponente +Comment[el]=Ενσωματώσιμο συστατικό προβολέα εικόνων +Comment[eo]=Enkonstruebla bildrigardilo +Comment[es]=Componente empotrable para visualizar imágenes +Comment[et]=Põimitav pildifailide näitaja komponent +Comment[eu]=Irudi ikustailu txertagarri osagaia +Comment[fa]=مؤلفۀ مشاهدهگر تصویر نهفتهشده +Comment[fi]=Upotettava kuviennäyttökomponentti +Comment[fr]=Composant afficheur d'images incorporable +Comment[gl]=Componente de visualización integrable +Comment[he]=רכיב מציג תמונות בר־הטבעה +Comment[hi]=एम्बेडेबल छवि प्रदर्शक अवयव +Comment[hr]=Umetljiva komponenta za gledanje slika +Comment[hu]=Beágyazható képnézegető komponens +Comment[is]=Ívefjanleg myndsjá +Comment[it]=Componente integrabile per la visione di immagini +Comment[ja]=埋め込み可能な画像ビューアコンポーネント +Comment[kk]=Ендірілетін кескін қарау компоненті +Comment[km]=សមាសភាគរបស់កម្មវិធីមើលរូបភាពដែលអាចបង្កប់បាន +Comment[lt]=Įdedamas piešinių peržiūros komponentas +Comment[ms]=Komponen Pemapar Imej Boleh Benam +Comment[nb]=Inkluderbar bildevisningskomponent +Comment[nds]=Inbettbor Bildkiekerkomponent +Comment[ne]=सम्मिलित छवि दर्शक अवयव +Comment[nl]=Ingebed weergavecomponent voor afbeeldingen +Comment[nn]=Inkluderbart komponent for biletvising +Comment[nso]=Seripa seo se Robatsegago sa Molebeledi wa Ponagalo +Comment[pl]=Składnik do przeglądania obrazków +Comment[pt]=Componente Embebida de Visualização de Imagens +Comment[pt_BR]=Componente Integrado do Visualizador de Imagens +Comment[ro]=Componentă înglobată de vizualizare imagini +Comment[ru]=Встраиваемый компонент просмотра изображений +Comment[se]=Vuojuhanláhkái govvačájehanoassi +Comment[sk]=Vložiteľný komponent prehliadač obrázkov +Comment[sl]=Vključen dodatek za pregled slik +Comment[sr]=Уградива компонента приказивача слика +Comment[sr@Latn]=Ugradiva komponenta prikazivača slika +Comment[sv]=Inbäddningsbar bildvisande komponent +Comment[ta]=பொதிந்த பிம்ப காட்சி பகுதி +Comment[tg]=Қисмати дар дохилсозандаи намоиши тасвирот +Comment[tr]=Gömülebilir Resim Görüntüleme Bileşeni +Comment[uk]=Вмонтовний компонент перегляду зображень +Comment[ven]=Tshipida tsha muvhoni wa tshifanyiso tsho dzheniswaho +Comment[xh]=Ingxenye Yombonisi Womfanekiso Olungisiweyo +Comment[zh_CN]=可嵌入的图像查看器组件 +Comment[zh_HK]=可嵌入的圖像檢視器元件 +Comment[zh_TW]=可嵌入的影像檢視器元件 +Comment[zu]=Ilunga Lombukisi Wesithombe Esixubeneyo diff --git a/kview/kimageviewer/kimageviewercanvas.desktop b/kview/kimageviewer/kimageviewercanvas.desktop new file mode 100644 index 00000000..fa084475 --- /dev/null +++ b/kview/kimageviewer/kimageviewercanvas.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KImageViewer/Canvas +Comment=Embeddable Image Viewer Canvas (widget that shows an image) +Comment[af]=Inlegbare Beeld Aansig Kanvas (gui-element wat vertoon 'n Beeld) +Comment[ar]= مساحة رسم لعرض الصور قابلة للدمج (كائن يعرض صورة) +Comment[bg]=Модул за преглед на изображения (полето, в което се показва самото изображение) +Comment[bs]=Ugradiva pozadina za pregled slika (grafički element koji prikazuje slike) +Comment[ca]=Llenç visualitzador d'imatges encastable (estri que mostra una imatge) +Comment[cs]=Pohltitelná komponenta pro zobrazování obrázků +Comment[cy]=Cynfas Mewnadeiladadwy Gwelydd Delweddau (celfigyn sy'n dangos delwedd) +Comment[da]=Indlejrbar billedviserlærred (kontrol der viser et billede) +Comment[de]=Einbettungsfähiges Bildbetrachtermodul (Bildschirmausschnitt, der ein Bild anzeigt) +Comment[el]=Ενσωματώσιμος Καμβάς Προβολής Εικόνων (γραφικό συστατικό που εμφανίζει μία εικόνα) +Comment[eo]=Enkonstruebla bildrigardilo kromaĵo +Comment[es]=Componente empotrable para visualizar lienzos (widget que muestra una imagen) +Comment[et]=Põimitavad pildifailide näitaja lõuendid (element, mis näitab pilti) +Comment[eu]=Irudi ikustailu txertagarriren ohila (irudi bat erakuts dezakeen tresnatxoa) +Comment[fa]=صفحۀ مجازی مشاهدهگر تصویر نهفتهشده )عنصری که یک تصویر را نمایش میدهد) +Comment[fi]=Upotettava kuviennäyttökomponentti (käyttöliittymäelementti joka näyttää kuvan) +Comment[fr]=Composant afficheur d'images incorporable (widget qui affiche une image) +Comment[gl]=Visor de imaxes integrado (complemento que amosa unha imaxe) +Comment[he]=רכיב מציג תמונות בר־הטבעה (פריט המציג תמונה) +Comment[hi]=एम्बेडेबल छवि प्रदर्शक केनवास (विजेट जो छवि दिखाता है) +Comment[hr]=Umetljivo platno za pregled slika (widget koji pokazuje sliku) +Comment[hu]=Beágyazható képnézegető objektum (képmegjelenítő) +Comment[is]=Ívefjanleg myndsjá (græja sem birtir mynd) +Comment[it]=Componente integrabile per la visione di immagini (widget che mostra un'immagine) +Comment[ja]=埋め込み可能な画像ビューアキャンバス (画像を表示するウィジェット) +Comment[kk]=Кескін қарауға арналған ендірілетін өріс (кескінді көрсететін бөлшегі) +Comment[km]=ផ្នែករបស់កម្មវិធីមើលរូបភាពដែលអាចបង្កប់បាន (ផ្នែកដែលបង្ហាញរូបភាព) +Comment[lt]=Įdedamas piešinių peržiūros paveikslas (valdiklis, kuris rodo paveikslėlį) +Comment[ms]=Kanvas Pemapar Imej Boleh Benam (widget yang memaparkan imej) +Comment[nb]=Inkluderbare bildevisningskomponenter (skjermelement som viser et bilde) +Comment[nds]=Inbettbor Bildkieker-Rahmen (Element, dat en Bild wiest) +Comment[ne]=सम्मिलित छवि दर्शक क्यानभास (छवि देखाउने विजेट) +Comment[nl]=Ingebed weergave-canvas (widget die een afbeelding toont) +Comment[nn]=Inkluderbart lerret for biletvising (skjermelement som viser eit bilete) +Comment[nso]=Canvas yeo e Robatsegago ya Molebeledi wa Ponagalo (widget yeo e bontshago ponagalo) +Comment[pl]=Obszar do przeglądania obrazków (wnętrze okienka, które pokazuje obrazek) +Comment[pt]=Área de Visualização Embebida de Imagens (um item que mostra uma imagem) +Comment[pt_BR]=Componente Integrado do Visualizador Canvas (componente que exibe uma imagem) +Comment[ro]=Componentă înglobată de vizualizare imagini (widget) +Comment[ru]=Встраиваемый элемент просмотра изображений (просмотр изображения в виджете) +Comment[se]=Vuojuhahtti govvačájehanliinni (áhtá mii čájeha gova) +Comment[sk]=Vložiteľný komponent prehliadač obrázkov (prvok, ktorý zobrazuje obrázky) +Comment[sl]=Vključljivo platno za pregled slik (gradnik, ki prikaže sliko) +Comment[sr]=Уградиво платно приказивача слика (контрола која показује слику) +Comment[sr@Latn]=Ugradivo platno prikazivača slika (kontrola koja pokazuje sliku) +Comment[sv]=Inbäddningsbar bildvisande duk (komponent som visar en bild) +Comment[ta]=பொதிந்த பிம்ப காட்சி திரைவடிவம்(சாளரம் ஒரு பிம்பத்தை காட்டுகிறது) +Comment[tg]=Ҷузъи дар дохилсозандаи намоиши тасвирот (намоиши тасвирот дар виджет) +Comment[tr]=Gömülebilir Resim Görüntüleme Penceresi +Comment[uk]=Вмонтовний компонент полотна перегляду зображень (віджет, що малює зображення) +Comment[ven]=Muvhala wa muvhoni wa tshifanyiso tsho dzheniswaho (tshishumiswa tsha vhuthogwa tshine tsha sumbedza tshifanyiso) +Comment[xh]=Iseyile Yombonisi Womfanekiso Olungisiweyo (widget ebonisa umfanekiso) +Comment[zh_CN]=可嵌入的图像查看画布(显示图像的部件) +Comment[zh_HK]=可嵌入的圖像檢視器畫布(顯示圖像的器件) +Comment[zh_TW]=可嵌入的影像檢視器畫布(顯示影像的界面工具) +Comment[zu]=Inkalivasi Yombukisi Wesithombe Esixubeneyo (i-widget ekhombisa isithombe) diff --git a/kview/kimageviewer/viewer.cpp b/kview/kimageviewer/viewer.cpp new file mode 100644 index 00000000..a74e0de9 --- /dev/null +++ b/kview/kimageviewer/viewer.cpp @@ -0,0 +1,36 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Matthias Kretz <kretz@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ +// $Id$ + +#include "viewer.h" + +namespace KImageViewer +{ + Viewer::Viewer( QObject * parent, const char * name ) + : KParts::ReadWritePart( parent, name ) + { + } + + Viewer::~Viewer() + { + } +} //namespace + +#include "viewer.moc" +// vim: sw=4 ts=4 diff --git a/kview/kimageviewer/viewer.h b/kview/kimageviewer/viewer.h new file mode 100644 index 00000000..647fd9ba --- /dev/null +++ b/kview/kimageviewer/viewer.h @@ -0,0 +1,99 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ +// $Id$ + +#ifndef KIMAGEVIEWER_VIEWER_H +#define KIMAGEVIEWER_VIEWER_H + +#include <kparts/part.h> +#include <kdemacros.h> +namespace KParts +{ + class BrowserExtension; +} + +namespace KImageViewer +{ + class Canvas; + +/** + * An image viewer KPart + * + * @author Matthias Kretz <kretz@kde.org> + * + * You'll find an implementation in kdegraphics (KView). You may + * still use this interface in your program but it will only work + * if you have an implementation installed + * + * WARNING: This interface is not guaranteed to be kept binary or source compatible + * until it's finished. So if you're using this interface please get in contact + * with me. + */ +class KDE_EXPORT Viewer : public KParts::ReadWritePart +{ + Q_OBJECT + public: + Viewer( QObject * parent = 0, const char * name = 0 ); + + virtual ~Viewer(); + + /** + * Return the canvas this viewer is using. The interface of the + * canvas is defined in kimageviewer/canvas.h + */ + virtual Canvas * canvas() const = 0; + + /** + * If the Viewer wants to be configurable + */ + //virtual void createConfigurationDialogPages() = 0; + + /** + * A pointer to the Browser Extension (if available). You should always + * check whether this returns a valid pointer. + */ + virtual KParts::BrowserExtension * browserExtension() const { return 0; } + + public slots: + /** + * Set a new Image. Close the old one and change the caption and file + * name and url and whatnot accordingly. + * So if you want to display a new image (not change the one shown) this + * is the method to use. Else take a look at Canvas::setImage(). + */ + virtual void newImage( const QImage & ) = 0; + + /** + * Tell the view to reload the current image. The host for this view + * should make an Action available for reloading. + */ + virtual void reload() = 0; + + signals: + /** + * Emitted when the viewer opens a new image + */ + void imageOpened( const KURL & ); + +}; //class Viewer +} //namespace KImageViewer + +// vim:sw=4:ts=4 + +#endif // KIMAGEVIEWER_VIEWER_H |