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
32
33////////////////////////////////////////////////////////////////////////////////
34/// Constructor.
35
36TEveWindowManager::TEveWindowManager(const char* n, const char* t) :
38 TQObject (),
39 fCurrentWindow (nullptr),
40 fDefaultContainer (nullptr)
41{
42}
43
44////////////////////////////////////////////////////////////////////////////////
45/// Destructor.
46
48{
49}
50
51////////////////////////////////////////////////////////////////////////////////
52/// Entry-point for communicating the fact that a window was acted
53/// upon in such a way that it should become the current window.
54/// If the passed window is already the current one, it is deselected.
55///
56/// For example, this is called from title-bar, when creating a new
57/// window slot, etc.
58///
59/// If the change is accepted (the manager can refuse to make a
60/// window current), the state of window is changed accordingly and
61/// WindowSelected() signal is emitted.
62
64{
65 if (window == fCurrentWindow)
66 window = nullptr;
67
70
71 fCurrentWindow = window;
72
75
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// Called by a window before it gets deleted.
81
83{
84 if (window == fCurrentWindow)
85 {
86 fCurrentWindow = nullptr;
88 }
89 WindowDeleted(window);
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Emit the "WindowDocked(TEveWindow*)" signal.
94
96{
97 Emit("WindowDocked(TEveWindow*)", (Longptr_t)window);
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Emit the "WindowUndocked(TEveWindow*)" signal.
102
104{
105 Emit("WindowUndocked(TEveWindow*)", (Longptr_t)window);
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Emit the "WindowSelected(TEveWindow*)" signal.
110
112{
113 Emit("WindowSelected(TEveWindow*)", (Longptr_t)window);
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Emit the "WindowDeleted(TEveWindow*)" signal.
118
120{
121 Emit("WindowDeleted(TEveWindow*)", (Longptr_t)window);
122}
123
124////////////////////////////////////////////////////////////////////////////////
125/// Return current window dynamic-casted to TEveWindowSlot.
126
128{
129 return dynamic_cast<TEveWindowSlot*>(fCurrentWindow);
130}
131
133{
134 // Set default container window.
135 // It has to be able to create new slots.
136 // When main-frames are closed they will place the windows here.
137
138 static const TEveException kEH("TEveWindowManager::SetDefaultContainer ");
139
140 if ( ! w->CanMakeNewSlots())
141 throw kEH + "Given window can not make new slots.";
142
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Destroy window's children and then the window itself.
148/// Protected method used during shutdown.
149
151{
152 while (window->HasChildren())
153 {
154 TEveWindow* w = dynamic_cast<TEveWindow*>(window->FirstChild());
155 if (w)
157 else
158 window->RemoveElement(window->FirstChild());
159 }
160 window->DestroyWindowAndSlot();
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Wait for all windows to shut-down.
165
167{
168 while (HasChildren())
169 {
170 TEveWindow* w = dynamic_cast<TEveWindow*>(FirstChild());
171 if (w)
173 else
175 }
176
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// Hide all eve decorations (title-bar and mini-bar) on all frames.
181
183{
184 TEveCompositeFrame *ecf = nullptr;
186 while ((ecf = (TEveCompositeFrame*) wins()))
187 {
188 ecf->HideAllDecorations();
189 ecf->Layout();
190 }
191}
192
193////////////////////////////////////////////////////////////////////////////////
194/// Show eve decorations (title-bar or mini-bar) as specified for
195/// the contained window on all frames.
196
198{
199 TEveCompositeFrame *ecf = nullptr;
201 while ((ecf = (TEveCompositeFrame*) wins()))
202 {
204 ecf->Layout();
205 }
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// Set show title-bar state on all frames.
210/// This does not modify the per-window settings - call
211/// ShowNormalEveDecorations() to restore them.
212
214{
215 TEveCompositeFrame *ecf = nullptr;
217 while ((ecf = (TEveCompositeFrame*) wins()))
218 {
219 ecf->SetShowTitleBar(state);
220 ecf->Layout();
221 }
222}
long Longptr_t
Definition RtypesCore.h:75
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:382
Abstract base-class for frame-slots that encompass EVE-windows (sub-classes of TEveWindow).
Definition TEveWindow.h:40
virtual void ShowNormalDecorations()
Show title-bar or mini-bar, as dictated by the window.
static TList * fgFrameList
Definition TEveWindow.h:73
virtual void HideAllDecorations()
Hide title-bar and mini-bar.
virtual void SetShowTitleBar(Bool_t show)
Set state of title-bar.
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
Manager for EVE windows.
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.
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
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