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
00032
00033
00037 class KIconCanvas:
public KIconView
00038 {
00039 Q_OBJECT
00040
00041
public:
00042
KIconCanvas(
QWidget *parent=0L,
const char *name=0L);
00043 ~
KIconCanvas();
00044
00048
void loadFiles(
const QStringList& files);
00049
00053
QString getCurrent()
const;
00054
00055
public slots:
00056
void stopLoading();
00057
00058 signals:
00062
void nameChanged(
QString);
00063
00064
00065
void startLoading(
int);
00066
void progress(
int);
00067
void finished();
00068
00069
private slots:
00070
void slotLoadFiles();
00071
void slotCurrentChanged(
QIconViewItem *item);
00072
00073
private:
00074
QStringList mFiles;
00075
QTimer *mpTimer;
00076
KIconLoader *mpLoader;
00077
00078
protected:
00079
virtual void virtual_hook(
int id,
void* data );
00080
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
00168
void setup( KIcon::Group group, KIcon::Context context,
00169
bool strictIconSize,
int iconSize,
bool user,
bool lockUser,
00170
bool lockCustomDir );
00171
00178
QString openDialog();
00179
00184
void showDialog();
00185
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
protected:
00238
virtual void virtual_hook(
int id,
void* data );
00239
private:
00240
class KIconDialogPrivate;
00241 KIconDialogPrivate *d;
00242 };
00243
00244
00253 class KIconButton:
public QPushButton
00254 {
00255 Q_OBJECT
00256
00257
public:
00261
KIconButton(
QWidget *parent=0L,
const char *name=0L);
00262
00266
KIconButton(
KIconLoader *loader,
QWidget *parent,
const char *name=0L);
00270
~KIconButton();
00271
00277
void setStrictIconSize(
bool b);
00281
bool strictIconSize()
const;
00282
00287
void setIconType(KIcon::Group group, KIcon::Context context,
bool user=
false);
00288
00292
void setIcon(
const QString&
icon);
00293
00297
void resetIcon();
00298
00302 QString icon()
const {
return mIcon; }
00303
00309
void setIconSize(
int size );
00310
00315
int iconSize() const;
00316
00317 signals:
00321
void iconChanged(
QString icon);
00322
00323
00324 private slots:
00325
void slotChangeIcon();
00326
void newIconName(const
QString& name);
00327
00328 private:
00329
void init(
KIconLoader *loader );
00330
00331
bool mbUser;
00332
KIcon::Group mGroup;
00333
KIcon::Context mContext;
00334
00335
QString mIcon;
00336
KIconDialog *mpDialog;
00337
KIconLoader *mpLoader;
00338 class KIconButtonPrivate;
00339 KIconButtonPrivate *d;
00340 };
00341
00342
00343 #endif