kio Library API Documentation

kicondialog.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * This file is part of the KDE project, module kfile.
00004  * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
00005  *           (C) 2000 Kurt Granroth <granroth@kde.org>
00006  *           (C) 1997 Christoph Neerfeld <chris@kde.org>
00007  *           (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
00008  *
00009  * This is free software; it comes under the GNU Library General
00010  * Public License, version 2. See the file "COPYING.LIB" for the
00011  * exact licensing terms.
00012  */
00013 
00014 #ifndef __KIconDialog_h__
00015 #define __KIconDialog_h__
00016 
00017 #include <qstring.h>
00018 #include <qstringlist.h>
00019 #include <qpushbutton.h>
00020 
00021 #include <kicontheme.h>
00022 #include <kdialogbase.h>
00023 #include <kiconview.h>
00024 
00025 class QComboBox;
00026 class QTimer;
00027 class QKeyEvent;
00028 class QRadioButton;
00029 class KProgress;
00030 class KIconLoader;
00031 
00035 class KIO_EXPORT KIconCanvas: public KIconView
00036 {
00037     Q_OBJECT
00038 
00039 public:
00040     KIconCanvas(QWidget *parent=0L, const char *name=0L);
00041     ~KIconCanvas();
00042 
00046     void loadFiles(const QStringList& files);
00047 
00051     QString getCurrent() const;
00052 
00053 public slots:
00054     void stopLoading();
00055 
00056 signals:
00060     void nameChanged(QString);
00061     /* KDE 4: Make it const QString & */
00062 
00063     void startLoading(int);
00064     void progress(int);
00065     void finished();
00066 
00067 private slots:
00068     void slotLoadFiles();
00069     void slotCurrentChanged(QIconViewItem *item);
00070 
00071 private:
00072     QStringList mFiles;
00073     QTimer *mpTimer;
00074     KIconLoader *mpLoader;
00075 
00076 protected:
00077     virtual void virtual_hook( int id, void* data );
00078 
00079 private:
00080     class KIconCanvasPrivate;
00081     KIconCanvasPrivate *d;
00082 };
00083 
00084 
00091 class KIO_EXPORT KIconDialog: public KDialogBase
00092 {
00093     Q_OBJECT
00094 
00095 public:
00099     KIconDialog(QWidget *parent=0L, const char *name=0L);
00103     KIconDialog(KIconLoader *loader, QWidget *parent=0,
00104         const char *name=0);
00108     ~KIconDialog();
00109 
00116     void setStrictIconSize(bool b);
00120     bool strictIconSize() const;
00125     void setCustomLocation( const QString& location );
00126 
00132     void setIconSize(int size);
00133 
00138     int iconSize() const;
00139 
00140 #ifndef KDE_NO_COMPAT
00141 
00144     QString selectIcon(KIcon::Group group=KIcon::Desktop, KIcon::Context
00145         context=KIcon::Application, bool user=false);
00146 #endif
00147 
00152     void setup( KIcon::Group group,
00153                 KIcon::Context context = KIcon::Application,
00154                 bool strictIconSize = false, int iconSize = 0,
00155                 bool user = false );
00156 
00166     void setup( KIcon::Group group, KIcon::Context context,
00167                 bool strictIconSize, int iconSize, bool user, bool lockUser,
00168                 bool lockCustomDir );
00169 
00176     QString openDialog();
00177 
00182     void showDialog();
00183 
00201     static QString getIcon(KIcon::Group group=KIcon::Desktop,
00202                            KIcon::Context context=KIcon::Application,
00203                            bool strictIconSize=false, int iconSize = 0,
00204                            bool user=false, QWidget *parent=0,
00205                            const QString &caption=QString::null);
00206 
00207 signals:
00208     void newIconName(const QString&);
00209 
00210 protected slots:
00211     void slotOk();
00212 
00213 private slots:
00214     void slotButtonClicked(int);
00215     void slotContext(int);
00216     void slotStartLoading(int);
00217     void slotProgress(int);
00218     void slotFinished();
00219     void slotAcceptIcons();
00220 private:
00221     void init();
00222     void showIcons();
00223 
00224     int mGroupOrSize;
00225     KIcon::Context mContext;
00226     int mType;
00227 
00228     QStringList mFileList;
00229     QComboBox *mpCombo;
00230     QPushButton *mpBrowseBut;
00231     QRadioButton *mpRb1, *mpRb2;
00232     KProgress *mpProgress;
00233     KIconLoader *mpLoader;
00234     KIconCanvas *mpCanvas;
00235 
00236 protected:
00237     virtual void virtual_hook( int id, void* data );
00238 private:
00239     class KIconDialogPrivate;
00240     KIconDialogPrivate *d;
00241 };
00242 
00243 
00252 class KIO_EXPORT KIconButton: public QPushButton
00253 {
00254     Q_OBJECT
00255 
00256 public:
00260     KIconButton(QWidget *parent=0L, const char *name=0L);
00261 
00265     KIconButton(KIconLoader *loader, QWidget *parent, const char *name=0L);
00269     ~KIconButton();
00270 
00276     void setStrictIconSize(bool b);
00280     bool strictIconSize() const;
00281 
00286     void setIconType(KIcon::Group group, KIcon::Context context, bool user=false);
00287 
00291     void setIcon(const QString& icon);
00292 
00296     void resetIcon();
00297 
00301     QString icon() const { return mIcon; }
00302 
00308     void setIconSize( int size );
00309 
00314     int iconSize() const;
00315 
00316 signals:
00320     void iconChanged(QString icon);
00321     /* KDE 4: Make it const QString & */
00322 
00323 private slots:
00324     void slotChangeIcon();
00325     void newIconName(const QString& name);
00326 
00327 private:
00328     void init( KIconLoader *loader );
00329 
00330     bool mbUser;
00331     KIcon::Group mGroup;
00332     KIcon::Context mContext;
00333 
00334     QString mIcon;
00335     KIconDialog *mpDialog;
00336     KIconLoader *mpLoader;
00337     class KIconButtonPrivate;
00338     KIconButtonPrivate *d;
00339 };
00340 
00341 
00342 #endif // __KIconDialog_h__
KDE Logo
This file is part of the documentation for kio Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:15:29 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003