TGClient.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGClient.h 25391 2008-09-12 12:40:48Z rdm $
00002 // Author: Fons Rademakers   27/12/97
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGClient
00013 #define ROOT_TGClient
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGClient                                                             //
00019 //                                                                      //
00020 // Window client. In client server windowing systems, like X11 this     //
00021 // class is used to make the initial connection to the window server.   //
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;        // default background color
00058    Pixel_t         fForeColor;        // default foreground color
00059    Pixel_t         fHilite;           // default hilite color
00060    Pixel_t         fShadow;           // default shadow color
00061    Pixel_t         fSelBackColor;     // default selection background color
00062    Pixel_t         fSelForeColor;     // default selection foreground color
00063    Pixel_t         fWhite;            // white color index
00064    Pixel_t         fBlack;            // black color index
00065    TGWindow       *fDefaultRoot;      // default root window (base window of display)
00066    TGWindow       *fRoot;             // current root window (changing root window allows embedding)
00067    Int_t           fXfd;              // file descriptor of connection to server
00068    TGResourcePool *fResourcePool;     // global GUI resource pool
00069    TGGCPool       *fGCPool;           // graphics context pool
00070    TGFontPool     *fFontPool;         // font pool
00071    TGPicturePool  *fPicturePool;      // pixmap pool
00072    TGMimeTypes    *fMimeTypeList;     // mimetype list
00073    Colormap_t      fDefaultColormap;  // default colormap
00074    Bool_t          fGlobalNeedRedraw; // true if at least one window needs to be redrawn
00075    Bool_t          fForceRedraw;      // redraw widgets as soon as possible
00076    THashList      *fWlist;            // list of frames
00077    TList          *fPlist;            // list of popup windows used in HandleMaskEvent()
00078    TList          *fUWHandlers;       // list of event handlers for unknown windows
00079    TList          *fIdleHandlers;     // list of idle handlers
00080    EGEventType     fWaitForEvent;     // event to wait for
00081    Window_t        fWaitForWindow;    // window in which to wait for event
00082 
00083    TGClient(const TGClient&);             // not implemented
00084    TGClient& operator=(const TGClient&);  // not implemented
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);      //*SIGNAL*
00134    void         ProcessedEvent(Event_t *event, Window_t wid);   //*SIGNAL*
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)  // Class making connection to display server
00160 };
00161 
00162 R__EXTERN TGClient *gClient;
00163 
00164 #endif

Generated on Tue Jul 5 14:19:52 2011 for ROOT_528-00b_version by  doxygen 1.5.1