home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kpreviewwidgetbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.0 KB  |  93 lines

  1. /* This file is part of the KDE libraries
  2.  * Copyright (C) 2001 Frerich Raabe <raabe@kde.org>
  3.  *               2003 Carsten Pfeiffer <pfeiffer@kde.org>
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Library General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Library General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Library General Public License
  16.  * along with this library; see the file COPYING.LIB.  If not, write to
  17.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.  * Boston, MA 02110-1301, USA.
  19.  */
  20.  
  21. #ifndef __KPREVIEWWIDGETBASE_H__
  22. #define __KPREVIEWWIDGETBASE_H__
  23.  
  24. #include <qptrdict.h>
  25. #include <qwidget.h>
  26.  
  27. #include <kdelibs_export.h>
  28.  
  29. class KURL;
  30.  
  31. /**
  32.  * Abstract baseclass for all preview widgets which shall be used via
  33.  * KFileDialog::setPreviewWidget(const KPreviewWidgetBase *).
  34.  * Ownership will be transferred to KFileDialog, so you have to create
  35.  * the preview with "new" and let KFileDialog delete it.
  36.  *
  37.  * Just derive your custom preview widget from KPreviewWidgetBase and implement
  38.  * all the pure virtual methods. The slot showPreview(const KURL &) is called
  39.  * every time the file selection changes.
  40.  *
  41.  * @short Abstract baseclass for all preview widgets.
  42.  * @author Frerich Raabe <raabe@kde.org>
  43.  */
  44. class KIO_EXPORT KPreviewWidgetBase : public QWidget
  45. {
  46.     Q_OBJECT
  47.  
  48. public:
  49.     /**
  50.      * Constructor. Construct the user interface of your preview widget here
  51.      * and pass the KFileDialog this preview widget is going to be used in as
  52.      * the parent.
  53.      *
  54.      * @param parent The KFileDialog this preview widget is going to be used in
  55.      * @param name The internal name of this object
  56.      */
  57.     KPreviewWidgetBase(QWidget *parent, const char *name=0);
  58.     ~KPreviewWidgetBase();
  59.  
  60. public slots:
  61.     /**
  62.      * This slot is called every time the user selects another file in the
  63.      * file dialog. Implement the stuff necessary to reflect the change here.
  64.      *
  65.      * @param url The URL of the currently selected file.
  66.      */
  67.     virtual void showPreview(const KURL &url) = 0;
  68.  
  69.     /**
  70.      * Reimplement this to clear the preview. This is called when e.g. the
  71.      * selection is cleared or when multiple selections exist, or the directory
  72.      * is changed.
  73.      */
  74.     virtual void clearPreview() = 0;
  75.  
  76.     QStringList supportedMimeTypes() const;
  77.  
  78. protected:
  79.     void setSupportedMimeTypes( const QStringList& mimeTypes );
  80.  
  81. protected:
  82.     virtual void virtual_hook( int, void* ) {};
  83.  
  84. private:
  85.     class KPreviewWidgetBasePrivate;
  86.     KPreviewWidgetBasePrivate * d() const {
  87.         return s_private->find( const_cast<KPreviewWidgetBase*>( this ) );
  88.     }
  89.     static QPtrDict<KPreviewWidgetBasePrivate> * s_private;
  90. };
  91.  
  92. #endif
  93.