File indexing completed on 2025-01-30 09:17:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDEve/FrameControl.h>
0016 #include <DD4hep/Printout.h>
0017
0018
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
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
0038 FrameControl::~FrameControl() {
0039 if ( m_frame ) {
0040 m_frame->DestroySubwindows();
0041 m_frame->RemoveAll();
0042 }
0043 }
0044
0045
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
0056 void FrameControl::OnBuild() {
0057 }
0058
0059
0060 TGCompositeFrame* FrameControl::CreateFrame() {
0061 return new TGHorizontalFrame(this);
0062 }
0063
0064
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