kio Library API Documentation

kicondialog.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicondialog.h,v 1.18 2002/09/28 14:00:59 tjansen Exp $
00004  *
00005  * This file is part of the KDE project, module kfile.
00006  * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
00007  *           (C) 2000 Kurt Granroth <granroth@kde.org>
00008  *           (C) 1997 Christoph Neerfeld <chris@kde.org>
00009  *           (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
00010  *
00011  * This is free software; it comes under the GNU Library General
00012  * Public License, version 2. See the file "COPYING.LIB" for the
00013  * exact licensing terms.
00014  */
00015 
00016 #ifndef __KIconDialog_h__
00017 #define __KIconDialog_h__
00018 
00019 #include <qstring.h>
00020 #include <qstringlist.h>
00021 #include <qpushbutton.h>
00022 
00023 #include <kicontheme.h>
00024 #include <kdialogbase.h>
00025 #include <kiconview.h>
00026 
00027 class QComboBox;
00028 class QTimer;
00029 class QKeyEvent;
00030 class QRadioButton;
00031 class KProgress;
00032 class KIconLoader;
00033 
00034 
00035 
00039 class KIconCanvas: public KIconView
00040 {
00041     Q_OBJECT
00042 
00043 public:
00044     KIconCanvas(QWidget *parent=0L, const char *name=0L);
00045     ~KIconCanvas();
00046 
00050     void loadFiles(const QStringList& files);
00051 
00055     QString getCurrent() const;
00056 
00057 public slots:
00058     void stopLoading();
00059 
00060 signals:
00064     void nameChanged(QString);
00065 
00066     void startLoading(int);
00067     void progress(int);
00068     void finished();
00069 
00070 private slots:
00071     void slotLoadFiles();
00072     void slotCurrentChanged(QIconViewItem *item);
00073 
00074 private:
00075     QStringList mFiles;
00076     QTimer *mpTimer;
00077     KIconLoader *mpLoader;
00078 protected:
00079     virtual void virtual_hook( int id, void* data );
00080 private:
00081     class KIconCanvasPrivate;
00082     KIconCanvasPrivate *d;
00083 };
00084 
00085 
00092 class KIconDialog: public KDialogBase
00093 {
00094     Q_OBJECT
00095 
00096 public:
00100     KIconDialog(QWidget *parent=0L, const char *name=0L);
00104     KIconDialog(KIconLoader *loader, QWidget *parent=0,
00105         const char *name=0);
00109     ~KIconDialog();
00110 
00117     void setStrictIconSize(bool b);
00121     bool strictIconSize() const;
00126     void setCustomLocation( const QString& location );
00127 
00133     void setIconSize(int size);
00134 
00139     int iconSize() const;
00140 
00141 #ifndef KDE_NO_COMPAT
00142 
00145     QString selectIcon(KIcon::Group group=KIcon::Desktop, KIcon::Context
00146         context=KIcon::Application, bool user=false);
00147 #endif
00148 
00153     void setup( KIcon::Group group,
00154                 KIcon::Context context = KIcon::Application,
00155                 bool strictIconSize = false, int iconSize = 0,
00156                 bool user = false );
00157 
00164     QString openDialog();
00165 
00183     static QString getIcon(KIcon::Group group=KIcon::Desktop,
00184                            KIcon::Context context=KIcon::Application,
00185                            bool strictIconSize=false, int iconSize = 0,
00186                            bool user=false, QWidget *parent=0,
00187                            const QString &caption=QString::null);
00188 
00189 private slots:
00190     void slotButtonClicked(int);
00191     void slotContext(int);
00192     void slotStartLoading(int);
00193     void slotProgress(int);
00194     void slotFinished();
00195     void slotAcceptIcons();
00196 private:
00197     void init();
00198     void showIcons();
00199 
00200     int mGroupOrSize;
00201     KIcon::Context mContext;
00202     int mType;
00203 
00204     QStringList mFileList;
00205     QComboBox *mpCombo;
00206     QPushButton *mpBrowseBut;
00207     QRadioButton *mpRb1, *mpRb2;
00208     KProgress *mpProgress;
00209     KIconLoader *mpLoader;
00210     KIconCanvas *mpCanvas;
00211 protected:
00212     virtual void virtual_hook( int id, void* data );
00213 private:
00214     class KIconDialogPrivate;
00215     KIconDialogPrivate *d;
00216 };
00217 
00218 
00227 class KIconButton: public QPushButton
00228 {
00229     Q_OBJECT
00230 
00231 public:
00235     KIconButton(QWidget *parent=0L, const char *name=0L);
00236 
00240     KIconButton(KIconLoader *loader, QWidget *parent, const char *name=0L);
00244     ~KIconButton();
00245 
00251     void setStrictIconSize(bool b);
00255     bool strictIconSize() const;
00256 
00261     void setIconType(KIcon::Group group, KIcon::Context context, bool user=false);
00262 
00266     void setIcon(const QString& icon);
00267 
00271     void resetIcon();
00272 
00276     QString icon() const { return mIcon; }
00277 
00283     void setIconSize( int size );
00284 
00289     int iconSize() const;
00290 
00291 signals:
00295     void iconChanged(QString icon);
00296 
00297 private slots:
00298     void slotChangeIcon();
00299 
00300 private:
00301     bool mbUser;
00302     KIcon::Group mGroup;
00303     KIcon::Context mContext;
00304 
00305     QString mIcon;
00306     KIconDialog *mpDialog;
00307     KIconLoader *mpLoader;
00308     class KIconButtonPrivate;
00309     KIconButtonPrivate *d;
00310 };
00311 
00312 
00313 #endif // __KIconDialog_h__
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:30 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001