DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FrameControl.cpp
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DDEve/FrameControl.h"
17 #include "DD4hep/Printout.h"
18 
19 // ROOT include files
20 #include <TSystem.h>
21 #include <TGTab.h>
22 #include <TGButton.h>
23 
24 #include <stdexcept>
25 
26 using namespace std;
27 using namespace DD4hep;
28 
30 
31 FrameControl::FrameControl(TGClient* cl, const std::string& name, unsigned int width, unsigned int height)
33 : TGMainFrame(cl->GetRoot(), width, height), m_client(cl), m_frame(0)
34 {
35  SetWindowName(name.c_str());
36  SetCleanup(kDeepCleanup);
37 }
38 
40 FrameControl::~FrameControl() {
41  if ( m_frame ) {
42  m_frame->DestroySubwindows();
43  m_frame->RemoveAll();
44  }
45 }
46 
48 void FrameControl::Build() {
49  m_frame = CreateFrame();
50  AddFrame(m_frame, new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX));
51  OnBuild();
52  MapSubwindows();
53  Resize();
54  MapWindow();
55 }
56 
58 void FrameControl::OnBuild() {
59 }
60 
62 TGCompositeFrame* FrameControl::CreateFrame() {
63  return new TGHorizontalFrame(this);
64 }
65 
67 const TGPicture* FrameControl::LoadPicture(const std::string& path) {
68  const TGPicture* pic = m_client->GetPicture(path.c_str());
69  if ( !pic ) {
70  printout(ERROR,"FrameControl","+++ loadPicture: Failed to load picture: %s",path.c_str());
71  throw std::runtime_error("FrameControl::loadPicture: Failed to load picture:"+path);
72  }
73  return pic;
74 }
75 
76 
77 
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:30
ClassImp(FrameControl) FrameControl
Standard constructor.
class FrameControl FrameControl.h DDEve/FrameControl.h
Definition: FrameControl.h:37
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Definition: Printout.cpp:111