\section{Thumb\-Creator Class Reference}
\label{classThumbCreator}\index{ThumbCreator@{ThumbCreator}}
This is the baseclass for \char`\"{}thumbnail-plugins\char`\"{} in {\bf KDE}.  


{\tt \#include $<$thumbcreator.h$>$}

\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Flags} \{ {\bf None} =  0, 
{\bf Draw\-Frame} =  1, 
{\bf Blend\-Icon} =  2
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf create} (const  {\bf QString} \&path, int width, int height, {\bf QImage} \&img)=0
\begin{CompactList}\small\item\em Creates a thumbnail Note that the width and height parameters should not be used for scaling. \item\end{CompactList}\item 
virtual Flags {\bf flags} () const 
\begin{CompactList}\small\item\em The flags of this plugin: \begin{itemize}
\item None nothing special \item Draw\-Frame a frame should be painted around the preview \item Blend\-Icon the mimetype icon should be blended over the preview. \end{itemize}
\item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This is the baseclass for \char`\"{}thumbnail-plugins\char`\"{} in {\bf KDE}. 

Using the class {\bf KIO::Preview\-Job}{\rm (p.\,\pageref{classKIO_1_1PreviewJob})} allows you to generate small images (thumbnails) for any kind of file, where a \char`\"{}Thumb\-Creator\char`\"{} is available. Have a look at kdebase/kioslave/thumbnail/ for existing Thumb\-Creators.

What you need to do to create and register a Thumb\-Creator: \begin{itemize}
\item Inherit from this class and reimplement the {\bf create}{\rm (p.\,\pageref{classThumbCreator_a1})}() method to generate a thumbnail for the given file-path. \item Provide a factory method in your implementation file to instantiate your plugin, e.g.: \small\begin{alltt}
 extern "C"
 \{
   ThumbCreator *new\_creator()
   \{
     return new YourThumbCreator();
   \}
 \};
 \end{alltt}\normalsize 
\end{itemize}
Compile your Thumb\-Creator as a module. The contents of Makefile.am need to look like this: \small\begin{alltt}
 INCLUDES = 
 LDFLAGS =  
 kde\_module\_LTLIBRARIES = yourthumbcreator.la
 yourthumbcreator\_la\_SOURCES = yourthumbcreator.cpp
 yourthumbcreator\_la\_LIBADD = 
 yourthumbcreator\_la\_LDFLAGS =  -module 
 servicedir = 
 service\_DATA = yourthumbcreator.desktop
 \end{alltt}\normalsize 


\begin{itemize}
\item Create a file yourthumbcreator.desktop with the following contents: \small\begin{alltt}
 [Desktop Entry]
 Encoding=UTF-8
 Type=Service
 Name=Name of the type of files your ThumbCreator supports
 ServiceTypes=ThumbCreator
 MimeTypes=application/x-somemimetype
 CacheThumbnail=true
 X-KDE-Library=yourthumbcreator
 \end{alltt}\normalsize 
\end{itemize}
You can supply a comma-separated list of mimetypes to the Mime\-Types entry, naming all mimetypes your Thumb\-Creator supports. You can also use simple wildcards, like 



Definition at line 84 of file thumbcreator.h.

\subsection{Member Function Documentation}
\index{ThumbCreator@{Thumb\-Creator}!create@{create}}
\index{create@{create}!ThumbCreator@{Thumb\-Creator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool Thumb\-Creator::create (const {\bf QString} \& {\em path}, int {\em width}, int {\em height}, {\bf QImage} \& {\em img})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classThumbCreator_a1}


Creates a thumbnail Note that the width and height parameters should not be used for scaling. 

Only plugins that create an image \char`\"{}from scratch\char`\"{}, like the Text\-Creator should directly use the specified size. If the resulting preview is larger than width x height, it will be scaled down.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]the (always local) file path to create a preview for \item[{\em width}]maximum width for the preview \item[{\em height}]maximum height for the preview \item[{\em img}]this image will contain the preview on success\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if preview generation succeeded \end{Desc}
\index{ThumbCreator@{Thumb\-Creator}!flags@{flags}}
\index{flags@{flags}!ThumbCreator@{Thumb\-Creator}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Flags Thumb\-Creator::flags () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classThumbCreator_a2}


The flags of this plugin: \begin{itemize}
\item None nothing special \item Draw\-Frame a frame should be painted around the preview \item Blend\-Icon the mimetype icon should be blended over the preview. \end{itemize}


\begin{Desc}
\item[Returns:]flags for this plugin \end{Desc}


Definition at line 113 of file thumbcreator.h.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
thumbcreator.h\end{CompactItemize}
