00001 #ifndef ROOT_TQtClientGuard
00002 #define ROOT_TQtClientGuard
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <qobject.h>
00017 #include <qpixmap.h>
00018 #if QT_VERSION < 0x40000
00019 # include <qptrlist.h>
00020 #else
00021 # include <QList>
00022 #endif
00023 #include "TQtClientWidget.h"
00024
00025
00026 class TQtClientGuard : public QObject {
00027 Q_OBJECT
00028 private:
00029 TQtClientGuard& operator=(const TQtClientGuard&);
00030 #if QT_VERSION < 0x40000
00031 mutable QPtrList<QWidget> fQClientGuard;
00032 #else
00033 mutable QList<QWidget *> fQClientGuard;
00034 #endif
00035 int fDeadCounter;
00036 friend class TQtClientWidget;
00037 public:
00038 TQtClientGuard(): QObject(), fDeadCounter(0){};
00039 virtual ~TQtClientGuard(){;}
00040 TQtClientWidget *Create(QWidget* parent=0, const char* name=0, Qt::WFlags f=0 );
00041 void Delete(QWidget *w);
00042 QWidget *Find(Window_t id);
00043 void Add(QWidget *w);
00044
00045 protected:
00046 void Disconnect(QWidget *w, int found=-1);
00047 void DisconnectChildren(TQtClientWidget *w);
00048 protected slots:
00049 void Disconnect();
00050 };
00051
00052 class TQtPixmapGuard : public QObject {
00053 Q_OBJECT
00054 private:
00055 TQtPixmapGuard& operator=(const TQtPixmapGuard&);
00056 #if QT_VERSION < 0x40000
00057 mutable QPtrList<QPixmap> fQClientGuard;
00058 #else
00059 mutable QList<QPixmap *> fQClientGuard;
00060 #endif
00061 int fDeadCounter;
00062 int fLastFound;
00063
00064 public:
00065 TQtPixmapGuard(): QObject(),fDeadCounter(0),fLastFound(-1){};
00066 virtual ~TQtPixmapGuard(){;}
00067 QPixmap* Create(int w, int h, int depth = -1);
00068
00069 QPixmap* Create (const QString &fileName, const char *format = 0);
00070 QPixmap* Create(int w, int h, const uchar *bits, bool isXbitmap=TRUE);
00071 QPixmap* Create(const QPixmap &src);
00072 QBitmap* Create(const QBitmap &src);
00073
00074 QPixmap* Create ( const char* xpm[]);
00075 void Delete(QPixmap *w);
00076 QPixmap *Pixmap(Pixmap_t id,bool needBitmap=kFALSE);
00077 QPixmap *Find(Window_t id);
00078 void Add(QPixmap *w);
00079
00080 protected:
00081 void Disconnect(QPixmap *w, int found=-1);
00082 void SetCurrent(int found) { fLastFound = found;}
00083 protected slots:
00084 void Disconnect();
00085 };
00086
00087 #endif
00088