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
36 TGWindow(const TGWindow& tgw) :
39
41 { if (this!=&tgw) { TGObject::operator=(tgw); fParent=tgw.fParent;
43 fEditDisabled=tgw.fEditDisabled; } return *this; }
44
45 virtual void DoRedraw() { }
46
47public:
48 enum EEditMode {
49 kEditEnable = 0, ///< allow edit of this window
50 kEditDisable = BIT(0), ///< disable edit of this window
51 kEditDisableEvents = BIT(1), ///< window events cannot be edited
52 kEditDisableGrab = BIT(2), ///< window grab cannot be edited
53 kEditDisableLayout = BIT(3), ///< window layout cannot be edited
54 kEditDisableResize = BIT(4), ///< window size cannot be edited
55 kEditDisableHeight = BIT(5), ///< window height cannot be edited
56 kEditDisableWidth = BIT(6), ///< window width cannot be edited
57 kEditDisableBtnEnable = BIT(7), ///< window can handle mouse button events
58 kEditDisableKeyEnable = BIT(8) ///< window can handle keyboard events
59 };
60
62 kIsHtmlView = BIT(14)
63 };
64
65 TGWindow(const TGWindow *p = 0, Int_t x = 0, Int_t y = 0,
66 UInt_t w = 0, UInt_t h = 0, UInt_t border = 0,
67 Int_t depth = 0,
68 UInt_t clss = 0,
69 void *visual = 0,
70 SetWindowAttributes_t *attr = 0,
71 UInt_t wtype = 0);
72 TGWindow(TGClient *c, Window_t id, const TGWindow *parent = 0);
73
74 virtual ~TGWindow();
75
76 const TGWindow *GetParent() const { return fParent; }
77 virtual const TGWindow *GetMainFrame() const;
78
79 virtual void MapWindow();
80 virtual void MapSubwindows();
81 virtual void MapRaised();
82 virtual void UnmapWindow();
83 virtual void DestroyWindow();
84 virtual void DestroySubwindows();
85 virtual void RaiseWindow();
86 virtual void LowerWindow();
87 virtual void IconifyWindow();
88 virtual void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0);
89 virtual void RequestFocus();
90
91 virtual void SetBackgroundColor(Pixel_t color);
92 virtual void SetBackgroundPixmap(Pixmap_t pixmap);
93
95 { if (event->fCount == 0) fClient->NeedRedraw(this); return kTRUE; }
96 virtual Bool_t HandleEvent(Event_t *) { return kFALSE; }
97 virtual Bool_t HandleTimer(TTimer *) { return kFALSE; }
99
100 virtual void Move(Int_t x, Int_t y);
101 virtual void Resize(UInt_t w, UInt_t h);
102 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
103 virtual Bool_t IsMapped();
104 virtual Bool_t IsEditable() const { return (fClient->GetRoot() == this); }
105 virtual UInt_t GetEditDisabled() const { return fEditDisabled; }
107 virtual void SetEditable(Bool_t on = kTRUE)
108 { if (!(fEditDisabled & kEditDisable)) fClient->SetRoot(on ? this : 0); }
109 virtual Int_t MustCleanup() const { return 0; }
110 virtual void Print(Option_t *option="") const;
111
112 virtual void SetWindowName(const char *name = 0);
113 virtual const char *GetName() const;
114 virtual void SetName(const char *name) { fName = name; }
115
116 virtual void SetMapSubwindows(Bool_t /*on*/) { }
117 virtual Bool_t IsMapSubwindows() const { return kTRUE; }
118
119 static Int_t GetCounter();
120
121 ClassDef(TGWindow, 0); // GUI Window base class
122};
123
124
125/** \class TGUnknownWindowHandler
126 \ingroup guiwidgets
127
128Handle events for windows that are not part of the native ROOT GUI.
129Typically windows created by Xt or Motif.
130
131*/
132
133
135
136public:
139
140 virtual Bool_t HandleEvent(Event_t *) = 0;
141
142 ClassDef(TGUnknownWindowHandler,0) // Abstract event handler for unknown windows
143};
144
145#endif
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
XFontStruct * id
Definition TGX11.cxx:109
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:22
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
TGObject & operator=(const TGObject &tgo)
Definition TGObject.h:29
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
Handle events for windows that are not part of the native ROOT GUI.
Definition TGWindow.h:134
virtual ~TGUnknownWindowHandler()
Definition TGWindow.h:138
virtual Bool_t HandleEvent(Event_t *)=0
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual void SetWindowName(const char *name=0)
Set window name.
Definition TGWindow.cxx:129
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:45
virtual Bool_t HandleEvent(Event_t *)
Definition TGWindow.h:96
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
TGWindow(const TGWindow &tgw)
Definition TGWindow.h:36
virtual ~TGWindow()
Window destructor. Unregisters the window.
Definition TGWindow.cxx:117
virtual void Print(Option_t *option="") const
Print window id.
Definition TGWindow.cxx:307
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:98
TGWindow & operator=(const TGWindow &tgw)
Definition TGWindow.h:40
virtual UInt_t GetEditDisabled() const
Definition TGWindow.h:105
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:106
virtual Bool_t HandleExpose(Event_t *event)
Definition TGWindow.h:94
virtual void SetName(const char *name)
Definition TGWindow.h:114
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:116
virtual void SetEditable(Bool_t on=kTRUE)
Definition TGWindow.h:107
virtual Int_t MustCleanup() const
Definition TGWindow.h:109
@ kEditDisableResize
window size cannot be edited
Definition TGWindow.h:54
@ kEditDisableHeight
window height cannot be edited
Definition TGWindow.h:55
@ kEditEnable
allow edit of this window
Definition TGWindow.h:49
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:53
@ kEditDisableBtnEnable
window can handle mouse button events
Definition TGWindow.h:57
@ kEditDisableWidth
window width cannot be edited
Definition TGWindow.h:56
@ kEditDisableGrab
window grab cannot be edited
Definition TGWindow.h:52
@ kEditDisable
disable edit of this window
Definition TGWindow.h:50
@ kEditDisableEvents
window events cannot be edited
Definition TGWindow.h:51
@ kEditDisableKeyEnable
window can handle keyboard events
Definition TGWindow.h:58
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:117
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:104
static Int_t GetCounter()
Return global window counter (total number of created windows).
Definition TGWindow.cxx:328
const TGWindow * GetParent() const
Definition TGWindow.h:76
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
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:62
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
virtual Bool_t HandleTimer(TTimer *)
Execute action in response of a timer timing out.
Definition TGWindow.h:97
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:136
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
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93