Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#include "TCanvas.h"
#include "TGFrame.h"
#include "TEveWindow.h"
#include "TRootEmbeddedCanvas.h"

template <typename T>
FWDetailViewCanvas<T>::FWDetailViewCanvas() : m_infoCanvas(nullptr), m_guiFrame(nullptr), m_viewCanvas(nullptr) {}

template <typename T>
FWDetailViewCanvas<T>::~FWDetailViewCanvas() {}

template <typename T>
void FWDetailViewCanvas<T>::init(TEveWindowSlot* slot) {
  TEveWindowPack* pack = slot->MakePack();
  pack->SetHorizontal();
  pack->SetShowTitleBar(kFALSE);
  pack->SetElementNameTitle("DetalView pack", "DetailViewPack");

  // canvas & widgets
  TEveWindowFrame* frame = pack->NewSlotWithWeight(1)->MakeFrame();
  frame->SetShowTitleBar(kFALSE);
  TGCompositeFrame* cf = frame->GetGUICompositeFrame();

  TGCompositeFrame* hf = new TGVerticalFrame(cf);
  hf->SetCleanup(kLocalCleanup);
  cf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
  {
    m_guiFrame = new TGVerticalFrame(hf);
    hf->AddFrame(m_guiFrame, new TGLayoutHints(kLHintsExpandX));
    m_guiFrame->SetCleanup(kDeepCleanup);

    // legend
    TRootEmbeddedCanvas* ec = new TRootEmbeddedCanvas("Embeddedcanvas", hf, 100, 100, 0);
    hf->AddFrame(ec, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
    m_infoCanvas = ec->GetCanvas();
    m_infoCanvas->SetHighLightColor(-1);
  }

  cf->MapSubwindows();
  cf->Layout();
  cf->MapWindow();

  // view canvas
  TRootEmbeddedCanvas* ec = new TRootEmbeddedCanvas();
  TEveWindowFrame* wf = pack->NewSlotWithWeight(3)->MakeFrame(ec);
  wf->GetEveFrame()->SetShowTitleBar(kFALSE);
  m_viewCanvas = ec->GetCanvas();

  pack->GetEveFrame()->Layout();
}