Belle II Software development
BrowsableWrapper Class Reference

A wrapper for browsable objects to enable automatic redrawing. More...

#include <BrowsableWrapper.h>

Inheritance diagram for BrowsableWrapper:

Public Member Functions

 BrowsableWrapper (TObject *wrapped)
 Wrap the given object, does NOT take ownership.
 
virtual void Browse (TBrowser *b)
 Reimplementation to store additional info on current state.
 
virtual const char * GetIconName () const
 Wrap.
 
virtual const char * GetName () 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 Public Member Functions

static const std::map< TVirtualPad *, std::string > & getPads ()
 Get list of pads (static).
 

Private Member Functions

 ClassDef (BrowsableWrapper, 0)
 A wrapper for browsable objects to enable automatic redrawing.
 

Private Attributes

TObject * m_wrapped
 wrapped object.
 

Static Private Attributes

static std::map< TVirtualPad *, std::string > s_pads
 TPad -> name of drawn object.
 

Detailed Description

A wrapper for browsable objects to enable automatic redrawing.

Definition at line 25 of file BrowsableWrapper.h.

Constructor & Destructor Documentation

◆ BrowsableWrapper()

BrowsableWrapper ( TObject *  wrapped)
inlineexplicit

Wrap the given object, does NOT take ownership.

Definition at line 28 of file BrowsableWrapper.h.

28: m_wrapped(wrapped) { }
TObject * m_wrapped
wrapped object.

◆ ~BrowsableWrapper()

virtual ~BrowsableWrapper ( )
inlinevirtual

Definition at line 29 of file BrowsableWrapper.h.

29{ }

Member Function Documentation

◆ Browse()

void Browse ( TBrowser *  b)
virtual

Reimplementation to store additional info on current state.

Definition at line 18 of file BrowsableWrapper.cc.

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}
static std::map< TVirtualPad *, std::string > s_pads
TPad -> name of drawn object.

◆ GetIconName()

virtual const char * GetIconName ( ) const
inlinevirtual

Wrap.

Definition at line 35 of file BrowsableWrapper.h.

35{ return m_wrapped ? m_wrapped->GetIconName() : ""; }

◆ GetName()

virtual const char * GetName ( ) const
inlinevirtual

Wrap.

Definition at line 37 of file BrowsableWrapper.h.

37{ return m_wrapped ? m_wrapped->GetName() : ""; }

◆ getPads()

static const std::map< TVirtualPad *, std::string > & getPads ( )
inlinestatic

Get list of pads (static).

Definition at line 50 of file BrowsableWrapper.h.

50{ return s_pads; }

◆ padClosed()

void padClosed ( )

Slot to remove associated pad from central map.

Definition at line 31 of file BrowsableWrapper.cc.

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}

◆ setWrapped()

void setWrapped ( TObject *  wrapped)
inline

Wrap the given object, does NOT take ownership.

Definition at line 47 of file BrowsableWrapper.h.

47{ m_wrapped = wrapped; }

Member Data Documentation

◆ m_wrapped

TObject* m_wrapped
private

wrapped object.

Definition at line 53 of file BrowsableWrapper.h.

◆ s_pads

std::map< TVirtualPad *, std::string > s_pads
staticprivate

TPad -> name of drawn object.

Definition at line 54 of file BrowsableWrapper.h.


The documentation for this class was generated from the following files: