Belle II Software development
BrowsableWrapper.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <display/BrowsableWrapper.h>
9
10#include <framework/logging/Logger.h>
11
12#include <TVirtualPad.h>
13
14using namespace Belle2;
15
16std::map<TVirtualPad*, std::string> BrowsableWrapper::s_pads;
17
18void BrowsableWrapper::Browse(TBrowser* b)
19{
20 if (!m_wrapped) {
21 B2ERROR("Trying to browse invalid object!");
22 return;
23 }
24 std::string name(m_wrapped->GetName());
25 s_pads[gPad] = name;
26 gPad->Connect("Closed()", "Belle2::BrowsableWrapper", this, "padClosed()");
27
28 m_wrapped->Browse(b);
29}
30
32{
33 TVirtualPad* pad = dynamic_cast<TVirtualPad*>(static_cast<TQObject*>(gTQSender));
34 if (!pad) {
35 B2ERROR("Sender is not a pad?");
36 return;
37 }
38
39 B2WARNING("TODO remove - deleting pad");
40 s_pads.erase(pad);
41}
virtual void Browse(TBrowser *b)
Reimplementation to store additional info on current state.
void padClosed()
Slot to remove associated pad from central map.
TObject * m_wrapped
wrapped object.
static std::map< TVirtualPad *, std::string > s_pads
TPad -> name of drawn object.
Abstract base class for different kinds of events.