Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:17

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DDEve/FrameControl.h>
0016 #include <DD4hep/Printout.h>
0017 
0018 // ROOT include files
0019 #include <TSystem.h>
0020 #include <TGTab.h>
0021 #include <TGButton.h>
0022 
0023 #include <stdexcept>
0024 
0025 using namespace dd4hep;
0026 
0027 ClassImp(FrameControl)
0028 
0029 /// Standard constructor
0030 FrameControl::FrameControl(TGClient* cl, const std::string& name, unsigned int width, unsigned int height) 
0031 : TGMainFrame(cl->GetRoot(), width, height), m_client(cl), m_frame(0)
0032 {
0033   SetWindowName(name.c_str());
0034   SetCleanup(kDeepCleanup);
0035 }
0036 
0037 /// Default destructor
0038 FrameControl::~FrameControl()   {
0039   if ( m_frame )  {
0040     m_frame->DestroySubwindows();
0041     m_frame->RemoveAll();
0042   }
0043 }
0044 
0045 /// Build the control
0046 void FrameControl::Build()   {
0047   m_frame = CreateFrame();
0048   AddFrame(m_frame, new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX));
0049   OnBuild();
0050   MapSubwindows();
0051   Resize();
0052   MapWindow();
0053 }
0054 
0055 /// User callback to add elements to the control
0056 void FrameControl::OnBuild()   {
0057 }
0058 
0059 /// Create the frame for this control structure. Default: create horizontal frame
0060 TGCompositeFrame* FrameControl::CreateFrame()    {
0061   return new TGHorizontalFrame(this);
0062 }
0063 
0064 /// Helper: Load picture using path name
0065 const TGPicture* FrameControl::LoadPicture(const std::string& path)   {
0066   const TGPicture* pic = m_client->GetPicture(path.c_str());
0067   if ( !pic )   {
0068     printout(ERROR,"FrameControl","+++ loadPicture: Failed to load picture: %s",path.c_str());
0069     throw std::runtime_error("FrameControl::loadPicture: Failed to load picture:"+path);
0070   }
0071   return pic;
0072 }
0073 
0074 
0075