DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
DDEve
src
FrameControl.cpp
Go to the documentation of this file.
1
//==========================================================================
2
// AIDA Detector description implementation
3
//--------------------------------------------------------------------------
4
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5
// All rights reserved.
6
//
7
// For the licensing terms see $DD4hepINSTALL/LICENSE.
8
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9
//
10
// Author : M.Frank
11
//
12
//==========================================================================
13
14
// Framework include files
15
#include <
DDEve/FrameControl.h
>
16
#include <
DD4hep/Printout.h
>
17
18
// ROOT include files
19
#include <TSystem.h>
20
#include <TGTab.h>
21
#include <TGButton.h>
22
23
#include <stdexcept>
24
25
using namespace
dd4hep
;
26
27
ClassImp
(
FrameControl
)
28
29
FrameControl::FrameControl
(TGClient* cl,
const
std::string& name,
unsigned
int
width,
unsigned
int
height)
31
:
TGMainFrame
(cl->GetRoot(), width, height), m_client(cl), m_frame(0)
32
{
33
SetWindowName(name.c_str());
34
SetCleanup(kDeepCleanup);
35
}
36
38
FrameControl::~FrameControl() {
39
if
(
m_frame
) {
40
m_frame
->DestroySubwindows();
41
m_frame
->RemoveAll();
42
}
43
}
44
46
void
FrameControl::Build
() {
47
m_frame
=
CreateFrame
();
48
AddFrame(
m_frame
,
new
TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX));
49
OnBuild
();
50
MapSubwindows();
51
Resize();
52
MapWindow();
53
}
54
56
void
FrameControl::OnBuild
() {
57
}
58
60
TGCompositeFrame*
FrameControl::CreateFrame
() {
61
return
new
TGHorizontalFrame(
this
);
62
}
63
65
const
TGPicture*
FrameControl::LoadPicture
(
const
std::string& path) {
66
const
TGPicture* pic =
m_client
->GetPicture(path.c_str());
67
if
( !pic ) {
68
printout(ERROR,
"FrameControl"
,
"+++ loadPicture: Failed to load picture: %s"
,path.c_str());
69
throw
std::runtime_error(
"FrameControl::loadPicture: Failed to load picture:"
+path);
70
}
71
return
pic;
72
}
73
74
75
dd4hep::FrameControl::OnBuild
virtual void OnBuild()
User callback to add elements to the control.
Definition:
FrameControl.cpp:56
TGMainFrame
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition:
ROOTClasses.h:33
dd4hep::FrameControl::CreateFrame
virtual TGCompositeFrame * CreateFrame()
Create the frame for this control structure. Default: create horizontal frame.
Definition:
FrameControl.cpp:60
ClassImp
ClassImp(FrameControl) FrameControl
Standard constructor.
Definition:
FrameControl.cpp:27
FrameControl.h
dd4hep::FrameControl::m_client
TGClient * m_client
Reference to TEve manager.
Definition:
FrameControl.h:40
dd4hep::FrameControl::m_frame
TGCompositeFrame * m_frame
Reference to control's frame.
Definition:
FrameControl.h:42
dd4hep::FrameControl::FrameControl
FrameControl(TGClient *client, const std::string &name, unsigned int width, unsigned int height)
Standard constructor.
dd4hep::FrameControl::LoadPicture
virtual const TGPicture * LoadPicture(const std::string &path)
Helper: Load picture using path name.
Definition:
FrameControl.cpp:65
dd4hep::FrameControl::Build
virtual void Build()
Build the control.
Definition:
FrameControl.cpp:46
dd4hep
Namespace for the AIDA detector description toolkit.
Definition:
AlignmentsCalib.h:28
dd4hep::FrameControl
class FrameControl FrameControl.h DDEve/FrameControl.h
Definition:
FrameControl.h:36
Printout.h
Generated on Thu Nov 7 2024 13:31:58 for DD4hep by
1.8.18