#ifndef ROOT_TGClient
#define ROOT_TGClient
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_GuiTypes
#include "GuiTypes.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TQObject
#include "TQObject.h"
#endif
class TList;
class THashList;
class TGWindow;
class TGResourcePool;
class TGPicturePool;
class TGPicture;
class TGGCPool;
class TGGC;
class TGFontPool;
class TGFont;
class TGMimeTypes;
class TGUnknownWindowHandler;
class TGIdleHandler;
class TGClient : public TObject, public TQObject {
friend class TGCocoa;
protected:
Pixel_t fBackColor;
Pixel_t fForeColor;
Pixel_t fHilite;
Pixel_t fShadow;
Pixel_t fSelBackColor;
Pixel_t fSelForeColor;
Pixel_t fWhite;
Pixel_t fBlack;
TGWindow *fDefaultRoot;
TGWindow *fRoot;
Int_t fXfd;
TGResourcePool *fResourcePool;
TGGCPool *fGCPool;
TGFontPool *fFontPool;
TGPicturePool *fPicturePool;
TGMimeTypes *fMimeTypeList;
Colormap_t fDefaultColormap;
Bool_t fGlobalNeedRedraw;
Bool_t fForceRedraw;
THashList *fWlist;
TList *fPlist;
TList *fUWHandlers;
TList *fIdleHandlers;
EGEventType fWaitForEvent;
Window_t fWaitForWindow;
UInt_t fStyle;
TGClient(const TGClient&);
TGClient& operator=(const TGClient&);
Bool_t ProcessOneEvent();
Bool_t ProcessIdleEvent();
Bool_t DoRedraw();
public:
TGClient(const char *dpyName = 0);
virtual ~TGClient();
const TGWindow *GetRoot() const;
const TGWindow *GetDefaultRoot() const;
void SetRoot(TGWindow *root = 0);
TGWindow *GetWindowById(Window_t sw) const;
TGWindow *GetWindowByName(const char *name) const;
UInt_t GetDisplayWidth() const;
UInt_t GetDisplayHeight() const;
Bool_t IsEditable() const { return fRoot != fDefaultRoot; }
Bool_t IsEditDisabled() const;
void SetEditDisabled(Bool_t on = kTRUE);
FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault = kTRUE) const;
Bool_t GetColorByName(const char *name, Pixel_t &pixel) const;
Pixel_t GetHilite(Pixel_t base_color) const;
Pixel_t GetShadow(Pixel_t base_color) const;
void FreeColor(Pixel_t color) const;
void ForceRedraw() { fForceRedraw = kTRUE; }
void NeedRedraw(TGWindow *w, Bool_t force = kFALSE);
void CancelRedraw(TGWindow *w);
void RegisterWindow(TGWindow *w);
void UnregisterWindow(TGWindow *w);
void RegisterPopup(TGWindow *w);
void UnregisterPopup(TGWindow *w);
void AddUnknownWindowHandler(TGUnknownWindowHandler *h);
void RemoveUnknownWindowHandler(TGUnknownWindowHandler *h);
void AddIdleHandler(TGIdleHandler *h);
void RemoveIdleHandler(TGIdleHandler *h);
Bool_t HandleInput();
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2);
void WaitFor(TGWindow *w);
void WaitForUnmap(TGWindow *w);
void ResetWaitFor(TGWindow *w);
EGEventType GetWaitForEvent() const { return fWaitForEvent;}
Window_t GetWaitForWindow() const { return fWaitForWindow; }
void SetWaitForWindow(Window_t wid) {fWaitForWindow = wid;}
Bool_t ProcessEventsFor(TGWindow *w);
Bool_t HandleEvent(Event_t *event);
Bool_t HandleMaskEvent(Event_t *event, Window_t wid);
void RegisteredWindow(Window_t w);
void ProcessedEvent(Event_t *event, Window_t wid);
const TGResourcePool *GetResourcePool() const { return fResourcePool; }
TGPicturePool *GetPicturePool() const { return fPicturePool; }
const TGPicture *GetPicture(const char *name);
const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
void FreePicture(const TGPicture *pic);
TGGCPool *GetGCPool() const { return fGCPool; }
TGGC *GetGC(GCValues_t *values, Bool_t rw = kFALSE);
void FreeGC(const TGGC *gc);
void FreeGC(GContext_t gc);
TGFontPool *GetFontPool() const { return fFontPool; }
TGFont *GetFont(const char *font, Bool_t fixedDefault = kTRUE);
TGFont *GetFont(const TGFont *font);
void FreeFont(const TGFont *font);
UInt_t GetStyle() const { return fStyle; }
void SetStyle(UInt_t newstyle) { fStyle = newstyle; }
void SetStyle(const char *style);
Colormap_t GetDefaultColormap() const { return fDefaultColormap; }
TGMimeTypes *GetMimeTypeList() const { return fMimeTypeList; }
THashList *GetListOfWindows() const { return fWlist; }
TList *GetListOfPopups() const { return fPlist; }
ClassDef(TGClient,0)
};
R__EXTERN TGClient *gClient;
#endif