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
00226
int mGroupOrSize;
00227 KIcon::Context mContext;
00228
int mType;
00229
00230
QStringList mFileList;
00231
QComboBox *mpCombo;
00232
QPushButton *mpBrowseBut;
00233
QRadioButton *mpRb1, *mpRb2;
00234
KProgress *mpProgress;
00235
KIconLoader *mpLoader;
00236 KIconCanvas *mpCanvas;
00237
00238
protected:
00239
virtual void virtual_hook(
int id,
void* data );
00240
private:
00241
class KIconDialogPrivate;
00242 KIconDialogPrivate *d;
00243 };
00244
00245
00254 class KIO_EXPORT KIconButton:
public QPushButton
00255 {
00256 Q_OBJECT
00257 Q_PROPERTY(
QString icon READ icon WRITE setIcon RESET resetIcon )
00258 Q_PROPERTY(
int iconSize READ iconSize WRITE setIconSize)
00259 Q_PROPERTY(
bool strictIconSize READ strictIconSize WRITE setStrictIconSize )
00260
00261
public:
00265 KIconButton(
QWidget *parent=0L,
const char *name=0L);
00266
00270 KIconButton(
KIconLoader *loader,
QWidget *parent,
const char *name=0L);
00274 ~KIconButton();
00275
00281
void setStrictIconSize(
bool b);
00285
bool strictIconSize()
const;
00286
00291
void setIconType(KIcon::Group group, KIcon::Context context,
bool user=
false);
00292
00296
void setIcon(
const QString& icon);
00297
00301
void resetIcon();
00302
00306 QString icon()
const {
return mIcon; }
00307
00313
void setIconSize(
int size );
00314
00319
int iconSize() const;
00320
00321 signals:
00325
void iconChanged(
QString icon);
00326
00327
00328 private slots:
00329
void slotChangeIcon();
00330
void newIconName(const
QString& name);
00331
00332 private:
00333
void init(
KIconLoader *loader );
00334
00335
bool mbUser;
00336
KIcon::Group mGroup;
00337
KIcon::Context mContext;
00338
00339
QString mIcon;
00340 KIconDialog *mpDialog;
00341
KIconLoader *mpLoader;
00342 class KIconButtonPrivate;
00343 KIconButtonPrivate *d;
00344 };
00345
00346
00347 #endif