00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ROOT_TGQt
00014 #define ROOT_TGQt
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "TQtRConfig.h"
00027
00028 #ifndef __CINT__
00029 #include <vector>
00030 #include <map>
00031
00032 #include <qobject.h>
00033 #include <QMap>
00034 #include <QColor>
00035 #include <QCursor>
00036 #include <QPainter>
00037 #include <QRect>
00038 #include <qnamespace.h>
00039
00040 #include <QtGui/QPixmap>
00041 #include <QtCore/QEvent>
00042 #include <QtCore/QVector>
00043
00044 #include <QtGui/QFontDatabase>
00045
00046 #include "TQtClientGuard.h"
00047
00048 #else
00049 class QObject;
00050 class QEvent;
00051 #endif
00052
00053 class QPainter;
00054 class QPen;
00055 class QMarker;
00056
00057 class QPaintDevice;
00058 class QTextCodec;
00059 class QPoint;
00060 class QString;
00061 class QSize;
00062 class QColor;
00063
00064
00065 #include "TVirtualX.h"
00066 #include "TQtEmitter.h"
00067
00068 class TQtMarker;
00069
00070 class TQtPen;
00071 class TQtSwitch;
00072 class TQtBrush;
00073 class TQtCommand;
00074 class TFileHandler;
00075 class TQtApplication;
00076 class TQtClientFilter;
00077 class TQtEventQueue;
00078 class TQtPadFont;
00079 class TQtPen;
00080 class TQtPainter;
00081 class TQtFeedBackWidget;
00082
00083
00084 class TQtTextProxy {
00085 private:
00086 TQtTextProxy(const TQtTextProxy&);
00087 void operator=(const TQtTextProxy&);
00088 protected:
00089 TQtTextProxy(){;}
00090 public:
00091 virtual ~TQtTextProxy(){;}
00092 virtual void clear() = 0;
00093
00094 bool setContent(const char *text, QString *errorMsg = 0,
00095 int *errorLine = 0, int *errorColumn = 0);
00096 virtual bool setContent(const QString &text, QString *errorMsg = 0,
00097 int *errorLine = 0, int *errorColumn = 0) = 0;
00098 virtual bool setMmlContent(const QString &text, QString *errorMsg = 0,
00099 int *errorLine = 0, int *errorColumn = 0) = 0;
00100 virtual void paint(QPainter *p,unsigned int x, unsigned int y) const = 0;
00101 virtual unsigned int width() const = 0;
00102 virtual unsigned int height() const = 0;
00103
00104 virtual void setFont(Font_t fontnumber) = 0;
00105
00106 virtual int baseFontPointSize() const = 0;
00107 virtual void setBaseFontPointSize(int size) = 0;
00108 virtual void setForegroundColor(const QColor &) = 0;
00109 virtual bool isMine() const { return false;};
00110 virtual TQtTextProxy *Clone() = 0;
00111 };
00112 inline bool TQtTextProxy::setContent(const char *text, QString *errorMsg,
00113 int *errorLine, int *errorColumn )
00114 { return setContent(QString(text),errorMsg, errorLine, errorColumn); }
00115
00116 class TGQt : public TVirtualX {
00117
00118 #ifndef __CINT__
00119 friend class TQtObject;
00120 friend class TQtWindowsObject;
00121 friend class TQtPixmapObject;
00122 friend class TPadOpenGLView;
00123 friend class TQtWidget;
00124 friend class TQtClientWidget;
00125 friend class TQtImage;
00126 friend class TQtClientGuard;
00127 friend class TQtClientFilter;
00128 friend class TQtSynchPainting;
00129 friend class TQtToggleFeedBack;
00130 friend class TQtColorSelect;
00131 friend class TQt16ColorSelector;
00132 friend class TQtPen;
00133 friend class TQtBrush;
00134 friend class TQtPainter;
00135 friend class TQtTextProxy;
00136
00137 protected:
00138 enum DEFWINDOWID { kDefault=1 };
00139 QPaintDevice *fSelectedWindow;
00140 QPaintDevice *fPrevWindow;
00141 Int_t fDisplayOpened;
00142 TQtPainter *fQPainter;
00143 TQtEmitter fEmitter;
00144 static TVirtualX *fgTQt;
00145
00146 void *fhEvent;
00147
00148 QVector<QCursor *> fCursors;
00149 ECursor fCursor;
00150
00151 Style_t fMarkerStyle;
00152
00153 Int_t fTextAlignH;
00154 Int_t fTextAlignV;
00155 Float_t fCharacterUpX;
00156 Float_t fCharacterUpY;
00157 Int_t fTextFontModified;
00158 Float_t fTextMagnitude;
00159
00160
00161
00162 TQtBrush *fQBrush;
00163 TQtPen *fQPen;
00164 TQtMarker *fQtMarker;
00165 TQtPadFont *fQFont;
00166 QPainter::CompositionMode fDrawMode;
00167
00168 typedef QMap<QPaintDevice *,QRect> TQTCLIPMAP;
00169 TQTCLIPMAP fClipMap;
00170
00171
00172
00173
00174
00175
00176 QMap<Color_t,QColor*> fPallete;
00177 TQtClientFilter *fQClientFilter;
00178 TQtEventQueue *fQClientFilterBuffer;
00179 TQtClientGuard fQClientGuard;
00180 TQtPixmapGuard fQPixmapGuard;
00181 typedef std::map<ULong_t, QColor * > COLORMAP;
00182 COLORMAP fColorMap;
00183 TQtClientWidget *fPointerGrabber;
00184 QTextCodec *fCodec;
00185 QString fFontTextCode;
00186 const char *fSymbolFontFamily;
00187 Int_t fQtEventHasBeenProcessed;
00188 Bool_t fFeedBackMode;
00189 TQtFeedBackWidget *fFeedBackWidget;
00190 Bool_t fBlockRGB;
00191 Bool_t fUseTTF;
00192
00193 static TQtTextProxy *fgTextProxy;
00194
00195
00196
00197
00198
00199
00200
00201 Int_t CreatROOTThread();
00202 void DeleteSelectedObj();
00203
00204
00205 static QRect GetQRect(QPaintDevice &dev);
00206 int UpdateColor(int cindex);
00207 QPaintDevice *GetDoubleBuffer(QPaintDevice *dev);
00208
00209 #endif
00210 static Int_t RegisterWid(QPaintDevice *wid);
00211 static Int_t UnRegisterWid(QPaintDevice *wid);
00212 static Bool_t IsRegistered(QPaintDevice *wid);
00213 private:
00214 TGQt& operator=(const TGQt&);
00215 public:
00216
00217 TGQt();
00218 TGQt(const TGQt &vx): TVirtualX(vx) { MayNotUse("TGQt(const TGQt &)"); }
00219 TGQt(const char *name, const char *title);
00220 virtual ~TGQt();
00221
00222 #include "TVirtualX.interface.h"
00223 #ifndef __CINT__
00224
00225 virtual QPaintDevice *GetSelectedWindow(){ return fSelectedWindow; }
00226 virtual void SetFillStyleIndex( Int_t style, Int_t fasi);
00227 virtual void SetMarkerType( Int_t type, Int_t n, TPoint *xy );
00228 virtual void SetTitle(const char *title);
00229 virtual void CopyPixmap(const QPixmap &p, Int_t px1, Int_t py1);
00230 virtual void SetTextDecoder(const char * ){;}
00231 virtual const QTextCodec *GetTextDecoder();
00232 #endif
00233
00234 virtual void PutByte(Byte_t b);
00235
00236
00237 virtual Bool_t IsHandleValid(Window_t id);
00238
00239
00240
00241 static TQtApplication *CreateQtApplicationImp();
00242 static Int_t iwid(QPaintDevice *wid);
00243 static QPaintDevice *iwid(Int_t wid);
00244 static QPaintDevice *iwid(Window_t wid);
00245 #ifndef __CINT__
00246 #if ROOT_VERSION_CODE < ROOT_VERSION(5,13,0)
00247 static QPixmap *MakeIcon(Int_t indx);
00248 #endif
00249 static TVirtualX *GetVirtualX();
00250 static QWidget *winid(Window_t id);
00251 static QWidget *wid(Window_t id);
00252 static Window_t wid(TQtClientWidget *widget);
00253 static Window_t rootwid(QPaintDevice *dev);
00254 static void PrintEvent(Event_t &);
00255 static QString SetFileName(const QString &fileName);
00256 static QString GetNewFileName(const QString &fileNamePrototype);
00257 static TQtTextProxy *TextProxy();
00258 static void SetTextProxy(TQtTextProxy *proxy);
00259
00260 void SetQClientFilter(TQtClientFilter *filter) {fQClientFilter = filter;}
00261 TQtClientFilter *QClientFilter() const {return fQClientFilter;}
00262 QColor QtColor(ULong_t pixel);
00263 void SendDestroyEvent(TQtClientWidget *) const;
00264
00265 TQtEmitter *Emitter(){ return &fEmitter;}
00266 #endif
00267
00268 virtual void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b, Float_t a);
00269 virtual void SetAlpha(Int_t cindex, Float_t a);
00270 virtual void GetRGBA(Int_t cindex, Float_t &r, Float_t &g, Float_t &b, Float_t &a);
00271 virtual Float_t GetAlpha(Int_t cindex);
00272 virtual const QColor& ColorIndex(Color_t indx) const;
00273
00274 virtual Int_t LoadQt(const char *shareLibFileName);
00275 static void PostQtEvent(QObject *receiver, QEvent *event);
00276 virtual Int_t processQtEvents(Int_t maxtime=300);
00277
00278 private:
00279 static int fgCoinFlag;
00280 static int fgCoinLoaded;
00281 public:
00282 static int CoinFlag();
00283 static void SetCoinFlag(int flag);
00284 static void SetCoinLoaded();
00285 static Int_t IsCoinLoaded();
00286 #ifndef __CINT__
00287 static QString RootFileFormat(const char *selector);
00288 static QString RootFileFormat(const QString &selector);
00289 static QString QtFileFormat(const char *selector);
00290 static QString QtFileFormat(const QString &selector);
00291 #endif
00292
00293 #ifndef Q_MOC_RUN
00294 ClassDef(TGQt,0)
00295 #endif
00296
00297 };
00298
00299 R__EXTERN TGQt *gQt;
00300
00301
00302 #endif