Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGWindow.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 28/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_TGWindow
13#define ROOT_TGWindow
14
15
16#include "TGObject.h"
17#include "TGClient.h"
18
19class TGClient;
20class TGIdleHandler;
21
22
23class TGWindow : public TGObject {
24
25friend class TGClient;
26
27protected:
28 const TGWindow *fParent; ///< Parent window
29 Bool_t fNeedRedraw; ///< kTRUE if window needs to be redrawn
30 TString fName; ///< name of the window used in SavePrimitive()
31 static Int_t fgCounter; ///< counter of created windows in SavePrimitive
32 UInt_t fEditDisabled; ///< flags used for "guibuilding"
33
35 fParent(nullptr), fNeedRedraw(kFALSE), fName(), fEditDisabled(0) { fClient = nullptr; fId = id; }
36 TGWindow(const TGWindow& tgw) :
39
41 {
42 if (this != &tgw) {
44 fParent = tgw.fParent;
46 fName = tgw.fName;
48 }
49 return *this;
50 }
51
52 virtual void DoRedraw() { }
53
54public:
55 enum EEditMode {
56 kEditEnable = 0, ///< allow edit of this window
57 kEditDisable = BIT(0), ///< disable edit of this window
58 kEditDisableEvents = BIT(1), ///< window events cannot be edited
59 kEditDisableGrab = BIT(2), ///< window grab cannot be edited
60 kEditDisableLayout = BIT(3), ///< window layout cannot be edited
61 kEditDisableResize = BIT(4), ///< window size cannot be edited
62 kEditDisableHeight = BIT(5), ///< window height cannot be edited
63 kEditDisableWidth = BIT(6), ///< window width cannot be edited
64 kEditDisableBtnEnable = BIT(7), ///< window can handle mouse button events
65 kEditDisableKeyEnable = BIT(8) ///< window can handle keyboard events
66 };
67
69 kIsHtmlView = BIT(14)
70 };
71
72 TGWindow(const TGWindow *p = nullptr, Int_t x = 0, Int_t y = 0,
73 UInt_t w = 0, UInt_t h = 0, UInt_t border = 0,
74 Int_t depth = 0,
75 UInt_t clss = 0,
76 void *visual = nullptr,
77 SetWindowAttributes_t *attr = nullptr,
78 UInt_t wtype = 0);
79 TGWindow(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
80
81 ~TGWindow() override;
82
83 const TGWindow *GetParent() const { return fParent; }
84 virtual const TGWindow *GetMainFrame() const;
85
86 virtual void MapWindow();
87 virtual void MapSubwindows();
88 virtual void MapRaised();
89 virtual void UnmapWindow();
90 virtual void DestroyWindow();
91 virtual void DestroySubwindows();
92 virtual void RaiseWindow();
93 virtual void LowerWindow();
94 virtual void IconifyWindow();
95 virtual void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0);
96 virtual void RequestFocus();
97
98 virtual void SetBackgroundColor(Pixel_t color);
99 virtual void SetBackgroundPixmap(Pixmap_t pixmap);
100
102 { if (event->fCount == 0) fClient->NeedRedraw(this); return kTRUE; }
103 virtual Bool_t HandleEvent(Event_t *) { return kFALSE; }
104 Bool_t HandleTimer(TTimer *) override { return kFALSE; }
106
107 virtual void Move(Int_t x, Int_t y);
108 virtual void Resize(UInt_t w, UInt_t h);
109 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
110 virtual Bool_t IsMapped();
111 virtual Bool_t IsEditable() const { return (fClient->GetRoot() == this); }
112 virtual UInt_t GetEditDisabled() const { return fEditDisabled; }
114 virtual void SetEditable(Bool_t on = kTRUE)
115 { if (!(fEditDisabled & kEditDisable)) fClient->SetRoot(on ? this : nullptr); }
116 virtual Int_t MustCleanup() const { return 0; }
117 void Print(Option_t *option="") const override;
118
119 virtual void SetWindowName(const char *name = nullptr);
120 const char *GetName() const override;
121 virtual void SetName(const char *name) { fName = name; }
122
123 virtual void SetMapSubwindows(Bool_t /*on*/) { }
124 virtual Bool_t IsMapSubwindows() const { return kTRUE; }
125
126 static Int_t GetCounter();
127
128 ClassDefOverride(TGWindow, 0); // GUI Window base class
129};
130
131
132/** \class TGUnknownWindowHandler
133 \ingroup guiwidgets
134
135Handle events for windows that are not part of the native ROOT GUI.
136Typically windows created by Xt or Motif.
137
138*/
139
140
142
143public:
146
147 virtual Bool_t HandleEvent(Event_t *) = 0;
148
149 ClassDefOverride(TGUnknownWindowHandler,0) // Abstract event handler for unknown windows
150};
151
152#endif
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
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 char Point_t Rectangle_t WindowAttributes_t attr
char name[80]
Definition TGX11.cxx:110
Window client.
Definition TGClient.h:37
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:244
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
Handle idle events, i.e.
This class is the baseclass for all ROOT GUI widgets.
Definition TGObject.h:21
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
TGObject & operator=(const TGObject &tgo)
Definition TGObject.h:27
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
Handle events for windows that are not part of the native ROOT GUI.
Definition TGWindow.h:141
~TGUnknownWindowHandler() override
Definition TGWindow.h:145
virtual Bool_t HandleEvent(Event_t *)=0
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
virtual void Move(Int_t x, Int_t y)
Move the window.
Definition TGWindow.cxx:271
virtual void DoRedraw()
Definition TGWindow.h:52
virtual Bool_t HandleEvent(Event_t *)
Definition TGWindow.h:103
Bool_t HandleTimer(TTimer *) override
Execute action in response of a timer timing out.
Definition TGWindow.h:104
TGWindow(const TGWindow &tgw)
Definition TGWindow.h:36
virtual void MapRaised()
map raised
Definition TGWindow.cxx:176
static Int_t fgCounter
counter of created windows in SavePrimitive
Definition TGWindow.h:31
virtual Bool_t HandleIdleEvent(TGIdleHandler *)
Definition TGWindow.h:105
TGWindow & operator=(const TGWindow &tgw)
Definition TGWindow.h:40
void Print(Option_t *option="") const override
Print window id.
Definition TGWindow.cxx:307
virtual UInt_t GetEditDisabled() const
Definition TGWindow.h:112
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition TGWindow.cxx:248
virtual void RequestFocus()
request focus
Definition TGWindow.cxx:232
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h:113
virtual Bool_t HandleExpose(Event_t *event)
Definition TGWindow.h:101
virtual void SetName(const char *name)
Definition TGWindow.h:121
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
virtual void DestroySubwindows()
destroy sub windows
Definition TGWindow.cxx:200
virtual void SetMapSubwindows(Bool_t)
Definition TGWindow.h:123
virtual void SetEditable(Bool_t on=kTRUE)
Definition TGWindow.h:114
virtual Int_t MustCleanup() const
Definition TGWindow.h:116
@ kEditDisableResize
window size cannot be edited
Definition TGWindow.h:61
@ kEditDisableHeight
window height cannot be edited
Definition TGWindow.h:62
@ kEditEnable
allow edit of this window
Definition TGWindow.h:56
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:60
@ kEditDisableBtnEnable
window can handle mouse button events
Definition TGWindow.h:64
@ kEditDisableWidth
window width cannot be edited
Definition TGWindow.h:63
@ kEditDisableGrab
window grab cannot be edited
Definition TGWindow.h:59
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
@ kEditDisableEvents
window events cannot be edited
Definition TGWindow.h:58
@ kEditDisableKeyEnable
window can handle keyboard events
Definition TGWindow.h:65
virtual void IconifyWindow()
iconify window
Definition TGWindow.cxx:224
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the window.
Definition TGWindow.cxx:287
virtual void MapWindow()
map window
Definition TGWindow.cxx:160
virtual void UnmapWindow()
unmap window
Definition TGWindow.cxx:184
virtual Bool_t IsMapSubwindows() const
Definition TGWindow.h:124
TGWindow(Window_t id)
Definition TGWindow.h:34
virtual void LowerWindow()
lower window
Definition TGWindow.cxx:216
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:192
virtual Bool_t IsEditable() const
Definition TGWindow.h:111
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:129
static Int_t GetCounter()
Return global window counter (total number of created windows).
Definition TGWindow.cxx:328
const TGWindow * GetParent() const
Definition TGWindow.h:83
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:295
virtual void Resize(UInt_t w, UInt_t h)
Resize the window.
Definition TGWindow.cxx:279
virtual void SetBackgroundColor(Pixel_t color)
set background color
Definition TGWindow.cxx:240
TString fName
name of the window used in SavePrimitive()
Definition TGWindow.h:30
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:208
~TGWindow() override
Window destructor. Unregisters the window.
Definition TGWindow.cxx:117
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
virtual void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0)
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGWindow.cxx:257
Bool_t fNeedRedraw
kTRUE if window needs to be redrawn
Definition TGWindow.h:29
virtual void MapSubwindows()
map sub windows
Definition TGWindow.cxx:168
@ kIsHtmlView
Definition TGWindow.h:69
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
Int_t fCount
if non-zero, at least this many more exposes
Definition GuiTypes.h:183
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93