kio
kicondialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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
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
00203 static QString getIcon(KIcon::Group group=KIcon::Desktop,
00204 KIcon::Context context=KIcon::Application,
00205 bool strictIconSize=false, int iconSize = 0,
00206 bool user=false, QWidget *parent=0,
00207 const QString &caption=QString::null);
00208
00209 signals:
00210 void newIconName(const QString&);
00211
00212 protected slots:
00213 void slotOk();
00214
00215 private slots:
00216 void slotButtonClicked(int);
00217 void slotContext(int);
00218 void slotStartLoading(int);
00219 void slotProgress(int);
00220 void slotFinished();
00221 void slotAcceptIcons();
00222 private:
00223 void init();
00224 void showIcons();
00225 void setContext( KIcon::Context context );
00226
00227 int mGroupOrSize;
00228 KIcon::Context mContext;
00229 int mType;
00230
00231 QStringList mFileList;
00232 QComboBox *mpCombo;
00233 QPushButton *mpBrowseBut;
00234 QRadioButton *mpRb1, *mpRb2;
00235 KProgress *mpProgress;
00236 KIconLoader *mpLoader;
00237 KIconCanvas *mpCanvas;
00238 int mNumContext;
00239 KIcon::Context mContextMap[ 12 ];
00240
00241 protected:
00242 virtual void virtual_hook( int id, void* data );
00243 private:
00244 class KIconDialogPrivate;
00245 KIconDialogPrivate *d;
00246 };
00247
00248
00257 class KIO_EXPORT KIconButton: public QPushButton
00258 {
00259 Q_OBJECT
00260 Q_PROPERTY( QString icon READ icon WRITE setIcon RESET resetIcon )
00261 Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize)
00262 Q_PROPERTY( bool strictIconSize READ strictIconSize WRITE setStrictIconSize )
00263
00264 public:
00268 KIconButton(QWidget *parent=0L, const char *name=0L);
00269
00273 KIconButton(KIconLoader *loader, QWidget *parent, const char *name=0L);
00277 ~KIconButton();
00278
00284 void setStrictIconSize(bool b);
00288 bool strictIconSize() const;
00289
00294 void setIconType(KIcon::Group group, KIcon::Context context, bool user=false);
00295
00299 void setIcon(const QString& icon);
00300
00304 void resetIcon();
00305
00309 QString icon() const { return mIcon; }
00310
00316 void setIconSize( int size );
00317
00322 int iconSize() const;
00323
00324 signals:
00328 void iconChanged(QString icon);
00329
00330
00331 private slots:
00332 void slotChangeIcon();
00333 void newIconName(const QString& name);
00334
00335 private:
00336 void init( KIconLoader *loader );
00337
00338 bool mbUser;
00339 KIcon::Group mGroup;
00340 KIcon::Context mContext;
00341
00342 QString mIcon;
00343 KIconDialog *mpDialog;
00344 KIconLoader *mpLoader;
00345 class KIconButtonPrivate;
00346 KIconButtonPrivate *d;
00347 };
00348
00349
00350 #endif // __KIconDialog_h__