Warning, file /include/root/TGClient.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGClient
0013 #define ROOT_TGClient
0014
0015
0016 #include "TObject.h"
0017 #include "GuiTypes.h"
0018 #include "TString.h"
0019 #include "TQObject.h"
0020
0021
0022 class TList;
0023 class THashList;
0024 class TGWindow;
0025 class TGResourcePool;
0026 class TGPicturePool;
0027 class TGPicture;
0028 class TGGCPool;
0029 class TGGC;
0030 class TGFontPool;
0031 class TGFont;
0032 class TGMimeTypes;
0033 class TGUnknownWindowHandler;
0034 class TGIdleHandler;
0035
0036
0037 class TGClient : public TObject, public TQObject {
0038
0039 friend class TGCocoa;
0040
0041 protected:
0042 Pixel_t fBackColor;
0043 Pixel_t fForeColor;
0044 Pixel_t fHilite;
0045 Pixel_t fShadow;
0046 Pixel_t fSelBackColor;
0047 Pixel_t fSelForeColor;
0048 Pixel_t fWhite;
0049 Pixel_t fBlack;
0050 TGWindow *fDefaultRoot;
0051 TGWindow *fRoot;
0052 Int_t fXfd;
0053 TGResourcePool *fResourcePool;
0054 TGGCPool *fGCPool;
0055 TGFontPool *fFontPool;
0056 TGPicturePool *fPicturePool;
0057 TGMimeTypes *fMimeTypeList;
0058 Colormap_t fDefaultColormap;
0059 std::atomic<Bool_t> fGlobalNeedRedraw;
0060 Bool_t fForceRedraw;
0061 THashList *fWlist;
0062 TList *fPlist;
0063 TList *fUWHandlers;
0064 TList *fIdleHandlers;
0065 EGEventType fWaitForEvent;
0066 Window_t fWaitForWindow;
0067 UInt_t fStyle;
0068
0069 TGClient(const TGClient&) = delete;
0070 TGClient& operator=(const TGClient&) = delete;
0071
0072 Bool_t ProcessOneEvent();
0073 Bool_t ProcessIdleEvent();
0074 Bool_t DoRedraw();
0075
0076 public:
0077 TGClient(const char *dpyName = nullptr);
0078 ~TGClient() override;
0079
0080 const TGWindow *GetRoot() const;
0081 const TGWindow *GetDefaultRoot() const;
0082 void SetRoot(TGWindow *root = nullptr);
0083 TGWindow *GetWindowById(Window_t sw) const;
0084 TGWindow *GetWindowByName(const char *name) const;
0085
0086 UInt_t GetDisplayWidth() const;
0087 UInt_t GetDisplayHeight() const;
0088
0089 Bool_t IsEditable() const { return fRoot != fDefaultRoot; }
0090 Bool_t IsEditDisabled() const;
0091 void SetEditDisabled(Bool_t on = kTRUE);
0092
0093 FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault = kTRUE) const;
0094 Bool_t GetColorByName(const char *name, Pixel_t &pixel) const;
0095 Pixel_t GetHilite(Pixel_t base_color) const;
0096 Pixel_t GetShadow(Pixel_t base_color) const;
0097 void FreeColor(Pixel_t color) const;
0098 void ForceRedraw() { fForceRedraw = kTRUE; }
0099 void NeedRedraw(TGWindow *w, Bool_t force = kFALSE);
0100 void CancelRedraw(TGWindow *w);
0101 void RegisterWindow(TGWindow *w);
0102 void UnregisterWindow(TGWindow *w);
0103 void RegisterPopup(TGWindow *w);
0104 void UnregisterPopup(TGWindow *w);
0105 void AddUnknownWindowHandler(TGUnknownWindowHandler *h);
0106 void RemoveUnknownWindowHandler(TGUnknownWindowHandler *h);
0107 void AddIdleHandler(TGIdleHandler *h);
0108 void RemoveIdleHandler(TGIdleHandler *h);
0109 Bool_t HandleInput();
0110 void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2);
0111 void WaitFor(TGWindow *w);
0112 void WaitForUnmap(TGWindow *w);
0113 void ResetWaitFor(TGWindow *w);
0114 EGEventType GetWaitForEvent() const { return fWaitForEvent;}
0115 Window_t GetWaitForWindow() const { return fWaitForWindow; }
0116 void SetWaitForWindow(Window_t wid) {fWaitForWindow = wid;}
0117 Bool_t ProcessEventsFor(TGWindow *w);
0118
0119 Bool_t HandleEvent(Event_t *event);
0120 Bool_t HandleMaskEvent(Event_t *event, Window_t wid);
0121 void RegisteredWindow(Window_t w);
0122 void ProcessedEvent(Event_t *event, Window_t wid);
0123
0124 const TGResourcePool *GetResourcePool() const { return fResourcePool; }
0125
0126 TGPicturePool *GetPicturePool() const { return fPicturePool; }
0127 const TGPicture *GetPicture(const char *name);
0128 const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
0129 void FreePicture(const TGPicture *pic);
0130
0131 TGGCPool *GetGCPool() const { return fGCPool; }
0132 TGGC *GetGC(GCValues_t *values, Bool_t rw = kFALSE);
0133 void FreeGC(const TGGC *gc);
0134 void FreeGC(GContext_t gc);
0135
0136 TGFontPool *GetFontPool() const { return fFontPool; }
0137 TGFont *GetFont(const char *font, Bool_t fixedDefault = kTRUE);
0138 TGFont *GetFont(const TGFont *font);
0139 void FreeFont(const TGFont *font);
0140
0141 UInt_t GetStyle() const { return fStyle; }
0142 void SetStyle(UInt_t newstyle) { fStyle = newstyle; }
0143 void SetStyle(const char *style);
0144
0145 Colormap_t GetDefaultColormap() const { return fDefaultColormap; }
0146 TGMimeTypes *GetMimeTypeList() const { return fMimeTypeList; }
0147
0148 THashList *GetListOfWindows() const { return fWlist; }
0149 TList *GetListOfPopups() const { return fPlist; }
0150
0151 static TGClient *Instance();
0152
0153 ClassDefOverride(TGClient,0)
0154 };
0155
0156 #define gClient (TGClient::Instance())
0157
0158 #endif