33#include "RConfigure.h"
58static struct AddPseudoGlobals {
76 if (rootlocal && rootlocal->
IsBatch()) {
138 Error(
"TGClient",
"only one instance of TGClient allowed");
330 return fGCPool->GetGC(values, rw);
358 return fFontPool->GetFont(font, fixedDefault);
388 w->fNeedRedraw =
kTRUE;
412 Error(
"GetColorByName",
"couldn't parse color %s",
name);
415 Warning(
"GetColorByName",
"couldn't retrieve color %s.\n"
416 "Please close any other application, like web browsers, "
417 "that might exhaust\nthe colormap and start ROOT again",
name);
421 pixel = color.fPixel;
435 if (
gROOT->IsBatch())
440 if (!font && fixedDefault) {
441 font =
gVirtualX->LoadQueryFont(
"fixed");
443 Warning(
"GetFontByName",
"couldn't retrieve font %s, using \"fixed\"",
name);
447 Error(
"GetFontByName",
"couldn't retrieve font %s nor backup font \"fixed\"",
name);
449 Warning(
"GetFontByName",
"couldn't retrieve font %s",
name);
465 color.fPixel = base_color;
471 color.fRed = std::max((
UShort_t)(white_p.
fRed/5), color.fRed);
472 color.fGreen = std::max((
UShort_t)(white_p.
fGreen/5), color.fGreen);
473 color.fBlue = std::max((
UShort_t)(white_p.
fBlue/5), color.fBlue);
480 Error(
"GetHilite",
"couldn't allocate hilight color");
496 color.fPixel = base_color;
499 color.fRed = (
UShort_t)((color.fRed*60)/100);
500 color.fGreen = (
UShort_t)((color.fGreen*60)/100);
501 color.fBlue = (
UShort_t)((color.fBlue*60)/100);
504 Error(
"GetShadow",
"couldn't allocate shadow color");
618 while ((obj = next())) {
710 handledevent =
kTRUE;
729 gVirtualX->BeginModalSessionFor(w->GetId());
757 gVirtualX->BeginModalSessionFor(w->GetId());
811 if (w->fNeedRedraw) {
852 w->HandleEvent(event);
879 if ((ptr->
fId == wid) ||
887 w->HandleEvent(event);
894 while ((pop = (
TGWindow *) next())) {
896 if ((ptr->
fId == pop->
fId) &&
904 w->HandleEvent(event);
931 snprintf(s,
sizeof(s),
"%ld", parm1);
934 snprintf(s,
sizeof(s),
"%ld", parm2);
966 Emit(
"ProcessedEvent(Event_t*, Window_t)", args);
975 Emit(
"RegisteredWindow(Window_t)", w);
Handle_t GContext_t
Graphics context handle.
Handle_t FontStruct_t
Pointer to font structure.
ULong_t Pixel_t
Pixel value.
Handle_t Window_t
Window handle.
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
externTApplication * gApplication
static TGClient * gClientGlobal
static TGClientInit gClientInit
void TriggerDictionaryInitialization_libGui()
externTFileHandler * gXDisplay
externAtom_t gROOT_MESSAGE
externAtom_t gMOTIF_WM_HINTS
externAtom_t gWM_DELETE_WINDOW
static void NeedGraphicsLibs()
Static method.
Pixel_t fBackColor
default background color
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
const TGWindow * GetRoot() const
Returns current root (i.e.
EGEventType fWaitForEvent
event to wait for
TGGCPool * fGCPool
graphics context pool
Bool_t ProcessIdleEvent()
Process one idle event.
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...
void FreeColor(Pixel_t color) const
Free color.
Pixel_t fWhite
white color index
void CancelRedraw(TGWindow *w)
Pixel_t fHilite
default highlight color
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Window_t fWaitForWindow
window in which to wait for event
static TGClient * Instance()
Returns global gClient (initialize graphics first, if not already done).
void RegisterPopup(TGWindow *w)
Add a popup menu to the list of popups.
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
TGFontPool * fFontPool
font pool
void UnregisterPopup(TGWindow *w)
Remove a popup menu from the list of popups.
void ResetWaitFor(TGWindow *w)
reset waiting
~TGClient() override
Closing down client: cleanup and close X connection.
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Colormap_t fDefaultColormap
default colormap
TGResourcePool * fResourcePool
global GUI resource pool
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
void FreeGC(const TGGC *gc)
Free a graphics context.
void AddUnknownWindowHandler(TGUnknownWindowHandler *h)
Add handler for unknown (i.e. unregistered) windows.
Pixel_t fForeColor
default foreground color
void SetStyle(UInt_t newstyle)
void RemoveUnknownWindowHandler(TGUnknownWindowHandler *h)
Remove handler for unknown (i.e. unregistered) windows.
UInt_t fStyle
GUI style (modern or classic).
void AddIdleHandler(TGIdleHandler *h)
Add handler for idle events.
void FreeFont(const TGFont *font)
Free a font.
TGWindow * fDefaultRoot
default root window (base window of display)
void SetEditDisabled(Bool_t on=kTRUE)
If on is kTRUE editting/guibuilding is forbidden.
Bool_t ProcessEventsFor(TGWindow *w)
Like gSystem->ProcessEvents() but then only allow events for w to be processed.
Bool_t HandleEvent(Event_t *event)
Handle a GUI event.
Bool_t ProcessOneEvent()
Process one event.
Pixel_t fSelBackColor
default selection background color
TGClient(const TGClient &)=delete
void ProcessedEvent(Event_t *event, Window_t wid)
Emits a signal when an event has been processed.
TGMimeTypes * fMimeTypeList
mimetype list
Bool_t DoRedraw()
Redraw all windows that need redrawing.
UInt_t GetDisplayHeight() const
Get display height.
Pixel_t fSelForeColor
default selection foreground color
std::atomic< Bool_t > fGlobalNeedRedraw
true if at least one window needs to be redrawn
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
void RegisterWindow(TGWindow *w)
Add a TGWindow to the clients list of windows.
TList * fIdleHandlers
list of idle handlers
const TGPicture * GetPictureOrEmpty(const char *name)
Like TGPicturePool::GetPicture() but, instead of returning null when the picture is not found,...
TGWindow * GetWindowById(Window_t sw) const
Find a TGWindow via its handle. If window is not found return 0.
void RegisteredWindow(Window_t w)
Emits a signal when a Window has been registered in TGClient.
Pixel_t fBlack
black color index
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Pixel_t fShadow
default shadow color
Bool_t GetColorByName(const char *name, Pixel_t &pixel) const
Get a color by name.
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Bool_t fForceRedraw
redraw widgets as soon as possible
TGWindow * fRoot
current root window (changing root window allows embedding)
void RemoveIdleHandler(TGIdleHandler *h)
Remove handler for idle events.
Bool_t IsEditDisabled() const
Returns kTRUE if edit/guibuilding is forbidden.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
TList * fPlist
list of popup windows used in HandleMaskEvent()
Pixel_t GetHilite(Pixel_t base_color) const
Return pixel value of hilite color based on base_color.
FontStruct_t GetFontByName(const char *name, Bool_t fixedDefault=kTRUE) const
Get a font by name.
TList * fUWHandlers
list of event handlers for unknown windows
TGPicturePool * fPicturePool
pixmap pool
Bool_t HandleInput()
Handles input from the display server.
UInt_t GetDisplayWidth() const
Get display width.
THashList * fWlist
list of frames
Pixel_t GetShadow(Pixel_t base_color) const
Return pixel value of shadow color based on base_color.
void FreePicture(const TGPicture *pic)
Free picture resource.
Int_t fXfd
file descriptor of connection to server
void UnregisterWindow(TGWindow *w)
Remove a TGWindow from the list of windows.
TGWindow * GetWindowByName(const char *name) const
Find a TGWindow via its name (unique name used in TGWindow::SavePrimitive).
Encapsulate fonts used in the GUI system.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Encapsulate a graphics context used in the low level graphics.
virtual Bool_t HandleEvent()
Handle the idle event.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
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.
virtual Bool_t HandleEvent(Event_t *)=0
ROOT GUI Window base class.
const TGWindow * fParent
Parent window.
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * Next() override
Return next object in the list. Returns 0 when no more objects in list.
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TObject()
TObject constructor.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
ROOT top level object description.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)
EGEventType fType
of event (see EGEventType)
Window_t fWindow
window reported event is relative to
Graphics context structure.
Window attributes that can be inquired.
Colormap_t fColormap
color map to be associated with window