Belle II Software development
BrowsableWrapper.h
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#pragma once
9
10#include <TQObject.h>
11#include <TObject.h>
12
13#include <string>
14#include <map>
15
16class TBrowser;
17class TVirtualPad;
18
19namespace Belle2 {
25 class BrowsableWrapper : public TQObject, public TObject {
26 public:
28 explicit BrowsableWrapper(TObject* wrapped): m_wrapped(wrapped) { }
29 virtual ~BrowsableWrapper() { }
30
32 virtual void Browse(TBrowser* b);
33
35 virtual const char* GetIconName() const { return m_wrapped ? m_wrapped->GetIconName() : ""; }
37 virtual const char* GetName() const { return m_wrapped ? m_wrapped->GetName() : ""; }
38
39 //not a good idea without making all other functions of wrapped object available :/
40 //virtual bool InheritsFrom(const char* classname) const { return m_wrapped?m_wrapped->InheritsFrom(classname):false; }
41 //virtual TClass* IsA() const { return m_wrapped?m_wrapped->IsA():TObject::Class(); }
42
44 void padClosed();
45
47 void setWrapped(TObject* wrapped) { m_wrapped = wrapped; }
48
50 static const std::map<TVirtualPad*, std::string>& getPads() { return s_pads; }
51
52 private:
53 TObject* m_wrapped;
54 static std::map<TVirtualPad*, std::string> s_pads;
58 };
60}
A wrapper for browsable objects to enable automatic redrawing.
virtual const char * GetName() const
Wrap.
virtual void Browse(TBrowser *b)
Reimplementation to store additional info on current state.
BrowsableWrapper(TObject *wrapped)
Wrap the given object, does NOT take ownership.
virtual const char * GetIconName() const
Wrap.
void padClosed()
Slot to remove associated pad from central map.
void setWrapped(TObject *wrapped)
Wrap the given object, does NOT take ownership.
static const std::map< TVirtualPad *, std::string > & getPads()
Get list of pads (static).
TObject * m_wrapped
wrapped object.
ClassDef(BrowsableWrapper, 0)
A wrapper for browsable objects to enable automatic redrawing.
static std::map< TVirtualPad *, std::string > s_pads
TPad -> name of drawn object.
Abstract base class for different kinds of events.