Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveWindow.h
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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_TEveWindow
13#define ROOT_TEveWindow
14
15#include "TEveElement.h"
16
17#include "TGFrame.h"
18#include "TContextMenu.h"
19
20class TEveWindow;
21class TEveWindowSlot;
22class TEveWindowFrame;
23class TEveWindowMainFrame;
24class TEveWindowPack;
25class TEveWindowTab;
26class TEveContextMenu;
27
28class TGButton;
29class TGSplitButton;
30class TGTextButton;
31
32class TGPack;
33class TGTab;
34
35//==============================================================================
36// TEveCompositeFrame
37//==============================================================================
38
40{
41 friend class TEveWindow;
42 friend class TEveWindowManager;
43
44public:
45 typedef TGFrame* (*IconBarCreator_foo)(TEveCompositeFrame*, TGCompositeFrame*, Int_t);
46
47private:
48 TEveCompositeFrame(const TEveCompositeFrame&); // Not implemented
49 TEveCompositeFrame& operator=(const TEveCompositeFrame&); // Not implemented
50
55
56protected:
62
64
67
69
72
74
75public:
76 TEveCompositeFrame(TGCompositeFrame* gui_parent, TEveWindow* eve_parent);
77 ~TEveCompositeFrame() override;
78
79 virtual void WindowNameChanged(const TString& name);
80
81 virtual void Destroy() = 0;
82
83 virtual void AcquireEveWindow(TEveWindow* ew);
84 virtual TEveWindow* RelinquishEveWindow(Bool_t reparent=kTRUE);
85
86 TEveWindow* GetEveWindow() const { return fEveWindow; }
88
89 virtual void SetCurrent(Bool_t curr);
90 virtual void SetShowTitleBar(Bool_t show);
91 virtual void HideAllDecorations();
92 virtual void ShowNormalDecorations();
93
94 void ActionPressed();
95 void FlipTitleBarState();
96 void TitleBarClicked();
97
98 static void SetupFrameMarkup(IconBarCreator_foo creator,
99 UInt_t top_frame_height = 14,
100 UInt_t mini_bar_height = 4,
101 Bool_t allow_top_collapse = kTRUE);
102
103 ClassDefOverride(TEveCompositeFrame, 0); // Composite frame containing eve-window-controls and eve-windows.
104};
105
106
107//==============================================================================
108// TEveCompositeFrameInMainFrame
109//==============================================================================
110
112{
113private:
116
117protected:
121
122public:
124 TGMainFrame* mf);
126
127 void WindowNameChanged(const TString& name) override;
128
129 void Destroy() override;
130
131 void SetOriginalSlotAndContainer(TEveWindow* slot, TEveWindow* container);
132
134 void MainFrameClosed();
135
138
139 ClassDefOverride(TEveCompositeFrameInMainFrame, 0); // Eve-composite-frame that is contained in one tab of a TGTab.
140};
141
142
143//==============================================================================
144// TEveCompositeFrameInPack
145//==============================================================================
146
148{
149private:
152
153protected:
155
156public:
158 TGPack* pack);
159 ~TEveCompositeFrameInPack() override;
160
161 void Destroy() override;
162
163 ClassDefOverride(TEveCompositeFrameInPack, 0); // Eve-composite-frame that is contained in a TGPack.
164};
165
166
167//==============================================================================
168// TEveCompositeFrameInTab
169//==============================================================================
170
172{
173private:
176
177protected:
180
182
183public:
185 TGTab* tab);
186 ~TEveCompositeFrameInTab() override;
187
188 void WindowNameChanged(const TString& name) override;
189
190 void Destroy() override;
191
192 void SetCurrent(Bool_t curr) override;
193
194 ClassDefOverride(TEveCompositeFrameInTab, 0); // Eve-composite-frame that is contained in one tab of a TGTab.
195};
196
197
198//==============================================================================
199//==============================================================================
200// TEveWindow classes
201//==============================================================================
202//==============================================================================
203
204
205//==============================================================================
206// TEveWindow
207//==============================================================================
208
210{
211 friend class TEveWindowManager;
212
213private:
214 TEveWindow(const TEveWindow&); // Not implemented
215 TEveWindow& operator=(const TEveWindow&); // Not implemented
216
217protected:
220
221 virtual void SetCurrent(Bool_t curr);
222
225
228
229 void PreDeleteElement() override;
230
231public:
232 TEveWindow(const char* n="TEveWindow", const char* t="");
233 ~TEveWindow() override;
234
235 void NameTitleChanged() override;
236
237 virtual TGFrame* GetGUIFrame() = 0;
238 virtual void PreUndock();
239 virtual void PostDock();
240
241 virtual Bool_t CanMakeNewSlots() const { return kFALSE; }
242 virtual TEveWindowSlot* NewSlot() { return nullptr; }
243
245
246 void SwapWindow(TEveWindow* w);
247 void SwapWindowWithCurrent(); // *MENU*
248
249 void UndockWindow(); // *MENU*
250 void UndockWindowDestroySlot(); // *MENU*
251
253
254 virtual void DestroyWindow(); // *MENU*
255 virtual void DestroyWindowAndSlot(); // *MENU*
256
258 void ClearEveFrame();
259
263
264 Bool_t IsCurrent() const;
265 void MakeCurrent();
266
267
269
270 void TitleBarClicked();
271
272
273 // Static helper functions for common window management scenarios.
274
276 static TEveWindowSlot* CreateWindowMainFrame(TEveWindow* eve_parent=nullptr);
277 static TEveWindowSlot* CreateWindowInTab(TGTab* tab, TEveWindow* eve_parent=nullptr);
278
279 static void SwapWindows(TEveWindow* w1, TEveWindow* w2);
280
281 // Access to static data-members.
282
285 static void SetMainFrameDefWidth (UInt_t x);
286 static void SetMainFrameDefHeight(UInt_t x);
287
292
293 ClassDefOverride(TEveWindow, 0); // Abstract base-class for eve-windows.
294};
295
296
297//==============================================================================
298// TEveWindowSlot
299//==============================================================================
300
302{
303private:
304 TEveWindowSlot(const TEveWindowSlot&); // Not implemented
305 TEveWindowSlot& operator=(const TEveWindowSlot&); // Not implemented
306
307protected:
310
311 void SetCurrent(Bool_t curr) override;
312
313public:
314 TEveWindowSlot(const char* n="TEveWindowSlot", const char* t="");
315 ~TEveWindowSlot() override;
316
317 TGFrame* GetGUIFrame() override;
318
319 TEveWindowPack* MakePack(); // *MENU*
320 TEveWindowTab* MakeTab(); // *MENU*
321
322 TEveWindowFrame* MakeFrame(TGFrame* frame=nullptr);
323
325 TEveWindowFrame* StopEmbedding(const char* name=nullptr);
326
327 ClassDefOverride(TEveWindowSlot, 0); // An unoccupied eve-window slot.
328};
329
330
331//==============================================================================
332// TEveWindowFrame
333//==============================================================================
334
336{
337private:
338 TEveWindowFrame(const TEveWindowFrame&); // Not implemented
339 TEveWindowFrame& operator=(const TEveWindowFrame&); // Not implemented
340
341protected:
343
344public:
345 TEveWindowFrame(TGFrame* frame, const char* n="TEveWindowFrame", const char* t="");
346 ~TEveWindowFrame() override;
347
348 TGFrame* GetGUIFrame() override { return fGUIFrame; }
349
351
352 ClassDefOverride(TEveWindowFrame, 0); // Eve-window containing any TGFrame.
353};
354
355
356//==============================================================================
357// TEveWindowPack
358//==============================================================================
359
361{
362private:
363 TEveWindowPack(const TEveWindowPack&); // Not implemented
364 TEveWindowPack& operator=(const TEveWindowPack&); // Not implemented
365
366protected:
368
369public:
370 TEveWindowPack(TGPack* p, const char* n="TEveWindowPack", const char* t="");
371 ~TEveWindowPack() override;
372
373 TGFrame* GetGUIFrame() override;
374
375 Bool_t CanMakeNewSlots() const override { return kTRUE; }
377 TEveWindowSlot* NewSlot() override; // *MENU*
378
379 void FlipOrientation(); // *MENU*
382
383 void EqualizeFrames(); // *MENU*
384
385 TGPack* GetPack() const { return fPack; }
386
387 ClassDefOverride(TEveWindowPack, 0); // Eve-window containing a TGPack.
388};
389
390
391//==============================================================================
392// TEveWindowTab
393//==============================================================================
394
396{
397private:
398 TEveWindowTab(const TEveWindowTab&); // Not implemented
399 TEveWindowTab& operator=(const TEveWindowTab&); // Not implemented
400
401protected:
403
404public:
405 TEveWindowTab(TGTab* tab, const char* n="TEveWindowTab", const char* t="");
406 ~TEveWindowTab() override;
407
408 TGFrame* GetGUIFrame() override;
409
410 Bool_t CanMakeNewSlots() const override { return kTRUE; }
411 TEveWindowSlot* NewSlot() override; // *MENU*
412
413 TGTab* GetTab() const { return fTab; }
414
415 ClassDefOverride(TEveWindowTab, 0); // Eve-window containing a TGTab.
416};
417
418
419//==============================================================================
420//==============================================================================
421// Helper classes
422//==============================================================================
423//==============================================================================
424
425
426//==============================================================================
427// TEveContextMenu
428//==============================================================================
429
431{
432public:
433 TEveContextMenu(const char *name, const char *title = "Eve context menu");
434
436
437 ClassDefOverride(TEveContextMenu, 0) // Specialization of TContextMenu for Eve.
438};
439
440#endif
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
char name[80]
Definition TGX11.cxx:110
This class provides an interface to context sensitive popup menus.
An EVE window-slot contained within a TGMainFrame.
Definition TEveWindow.h:112
TEveCompositeFrameInMainFrame(const TEveCompositeFrameInMainFrame &)
void SetOriginalSlotAndContainer(TEveWindow *slot, TEveWindow *container)
Set the container where to return the contained window on destruction.
void Destroy() override
Virtual function called from eve side when the frame should be destroyed.
void SomeWindowClosed(TEveWindow *w)
Slot called when a window is closed ... we check that this was not our original container.
TEveWindow * GetOriginalSlot() const
Definition TEveWindow.h:136
TEveCompositeFrameInMainFrame & operator=(const TEveCompositeFrameInMainFrame &)
void WindowNameChanged(const TString &name) override
Update widgets using window's name or title.
TEveWindow * GetOriginalContainer() const
Definition TEveWindow.h:137
void MainFrameClosed()
Slot for main-frame's "CloseWindow()" signal.
~TEveCompositeFrameInMainFrame() override
Destructor.
An EVE window-slot contained within one frame of a TGPack.
Definition TEveWindow.h:148
~TEveCompositeFrameInPack() override
Destructor.
TEveCompositeFrameInPack & operator=(const TEveCompositeFrameInPack &)
void Destroy() override
Virtual function called from eve side when the frame should be destroyed.
TEveCompositeFrameInPack(const TEveCompositeFrameInPack &)
An EVE window-slot contained within one tab of a TGTab.
Definition TEveWindow.h:172
Int_t FindTabIndex()
Return index of this frame in the tab.
TGCompositeFrame * fParentInTab
Definition TEveWindow.h:179
void Destroy() override
Virtual function called from eve side when the frame should be destroyed.
void SetCurrent(Bool_t curr) override
Set current state of this frame.
void WindowNameChanged(const TString &name) override
Update widgets using window's name or title.
TEveCompositeFrameInTab(const TEveCompositeFrameInTab &)
~TEveCompositeFrameInTab() override
Destructor.
TEveCompositeFrameInTab & operator=(const TEveCompositeFrameInTab &)
Abstract base-class for frame-slots that encompass EVE-windows (sub-classes of TEveWindow).
Definition TEveWindow.h:40
TGLayoutHints * fEveWindowLH
Definition TEveWindow.h:61
TEveWindow * GetEveWindow() const
Definition TEveWindow.h:86
static Bool_t fgAllowTopFrameCollapse
Definition TEveWindow.h:54
TEveElement * fEveParent
Definition TEveWindow.h:65
static void SetupFrameMarkup(IconBarCreator_foo creator, UInt_t top_frame_height=14, UInt_t mini_bar_height=4, Bool_t allow_top_collapse=kTRUE)
Set properties of the EVE frame.
void FlipTitleBarState()
Change display-state of the title-bar / mini-bar.
virtual TEveWindow * RelinquishEveWindow(Bool_t reparent=kTRUE)
Remove window and decrease its deny-destroy count.
virtual void Destroy()=0
virtual void ShowNormalDecorations()
Show title-bar or mini-bar, as dictated by the window.
TGFrame * fMiniBar
Definition TEveWindow.h:63
virtual void WindowNameChanged(const TString &name)
Update widgets using window's name or title.
TEveCompositeFrame & operator=(const TEveCompositeFrame &)
void ActionPressed()
The action-button of the title-bar was pressed.
TGCompositeFrame * fTopFrame
Definition TEveWindow.h:57
TEveWindow * GetEveParentAsWindow() const
Returns eve-parent dynamic-casted to TEveWindow.
static UInt_t fgMiniBarHeight
Definition TEveWindow.h:53
TEveWindow * fEveWindow
Definition TEveWindow.h:66
TGTextButton * fToggleBar
Definition TEveWindow.h:58
~TEveCompositeFrame() override
If fEveWindow != 0 we are being deleted from the ROOT GUI side.
TGFrame *(* IconBarCreator_foo)(TEveCompositeFrame *, TGCompositeFrame *, Int_t)
Definition TEveWindow.h:45
TGFrame * fIconBar
Definition TEveWindow.h:60
virtual void AcquireEveWindow(TEveWindow *ew)
Accept window and increase its deny-destroy count.
static UInt_t fgTopFrameHeight
Definition TEveWindow.h:52
static TList * fgFrameList
Definition TEveWindow.h:73
TGTextButton * fTitleBar
Definition TEveWindow.h:59
static TEveContextMenu * fgCtxMenu
Definition TEveWindow.h:70
virtual void HideAllDecorations()
Hide title-bar and mini-bar.
virtual void SetShowTitleBar(Bool_t show)
Set state of title-bar.
TEveCompositeFrame(const TEveCompositeFrame &)
static const TString fgkEmptyFrameName
Definition TEveWindow.h:71
virtual void SetCurrent(Bool_t curr)
Set current state of this frame.
void TitleBarClicked()
Slot for mouse-click on the central part of the title-bar.
static IconBarCreator_foo fgIconBarCreator
Definition TEveWindow.h:51
Specialization of TContext menu.
Definition TEveWindow.h:431
void SetupAndPopup(TGWindow *button, TObject *obj)
Position the popup below given button and show context menu for object obj.
A list of TEveElements.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
Encapsulates TGFrame into an eve-window.
Definition TEveWindow.h:336
TEveWindowFrame & operator=(const TEveWindowFrame &)
TGFrame * fGUIFrame
Definition TEveWindow.h:342
TGCompositeFrame * GetGUICompositeFrame()
Returns the registered top-frame of this eve-window dynamic-casted to composite-frame.
~TEveWindowFrame() override
Destructor.
TEveWindowFrame(const TEveWindowFrame &)
TGFrame * GetGUIFrame() override
Definition TEveWindow.h:348
Manager for EVE windows.
Encapsulates TGPack into an eve-window.
Definition TEveWindow.h:361
TGPack * GetPack() const
Definition TEveWindow.h:385
void FlipOrientation()
Flip orientation of the pack (vertical / horizontal).
TEveWindowPack(const TEveWindowPack &)
void SetVertical(Bool_t x=kTRUE)
Set orientation of the pack (vertical / horizontal).
void SetHorizontal()
Definition TEveWindow.h:381
virtual TEveWindowSlot * NewSlotWithWeight(Float_t w)
Create a new weighted frame-slot at the last position of the pack.
void EqualizeFrames()
Refit existing frames so that their lengths are equal.
TEveWindowSlot * NewSlot() override
Create a new frame-slot at the last position of the pack.
TEveWindowPack & operator=(const TEveWindowPack &)
TGPack * fPack
Definition TEveWindow.h:367
TGFrame * GetGUIFrame() override
Return top-frame of this eve-window - the pack.
Bool_t CanMakeNewSlots() const override
Definition TEveWindow.h:375
~TEveWindowPack() override
Destructor.
Description of TEveWindowSlot.
Definition TEveWindow.h:302
TEveWindowSlot & operator=(const TEveWindowSlot &)
TEveWindowFrame * MakeFrame(TGFrame *frame=nullptr)
An eve-window-frame is created and frame is passed into it.
TGCompositeFrame * fEmbedBuffer
Definition TEveWindow.h:309
TEveWindowFrame * StopEmbedding(const char *name=nullptr)
An embedded window is created in place of this window-slot.
TEveWindowSlot(const TEveWindowSlot &)
TGCompositeFrame * StartEmbedding()
Start embedding a window that will replace the current slot.
~TEveWindowSlot() override
Destructor.
TEveWindowTab * MakeTab()
A tab is created in place of this window-slot.
void SetCurrent(Bool_t curr) override
Set current state of this window-slot.
TGFrame * GetGUIFrame() override
Return top-frame of this eve-window - the big button to make slot current.
TGTextButton * fEmptyButt
Definition TEveWindow.h:308
TEveWindowPack * MakePack()
A pack is created in place of this window-slot.
Encapsulates TGTab into an eve-window.
Definition TEveWindow.h:396
TEveWindowTab(const TEveWindowTab &)
~TEveWindowTab() override
Destructor.
TEveWindowSlot * NewSlot() override
Create new frame-slot - a new tab.
Bool_t CanMakeNewSlots() const override
Definition TEveWindow.h:410
TGFrame * GetGUIFrame() override
Return top-frame of this eve-window - the tab.
TEveWindowTab & operator=(const TEveWindowTab &)
TGTab * GetTab() const
Definition TEveWindow.h:413
Abstract base-class for representing eve-windows.
Definition TEveWindow.h:210
void FlipShowTitleBar()
Definition TEveWindow.h:260
virtual void PreUndock()
Virtual function called before a window is undocked.
static void SetMiniBarBackgroundColor(Pixel_t p)
Set background-color for mini-bar (collapsed title-bar). Static.
~TEveWindow() override
Destructor.
virtual void DestroyWindowAndSlot()
Destroy eve-window and its frame-slot.
static UInt_t GetMainFrameDefHeight()
Get default height for new main-frame windows. Static.
TEveWindow & operator=(const TEveWindow &)
static void SetMainFrameDefWidth(UInt_t x)
Set default width for new main-frame windows. Static.
TEveCompositeFrame * fEveFrame
Definition TEveWindow.h:218
static void SwapWindows(TEveWindow *w1, TEveWindow *w2)
Swap windows w1 and w2.
static TEveWindowSlot * CreateWindowMainFrame(TEveWindow *eve_parent=nullptr)
Create a new main-frame and populate it with a default window-slot.
TEveWindow(const TEveWindow &)
static void SetMainFrameDefHeight(UInt_t x)
Set default height for new main-frame windows. Static.
void PreDeleteElement() override
Called before the element is deleted, thus offering the last chance to detach from acquired resources...
static TEveWindowSlot * CreateDefaultWindowSlot()
Create a default window slot.
static void SetCurrentBackgroundColor(Pixel_t p)
Set background-color for marking the title-bar of current window. Static.
Bool_t IsCurrent() const
Returns true if this window is the current one.
Bool_t IsAncestorOf(TEveWindow *win)
Returns true if this is an ancestor of win.
virtual void SetCurrent(Bool_t curr)
Set current state of this eve-window.
void ReplaceWindow(TEveWindow *w)
Replace this window with the passed one.
virtual Bool_t CanMakeNewSlots() const
Definition TEveWindow.h:241
void MakeCurrent()
Make this window current.
virtual TEveWindowSlot * NewSlot()
Definition TEveWindow.h:242
static Pixel_t GetMiniBarBackgroundColor()
Get background-color for mini-bar (collapsed title-bar). Static.
void PopulateEmptyFrame(TEveCompositeFrame *ef)
Populate given frame-slot - intended for initial population of a new slot or low-level window-swappin...
virtual TGFrame * GetGUIFrame()=0
void ClearEveFrame()
Clears eve-frame associated with this window.
TEveCompositeFrame * GetEveFrame()
Definition TEveWindow.h:257
static Pixel_t GetCurrentBackgroundColor()
Get background-color for marking the title-bar of current window. Static.
Bool_t GetShowTitleBar() const
Definition TEveWindow.h:261
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=nullptr)
Create a new tab in a given tab-widget and populate it with a default window-slot.
virtual void DestroyWindow()
Destroy eve-window - replace it with an empty frame-slot.
void UndockWindow()
Undock the window - put it into a dedicated main-frame.
Bool_t fShowTitleBar
Definition TEveWindow.h:219
void SetShowTitleBar(Bool_t x)
Set display state of the title-bar.
void SwapWindowWithCurrent()
Swap frames with the current window.
static UInt_t fgMainFrameDefHeight
Definition TEveWindow.h:224
void TitleBarClicked()
Slot for clicking on the title-bar.
void NameTitleChanged() override
Name or title of the window changed - propagate to frames.
static UInt_t fgMainFrameDefWidth
Definition TEveWindow.h:223
static Pixel_t fgMiniBarBackgroundColor
Definition TEveWindow.h:227
static UInt_t GetMainFrameDefWidth()
Get default width for new main-frame windows. Static.
void UndockWindowDestroySlot()
Undock the window - put it into a dedicated main-frame.
virtual void PostDock()
Virtual function called after a window is docked.
void SwapWindow(TEveWindow *w)
Swap frames with the given window.
static Pixel_t fgCurrentBackgroundColor
Definition TEveWindow.h:226
A button abstract base class.
Definition TGButton.h:68
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
Stack of frames in horizontal (default) or vertical stack.
Definition TGPack.h:40
Implements a button with added menu functionality.
Definition TGButton.h:378
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition TGTab.h:46
Yield an action as soon as it is clicked.
Definition TGButton.h:142
ROOT GUI Window base class.
Definition TGWindow.h:23
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16