kio Library API Documentation

kicondialog.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicondialog.h,v 1.22 2003/11/25 08:07:05 aseigo 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     /* KDE 4: Make it const QString & */
00066 
00067     void startLoading(int);
00068     void progress(int);
00069     void finished();
00070 
00071 private slots:
00072     void slotLoadFiles();
00073     void slotCurrentChanged(QIconViewItem *item);
00074 
00075 private:
00076     QStringList mFiles;
00077     QTimer *mpTimer;
00078     KIconLoader *mpLoader;
00079 protected:
00080     virtual void virtual_hook( int id, void* data );
00081 private:
00082     class KIconCanvasPrivate;
00083     KIconCanvasPrivate *d;
00084 };
00085 
00086 
00093 class KIconDialog: public KDialogBase
00094 {
00095     Q_OBJECT
00096 
00097 public:
00101     KIconDialog(QWidget *parent=0L, const char *name=0L);
00105     KIconDialog(KIconLoader *loader, QWidget *parent=0,
00106         const char *name=0);
00110     ~KIconDialog();
00111 
00118     void setStrictIconSize(bool b);
00122     bool strictIconSize() const;
00127     void setCustomLocation( const QString& location );
00128 
00134     void setIconSize(int size);
00135 
00140     int iconSize() const;
00141 
00142 #ifndef KDE_NO_COMPAT
00143 
00146     QString selectIcon(KIcon::Group group=KIcon::Desktop, KIcon::Context
00147         context=KIcon::Application, bool user=false);
00148 #endif
00149 
00154     void setup( KIcon::Group group,
00155                 KIcon::Context context = KIcon::Application,
00156                 bool strictIconSize = false, int iconSize = 0,
00157                 bool user = false );
00158 
00165     QString openDialog();
00166 
00171     void showDialog();
00172 
00190     static QString getIcon(KIcon::Group group=KIcon::Desktop,
00191                            KIcon::Context context=KIcon::Application,
00192                            bool strictIconSize=false, int iconSize = 0,
00193                            bool user=false, QWidget *parent=0,
00194                            const QString &caption=QString::null);
00195 
00196 signals:
00197     void newIconName(const QString&);
00198 
00199 protected slots:
00200     void slotOk();
00201 
00202 private slots:
00203     void slotButtonClicked(int);
00204     void slotContext(int);
00205     void slotStartLoading(int);
00206     void slotProgress(int);
00207     void slotFinished();
00208     void slotAcceptIcons();
00209 private:
00210     void init();
00211     void showIcons();
00212 
00213     int mGroupOrSize;
00214     KIcon::Context mContext;
00215     int mType;
00216 
00217     QStringList mFileList;
00218     QComboBox *mpCombo;
00219     QPushButton *mpBrowseBut;
00220     QRadioButton *mpRb1, *mpRb2;
00221     KProgress *mpProgress;
00222     KIconLoader *mpLoader;
00223     KIconCanvas *mpCanvas;
00224 protected:
00225     virtual void virtual_hook( int id, void* data );
00226 private:
00227     class KIconDialogPrivate;
00228     KIconDialogPrivate *d;
00229 };
00230 
00231 
00240 class KIconButton: public QPushButton
00241 {
00242     Q_OBJECT
00243 
00244 public:
00248     KIconButton(QWidget *parent=0L, const char *name=0L);
00249 
00253     KIconButton(KIconLoader *loader, QWidget *parent, const char *name=0L);
00257     ~KIconButton();
00258 
00264     void setStrictIconSize(bool b);
00268     bool strictIconSize() const;
00269 
00274     void setIconType(KIcon::Group group, KIcon::Context context, bool user=false);
00275 
00279     void setIcon(const QString& icon);
00280 
00284     void resetIcon();
00285 
00289     QString icon() const { return mIcon; }
00290 
00296     void setIconSize( int size );
00297 
00302     int iconSize() const;
00303 
00304 signals:
00308     void iconChanged(QString icon);
00309     /* KDE 4: Make it const QString & */
00310 
00311 private slots:
00312     void slotChangeIcon();
00313     void newIconName(const QString& name);
00314 
00315 private:
00316     bool mbUser;
00317     KIcon::Group mGroup;
00318     KIcon::Context mContext;
00319 
00320     QString mIcon;
00321     KIconDialog *mpDialog;
00322     KIconLoader *mpLoader;
00323     class KIconButtonPrivate;
00324     KIconButtonPrivate *d;
00325 };
00326 
00327 
00328 #endif // __KIconDialog_h__
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Jan 21 09:57:54 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003