Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGClient.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 27/12/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGClient
13#define ROOT_TGClient
14
15
16#include "TObject.h"
17#include "GuiTypes.h"
18#include "TString.h"
19#include "TQObject.h"
20
21
22class TList;
23class THashList;
24class TGWindow;
25class TGResourcePool;
26class TGPicturePool;
27class TGPicture;
28class TGGCPool;
29class TGGC;
30class TGFontPool;
31class TGFont;
32class TGMimeTypes;
34class TGIdleHandler;
35
36
37class TGClient : public TObject, public TQObject {
38
39friend class TGCocoa;
40
41protected:
42 Pixel_t fBackColor; ///< default background color
43 Pixel_t fForeColor; ///< default foreground color
44 Pixel_t fHilite; ///< default highlight color
45 Pixel_t fShadow; ///< default shadow color
46 Pixel_t fSelBackColor; ///< default selection background color
47 Pixel_t fSelForeColor; ///< default selection foreground color
48 Pixel_t fWhite; ///< white color index
49 Pixel_t fBlack; ///< black color index
50 TGWindow *fDefaultRoot; ///< default root window (base window of display)
51 TGWindow *fRoot; ///< current root window (changing root window allows embedding)
52 Int_t fXfd; ///< file descriptor of connection to server
53 TGResourcePool *fResourcePool; ///< global GUI resource pool
54 TGGCPool *fGCPool; ///< graphics context pool
55 TGFontPool *fFontPool; ///< font pool
56 TGPicturePool *fPicturePool; ///< pixmap pool
57 TGMimeTypes *fMimeTypeList; ///< mimetype list
58 Colormap_t fDefaultColormap; ///< default colormap
59 std::atomic<Bool_t> fGlobalNeedRedraw; ///< true if at least one window needs to be redrawn
60 Bool_t fForceRedraw; ///< redraw widgets as soon as possible
61 THashList *fWlist; ///< list of frames
62 TList *fPlist; ///< list of popup windows used in HandleMaskEvent()
63 TList *fUWHandlers; ///< list of event handlers for unknown windows
64 TList *fIdleHandlers; ///< list of idle handlers
65 EGEventType fWaitForEvent; ///< event to wait for
66 Window_t fWaitForWindow; ///< window in which to wait for event
67 UInt_t fStyle; ///< GUI style (modern or classic)
68
69 TGClient(const TGClient&) = delete;
70 TGClient& operator=(const TGClient&) = delete;
71
75
76public:
77 TGClient(const char *dpyName = nullptr);
78 ~TGClient() override;
79
80 const TGWindow *GetRoot() const;
81 const TGWindow *GetDefaultRoot() const;
82 void SetRoot(TGWindow *root = nullptr);
84 TGWindow *GetWindowByName(const char *name) const;
85
86 UInt_t GetDisplayWidth() const;
88
89 Bool_t IsEditable() const { return fRoot != fDefaultRoot; }
90 Bool_t IsEditDisabled() const;
92
93 FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault = kTRUE) const;
94 Bool_t GetColorByName(const char *name, Pixel_t &pixel) const;
95 Pixel_t GetHilite(Pixel_t base_color) const;
96 Pixel_t GetShadow(Pixel_t base_color) const;
97 void FreeColor(Pixel_t color) const;
99 void NeedRedraw(TGWindow *w, Bool_t force = kFALSE);
100 void CancelRedraw(TGWindow *w);
103 void RegisterPopup(TGWindow *w);
110 void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2);
111 void WaitFor(TGWindow *w);
112 void WaitForUnmap(TGWindow *w);
113 void ResetWaitFor(TGWindow *w);
118
119 Bool_t HandleEvent(Event_t *event);
121 void RegisteredWindow(Window_t w); //*SIGNAL*
122 void ProcessedEvent(Event_t *event, Window_t wid); //*SIGNAL*
123
125
127 const TGPicture *GetPicture(const char *name);
128 const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
129 void FreePicture(const TGPicture *pic);
130
131 TGGCPool *GetGCPool() const { return fGCPool; }
132 TGGC *GetGC(GCValues_t *values, Bool_t rw = kFALSE);
133 void FreeGC(const TGGC *gc);
134 void FreeGC(GContext_t gc);
135
136 TGFontPool *GetFontPool() const { return fFontPool; }
137 TGFont *GetFont(const char *font, Bool_t fixedDefault = kTRUE);
138 TGFont *GetFont(const TGFont *font);
139 void FreeFont(const TGFont *font);
140
141 UInt_t GetStyle() const { return fStyle; }
142 void SetStyle(UInt_t newstyle) { fStyle = newstyle; }
143 void SetStyle(const char *style);
144
147
148 THashList *GetListOfWindows() const { return fWlist; }
149 TList *GetListOfPopups() const { return fPlist; }
150
151 static TGClient *Instance();
152
153 ClassDefOverride(TGClient,0) // Class making connection to display server
154};
155
156#ifndef __CINT__
157#define gClient (TGClient::Instance())
158#endif
159
160#endif
EGEventType
Definition GuiTypes.h:59
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
Handle_t Colormap_t
Colormap handle.
Definition GuiTypes.h:33
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void FreeColor
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
char name[80]
Definition TGX11.cxx:110
Window client.
Definition TGClient.h:37
Pixel_t fBackColor
default background color
Definition TGClient.h:42
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
Bool_t IsEditable() const
Definition TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
EGEventType fWaitForEvent
event to wait for
Definition TGClient.h:65
TGGCPool * fGCPool
graphics context pool
Definition TGClient.h:54
Bool_t ProcessIdleEvent()
Process one idle event.
Definition TGClient.cxx:680
Bool_t HandleMaskEvent(Event_t *event, Window_t wid)
Handle masked events only if window wid is the window for which the event was reported or if wid is a...
Definition TGClient.cxx:856
Pixel_t fWhite
white color index
Definition TGClient.h:48
void CancelRedraw(TGWindow *w)
Definition TGClient.cxx:386
Pixel_t fHilite
default highlight color
Definition TGClient.h:44
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Definition TGClient.cxx:914
Window_t fWaitForWindow
window in which to wait for event
Definition TGClient.h:66
static TGClient * Instance()
Returns global gClient (initialize graphics first, if not already done)
Definition TGClient.cxx:93
void RegisterPopup(TGWindow *w)
Add a popup menu to the list of popups.
Definition TGClient.cxx:533
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
Definition TGClient.cxx:737
TGFontPool * fFontPool
font pool
Definition TGClient.h:55
void UnregisterPopup(TGWindow *w)
Remove a popup menu from the list of popups.
Definition TGClient.cxx:544
void ResetWaitFor(TGWindow *w)
reset waiting
Definition TGClient.cxx:763
~TGClient() override
Closing down client: cleanup and close X connection.
Definition TGClient.cxx:622
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition TGClient.cxx:320
Colormap_t fDefaultColormap
default colormap
Definition TGClient.h:58
TGResourcePool * fResourcePool
global GUI resource pool
Definition TGClient.h:53
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:348
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition TGClient.cxx:328
void AddUnknownWindowHandler(TGUnknownWindowHandler *h)
Add handler for unknown (i.e. unregistered) windows.
Definition TGClient.cxx:552
Pixel_t fForeColor
default foreground color
Definition TGClient.h:43
void SetStyle(UInt_t newstyle)
Definition TGClient.h:142
Colormap_t GetDefaultColormap() const
Definition TGClient.h:145
void RemoveUnknownWindowHandler(TGUnknownWindowHandler *h)
Remove handler for unknown (i.e. unregistered) windows.
Definition TGClient.cxx:565
UInt_t fStyle
GUI style (modern or classic)
Definition TGClient.h:67
void AddIdleHandler(TGIdleHandler *h)
Add handler for idle events.
Definition TGClient.cxx:573
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
TGMimeTypes * GetMimeTypeList() const
Definition TGClient.h:146
TGClient & operator=(const TGClient &)=delete
void FreeFont(const TGFont *font)
Free a font.
Definition TGClient.cxx:364
TGWindow * fDefaultRoot
default root window (base window of display)
Definition TGClient.h:50
void SetEditDisabled(Bool_t on=kTRUE)
If on is kTRUE editting/guibuilding is forbidden.
Definition TGClient.cxx:943
TList * GetListOfPopups() const
Definition TGClient.h:149
Bool_t ProcessEventsFor(TGWindow *w)
Like gSystem->ProcessEvents() but then only allow events for w to be processed.
Definition TGClient.cxx:773
Bool_t HandleEvent(Event_t *event)
Handle a GUI event.
Definition TGClient.cxx:819
void ForceRedraw()
Definition TGClient.h:98
Bool_t ProcessOneEvent()
Process one event.
Definition TGClient.cxx:646
Pixel_t fSelBackColor
default selection background color
Definition TGClient.h:46
void SetWaitForWindow(Window_t wid)
Definition TGClient.h:116
TGClient(const TGClient &)=delete
void ProcessedEvent(Event_t *event, Window_t wid)
Emits a signal when an event has been processed.
Definition TGClient.cxx:952
TGMimeTypes * fMimeTypeList
mimetype list
Definition TGClient.h:57
Bool_t DoRedraw()
Redraw all windows that need redrawing.
Definition TGClient.cxx:795
UInt_t GetDisplayHeight() const
Get display height.
Definition TGClient.cxx:275
Pixel_t fSelForeColor
default selection foreground color
Definition TGClient.h:47
std::atomic< Bool_t > fGlobalNeedRedraw
true if at least one window needs to be redrawn
Definition TGClient.h:59
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition TGClient.cxx:709
void RegisterWindow(TGWindow *w)
Add a TGWindow to the clients list of windows.
Definition TGClient.cxx:512
TList * fIdleHandlers
list of idle handlers
Definition TGClient.h:64
TGWindow * GetWindowById(Window_t sw) const
Find a TGWindow via its handle. If window is not found return 0.
Definition TGClient.cxx:594
void RegisteredWindow(Window_t w)
Emits a signal when a Window has been registered in TGClient.
Definition TGClient.cxx:965
Pixel_t fBlack
black color index
Definition TGClient.h:49
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:289
Window_t GetWaitForWindow() const
Definition TGClient.h:115
TGGCPool * GetGCPool() const
Definition TGClient.h:131
Pixel_t fShadow
default shadow color
Definition TGClient.h:45
Bool_t GetColorByName(const char *name, Pixel_t &pixel) const
Get a color by name.
Definition TGClient.cxx:395
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:244
Bool_t fForceRedraw
redraw widgets as soon as possible
Definition TGClient.h:60
TGWindow * fRoot
current root window (changing root window allows embedding)
Definition TGClient.h:51
UInt_t GetStyle() const
Definition TGClient.h:141
void RemoveIdleHandler(TGIdleHandler *h)
Remove handler for idle events.
Definition TGClient.cxx:586
Bool_t IsEditDisabled() const
Returns kTRUE if edit/guibuilding is forbidden.
Definition TGClient.cxx:935
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
TList * fPlist
list of popup windows used in HandleMaskEvent()
Definition TGClient.h:62
Pixel_t GetHilite(Pixel_t base_color) const
Return pixel value of hilite color based on base_color.
Definition TGClient.cxx:450
FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault=kTRUE) const
Get a font by name.
Definition TGClient.cxx:425
TList * fUWHandlers
list of event handlers for unknown windows
Definition TGClient.h:63
EGEventType GetWaitForEvent() const
Definition TGClient.h:114
TGPicturePool * fPicturePool
pixmap pool
Definition TGClient.h:56
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
Bool_t HandleInput()
Handles input from the display server.
Definition TGClient.cxx:697
UInt_t GetDisplayWidth() const
Get display width.
Definition TGClient.cxx:262
TGFontPool * GetFontPool() const
Definition TGClient.h:136
THashList * fWlist
list of frames
Definition TGClient.h:61
Pixel_t GetShadow(Pixel_t base_color) const
Return pixel value of shadow color based on base_color.
Definition TGClient.cxx:481
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:308
Int_t fXfd
file descriptor of connection to server
Definition TGClient.h:52
void UnregisterWindow(TGWindow *w)
Remove a TGWindow from the list of windows.
Definition TGClient.cxx:523
THashList * GetListOfWindows() const
Definition TGClient.h:148
TGWindow * GetWindowByName(const char *name) const
Find a TGWindow via its name (unique name used in TGWindow::SavePrimitive).
Definition TGClient.cxx:605
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
Definition TGCocoa.h:58
Provides a pool of fonts.
Definition TGFont.h:217
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
Handle idle events, i.e.
This class handles mime types, used by browsers to map file types to applications and icons.
Definition TGMimeTypes.h:47
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
This class implements a pool for the default GUI resource set, like GC's, colors, fonts,...
Handle events for windows that are not part of the native ROOT GUI.
Definition TGWindow.h:141
ROOT GUI Window base class.
Definition TGWindow.h:23
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
Basic string class.
Definition TString.h:139
Event structure.
Definition GuiTypes.h:174
Graphics context structure.
Definition GuiTypes.h:224