ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtSidebarInfoMacro.h
Go to the documentation of this file.
1 #ifndef ATSIDEBARINFOMACRO_H
2 #define ATSIDEBARINFOMACRO_H
3 
4 #include "AtDataObserver.h"
5 #include "AtSidebarAddon.h"
6 #include "AtViewerManagerSubject.h" // for AtTreeEntry
7 
8 #include <Rtypes.h> // for THashConsistencyHolder, UInt_t, ClassDef...
9 
10 #include <GuiTypes.h> // for Pixel_t
11 
12 #include <functional>
13 #include <string>
14 #include <utility> // for move
15 
16 class TBuffer;
17 class TClass;
18 class TGWindow;
19 class TMemberInspector;
20 namespace DataHandling {
21 class AtSubject;
22 }
23 
25 private:
26  using MacroFunction = std::function<std::string()>;
27  MacroFunction fFunction;
28 
29  DataHandling::AtTreeEntry &fEntryNumber;
30 
31  std::string fLabel;
32 
33 public:
34  AtSidebarInfoMacro(DataHandling::AtTreeEntry &entryNumber, const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
35  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground())
36  : AtSidebarAddon(p, w, h, options, back), fEntryNumber(entryNumber)
37  {
38  fEntryNumber.Attach(this);
39  }
40  ~AtSidebarInfoMacro() { fEntryNumber.Detach(this); }
41 
42  void SetFunction(MacroFunction function) { fFunction = std::move(function); }
43  void SetLabel(std::string label) { fLabel = label; }
44 
45  void Update(DataHandling::AtSubject *sub) override;
46 
47  void FillFrame() override;
48 
50 };
51 
52 #endif
AtDataObserver.h
AtSidebarInfoMacro::SetFunction
void SetFunction(MacroFunction function)
Definition: AtSidebarInfoMacro.h:42
DataHandling::AtObserver
Definition: AtDataObserver.h:12
AtSidebarInfoMacro
Definition: AtSidebarInfoMacro.h:24
AtSidebarInfoMacro::FillFrame
void FillFrame() override
Definition: AtSidebarInfoMacro.cxx:10
AtSidebarAddon
Definition: AtSidebarAddon.h:24
DataHandling::AtSubject::Detach
void Detach(AtObserver *observer)
Detach an observer to stop getting notified when this subject changes.
Definition: AtDataSubject.h:37
AtViewerManagerSubject.h
AtSidebarInfoMacro::Update
void Update(DataHandling::AtSubject *sub) override
Definition: AtSidebarInfoMacro.cxx:15
AtSidebarInfoMacro::~AtSidebarInfoMacro
~AtSidebarInfoMacro()
Definition: AtSidebarInfoMacro.h:40
DataHandling
Definition: AtDataObserver.h:4
AtSidebarInfoMacro::SetLabel
void SetLabel(std::string label)
Definition: AtSidebarInfoMacro.h:43
AtSidebarAddon.h
DataHandling::AtSubject::Attach
void Attach(AtObserver *observer)
Attach an observer to get notified when this subject changes.
Definition: AtDataSubject.cxx:12
DataHandling::AtSubject
Definition: AtDataSubject.h:24
DataHandling::AtTreeEntry
Subject for the entry number in the FairRoot tree.
Definition: AtViewerManagerSubject.h:17
AtSidebarInfoMacro::ClassDefOverride
ClassDefOverride(AtSidebarInfoMacro, 1)
AtSidebarInfoMacro::AtSidebarInfoMacro
AtSidebarInfoMacro(DataHandling::AtTreeEntry &entryNumber, const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarInfoMacro.h:34