Logo ROOT   6.16/01
Reference Guide
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 (0),
40 fDefaultContainer (0)
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 = 0;
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 {
88 }
89 WindowDeleted(window);
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Emit the "WindowDocked(TEveWindow*)" signal.
94
96{
97 Emit("WindowDocked(TEveWindow*)", (Long_t)window);
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Emit the "WindowUndocked(TEveWindow*)" signal.
102
104{
105 Emit("WindowUndocked(TEveWindow*)", (Long_t)window);
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Emit the "WindowSelected(TEveWindow*)" signal.
110
112{
113 Emit("WindowSelected(TEveWindow*)", (Long_t)window);
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Emit the "WindowDeleted(TEveWindow*)" signal.
118
120{
121 Emit("WindowDeleted(TEveWindow*)", (Long_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 = 0;
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 = 0;
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 = 0;
217 while ((ecf = (TEveCompositeFrame*) wins()))
218 {
219 ecf->SetShowTitleBar(state);
220 ecf->Layout();
221 }
222}
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
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.
Definition: TEveWindow.cxx:312
static TList * fgFrameList
Definition: TEveWindow.h:73
virtual void HideAllDecorations()
Hide title-bar and mini-bar.
Definition: TEveWindow.cxx:301
virtual void SetShowTitleBar(Bool_t show)
Set state of title-bar.
Definition: TEveWindow.cxx:285
A list of TEveElements.
Definition: TEveElement.h:431
TEveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
Bool_t HasChildren() const
Definition: TEveElement.h:169
virtual void RemoveElement(TEveElement *el)
Remove el from the list of children.
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:103
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.
virtual ~TEveWindowManager()
Destructor.
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.
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.
Definition: TEveWindow.cxx:867
virtual void SetCurrent(Bool_t curr)
Set current state of this eve-window.
Definition: TEveWindow.cxx:929
virtual Bool_t CanMakeNewSlots() const
Definition: TEveWindow.h:241
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:49
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
const Int_t n
Definition: legend1.C:16