00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGClient
00013 #define ROOT_TGClient
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_GuiTypes
00029 #include "GuiTypes.h"
00030 #endif
00031 #ifndef ROOT_TString
00032 #include "TString.h"
00033 #endif
00034 #ifndef ROOT_TQObject
00035 #include "TQObject.h"
00036 #endif
00037
00038
00039 class TList;
00040 class THashList;
00041 class TGWindow;
00042 class TGResourcePool;
00043 class TGPicturePool;
00044 class TGPicture;
00045 class TGGCPool;
00046 class TGGC;
00047 class TGFontPool;
00048 class TGFont;
00049 class TGMimeTypes;
00050 class TGUnknownWindowHandler;
00051 class TGIdleHandler;
00052
00053
00054 class TGClient : public TObject, public TQObject {
00055
00056 protected:
00057 Pixel_t fBackColor;
00058 Pixel_t fForeColor;
00059 Pixel_t fHilite;
00060 Pixel_t fShadow;
00061 Pixel_t fSelBackColor;
00062 Pixel_t fSelForeColor;
00063 Pixel_t fWhite;
00064 Pixel_t fBlack;
00065 TGWindow *fDefaultRoot;
00066 TGWindow *fRoot;
00067 Int_t fXfd;
00068 TGResourcePool *fResourcePool;
00069 TGGCPool *fGCPool;
00070 TGFontPool *fFontPool;
00071 TGPicturePool *fPicturePool;
00072 TGMimeTypes *fMimeTypeList;
00073 Colormap_t fDefaultColormap;
00074 Bool_t fGlobalNeedRedraw;
00075 Bool_t fForceRedraw;
00076 THashList *fWlist;
00077 TList *fPlist;
00078 TList *fUWHandlers;
00079 TList *fIdleHandlers;
00080 EGEventType fWaitForEvent;
00081 Window_t fWaitForWindow;
00082
00083 TGClient(const TGClient&);
00084 TGClient& operator=(const TGClient&);
00085
00086 Bool_t ProcessOneEvent();
00087 Bool_t ProcessIdleEvent();
00088 Bool_t DoRedraw();
00089
00090 public:
00091 TGClient(const char *dpyName = 0);
00092 virtual ~TGClient();
00093
00094 const TGWindow *GetRoot() const;
00095 const TGWindow *GetDefaultRoot() const;
00096 void SetRoot(TGWindow *root = 0);
00097 TGWindow *GetWindowById(Window_t sw) const;
00098 TGWindow *GetWindowByName(const char *name) const;
00099
00100 UInt_t GetDisplayWidth() const;
00101 UInt_t GetDisplayHeight() const;
00102
00103 Bool_t IsEditable() const { return fRoot != fDefaultRoot; }
00104 Bool_t IsEditDisabled() const;
00105 void SetEditDisabled(Bool_t on = kTRUE);
00106
00107 FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault = kTRUE) const;
00108 Bool_t GetColorByName(const char *name, Pixel_t &pixel) const;
00109 Pixel_t GetHilite(Pixel_t base_color) const;
00110 Pixel_t GetShadow(Pixel_t base_color) const;
00111 void FreeColor(Pixel_t color) const;
00112 void ForceRedraw() { fForceRedraw = kTRUE; }
00113 void NeedRedraw(TGWindow *w, Bool_t force = kFALSE);
00114 void RegisterWindow(TGWindow *w);
00115 void UnregisterWindow(TGWindow *w);
00116 void RegisterPopup(TGWindow *w);
00117 void UnregisterPopup(TGWindow *w);
00118 void AddUnknownWindowHandler(TGUnknownWindowHandler *h);
00119 void RemoveUnknownWindowHandler(TGUnknownWindowHandler *h);
00120 void AddIdleHandler(TGIdleHandler *h);
00121 void RemoveIdleHandler(TGIdleHandler *h);
00122 Bool_t HandleInput();
00123 void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2);
00124 void WaitFor(TGWindow *w);
00125 void WaitForUnmap(TGWindow *w);
00126 void ResetWaitFor(TGWindow *w);
00127 EGEventType GetWaitForEvent() const { return fWaitForEvent;}
00128 Window_t GetWaitForWindow() const { return fWaitForWindow; }
00129 Bool_t ProcessEventsFor(TGWindow *w);
00130
00131 Bool_t HandleEvent(Event_t *event);
00132 Bool_t HandleMaskEvent(Event_t *event, Window_t wid);
00133 void RegisteredWindow(Window_t w);
00134 void ProcessedEvent(Event_t *event, Window_t wid);
00135
00136 const TGResourcePool *GetResourcePool() const { return fResourcePool; }
00137
00138 TGPicturePool *GetPicturePool() const { return fPicturePool; }
00139 const TGPicture *GetPicture(const char *name);
00140 const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
00141 void FreePicture(const TGPicture *pic);
00142
00143 TGGCPool *GetGCPool() const { return fGCPool; }
00144 TGGC *GetGC(GCValues_t *values, Bool_t rw = kFALSE);
00145 void FreeGC(const TGGC *gc);
00146 void FreeGC(GContext_t gc);
00147
00148 TGFontPool *GetFontPool() const { return fFontPool; }
00149 TGFont *GetFont(const char *font, Bool_t fixedDefault = kTRUE);
00150 TGFont *GetFont(const TGFont *font);
00151 void FreeFont(const TGFont *font);
00152
00153 Colormap_t GetDefaultColormap() const { return fDefaultColormap; }
00154 TGMimeTypes *GetMimeTypeList() const { return fMimeTypeList; }
00155
00156 THashList *GetListOfWindows() const { return fWlist; }
00157 TList *GetListOfPopups() const { return fPlist; }
00158
00159 ClassDef(TGClient,0)
00160 };
00161
00162 R__EXTERN TGClient *gClient;
00163
00164 #endif