Back to home page

EIC code displayed by LXR

 
 

    


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 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   27/12/97
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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;        ///< default background color
0043    Pixel_t         fForeColor;        ///< default foreground color
0044    Pixel_t         fHilite;           ///< default highlight color
0045    Pixel_t         fShadow;           ///< default shadow color
0046    Pixel_t         fSelBackColor;     ///< default selection background color
0047    Pixel_t         fSelForeColor;     ///< default selection foreground color
0048    Pixel_t         fWhite;            ///< white color index
0049    Pixel_t         fBlack;            ///< black color index
0050    TGWindow       *fDefaultRoot;      ///< default root window (base window of display)
0051    TGWindow       *fRoot;             ///< current root window (changing root window allows embedding)
0052    Int_t           fXfd;              ///< file descriptor of connection to server
0053    TGResourcePool *fResourcePool;     ///< global GUI resource pool
0054    TGGCPool       *fGCPool;           ///< graphics context pool
0055    TGFontPool     *fFontPool;         ///< font pool
0056    TGPicturePool  *fPicturePool;      ///< pixmap pool
0057    TGMimeTypes    *fMimeTypeList;     ///< mimetype list
0058    Colormap_t      fDefaultColormap;  ///< default colormap
0059    std::atomic<Bool_t> fGlobalNeedRedraw; ///< true if at least one window needs to be redrawn
0060    Bool_t          fForceRedraw;      ///< redraw widgets as soon as possible
0061    THashList      *fWlist;            ///< list of frames
0062    TList          *fPlist;            ///< list of popup windows used in HandleMaskEvent()
0063    TList          *fUWHandlers;       ///< list of event handlers for unknown windows
0064    TList          *fIdleHandlers;     ///< list of idle handlers
0065    EGEventType     fWaitForEvent;     ///< event to wait for
0066    Window_t        fWaitForWindow;    ///< window in which to wait for event
0067    UInt_t          fStyle;            ///< GUI style (modern or classic)
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);      //*SIGNAL*
0122    void         ProcessedEvent(Event_t *event, Window_t wid);   //*SIGNAL*
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)  // Class making connection to display server
0154 };
0155 
0156 #define gClient (TGClient::Instance())
0157 
0158 #endif