Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveWindowManager.cxx
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#include "TEveWindowManager.h"
13#include "TEveWindow.h"
14
15/** \class TEveWindowManager
16\ingroup TEve
17Manager for EVE windows.
18
19Provides the concept of the current window and takes care for proper
20destruction of the windows.
21
22It is also the EVE-parent of windows that are not attached into the
23hierarchy of EVE-windows.
24
25Window-manager is created by the EVE-manager and can be retrieved via:
26~~~ {.cpp}
27 gEve->GetWindowManager.
28~~~
29*/
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// Constructor.
34
35TEveWindowManager::TEveWindowManager(const char* n, const char* t) :
37 TQObject (),
38 fCurrentWindow (nullptr),
39 fDefaultContainer (nullptr)
40{
41}
42
43////////////////////////////////////////////////////////////////////////////////
44/// Destructor.
45
49
50////////////////////////////////////////////////////////////////////////////////
51/// Entry-point for communicating the fact that a window was acted
52/// upon in such a way that it should become the current window.
53/// If the passed window is already the current one, it is deselected.
54///
55/// For example, this is called from title-bar, when creating a new
56/// window slot, etc.
57///
58/// If the change is accepted (the manager can refuse to make a
59/// window current), the state of window is changed accordingly and
60/// WindowSelected() signal is emitted.
61
63{
64 if (window == fCurrentWindow)
65 window = nullptr;
66
69
70 fCurrentWindow = window;
71
74
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// Called by a window before it gets deleted.
80
82{
83 if (window == fCurrentWindow)
84 {
85 fCurrentWindow = nullptr;
87 }
88 WindowDeleted(window);
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Emit the "WindowDocked(TEveWindow*)" signal.
93
95{
96 Emit("WindowDocked(TEveWindow*)", (Longptr_t)window);
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Emit the "WindowUndocked(TEveWindow*)" signal.
101
103{
104 Emit("WindowUndocked(TEveWindow*)", (Longptr_t)window);
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Emit the "WindowSelected(TEveWindow*)" signal.
109
111{
112 Emit("WindowSelected(TEveWindow*)", (Longptr_t)window);
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Emit the "WindowDeleted(TEveWindow*)" signal.
117
119{
120 Emit("WindowDeleted(TEveWindow*)", (Longptr_t)window);
121}
122
123////////////////////////////////////////////////////////////////////////////////
124/// Return current window dynamic-casted to TEveWindowSlot.
125
130
132{
133 // Set default container window.
134 // It has to be able to create new slots.
135 // When main-frames are closed they will place the windows here.
136
137 static const TEveException kEH("TEveWindowManager::SetDefaultContainer ");
138
139 if ( ! w->CanMakeNewSlots())
140 throw kEH + "Given window can not make new slots.";
141
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Destroy window's children and then the window itself.
147/// Protected method used during shutdown.
148
150{
151 while (window->HasChildren())
152 {
153 TEveWindow* w = dynamic_cast<TEveWindow*>(window->FirstChild());
154 if (w)
156 else
157 window->RemoveElement(window->FirstChild());
158 }
159 window->DestroyWindowAndSlot();
160}
161
162////////////////////////////////////////////////////////////////////////////////
163/// Wait for all windows to shut-down.
164
166{
167 while (HasChildren())
168 {
169 TEveWindow* w = dynamic_cast<TEveWindow*>(FirstChild());
170 if (w)
172 else
174 }
175
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Hide all eve decorations (title-bar and mini-bar) on all frames.
180
182{
183 TEveCompositeFrame *ecf = nullptr;
185 while ((ecf = (TEveCompositeFrame*) wins()))
186 {
187 ecf->HideAllDecorations();
188 ecf->Layout();
189 }
190}
191
192////////////////////////////////////////////////////////////////////////////////
193/// Show eve decorations (title-bar or mini-bar) as specified for
194/// the contained window on all frames.
195
197{
198 TEveCompositeFrame *ecf = nullptr;
200 while ((ecf = (TEveCompositeFrame*) wins()))
201 {
202 ecf->ShowNormalDecorations();
203 ecf->Layout();
204 }
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Set show title-bar state on all frames.
209/// This does not modify the per-window settings - call
210/// ShowNormalEveDecorations() to restore them.
211
213{
214 TEveCompositeFrame *ecf = nullptr;
216 while ((ecf = (TEveCompositeFrame*) wins()))
217 {
218 ecf->SetShowTitleBar(state);
219 ecf->Layout();
220 }
221}
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Abstract base-class for frame-slots that encompass EVE-windows (sub-classes of TEveWindow).
Definition TEveWindow.h:40
static TList * fgFrameList
Definition TEveWindow.h:73
A list of TEveElements.
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
Bool_t HasChildren() const
virtual void RemoveElement(TEveElement *el)
Remove el from the list of children.
Exception class thrown by TEve classes and macros.
Definition TEveUtil.h:102
void ShowNormalEveDecorations()
Show eve decorations (title-bar or mini-bar) as specified for the contained window on all frames.
void SetShowTitleBars(Bool_t state)
Set show title-bar state on all frames.
void WindowUndocked(TEveWindow *window)
Emit the "WindowUndocked(TEveWindow*)" signal.
TEveWindowSlot * GetCurrentWindowAsSlot() const
Return current window dynamic-casted to TEveWindowSlot.
void SetDefaultContainer(TEveWindow *w)
void DestroyWindowRecursively(TEveWindow *window)
Destroy window's children and then the window itself.
void WindowDocked(TEveWindow *window)
Emit the "WindowDocked(TEveWindow*)" signal.
~TEveWindowManager() override
Destructor.
void WindowDeleted(TEveWindow *window)
Emit the "WindowDeleted(TEveWindow*)" signal.
TEveWindow * fDefaultContainer
void HideAllEveDecorations()
Hide all eve decorations (title-bar and mini-bar) on all frames.
void DeleteWindow(TEveWindow *w)
Called by a window before it gets deleted.
TEveWindow * fCurrentWindow
void WindowSelected(TEveWindow *window)
Emit the "WindowSelected(TEveWindow*)" signal.
void DestroyWindows()
Wait for all windows to shut-down.
TEveWindowManager(const TEveWindowManager &)
void SelectWindow(TEveWindow *w)
Entry-point for communicating the fact that a window was acted upon in such a way that it should beco...
Description of TEveWindowSlot.
Definition TEveWindow.h:302
Abstract base-class for representing eve-windows.
Definition TEveWindow.h:210
virtual void DestroyWindowAndSlot()
Destroy eve-window and its frame-slot.
virtual void SetCurrent(Bool_t curr)
Set current state of this eve-window.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
const Int_t n
Definition legend1.C:16