Belle II Software  release-05-01-25
InfoWidget.h
1 #pragma once
2 
3 #include <TGHtml.h> //huge number of defines, might want to hide that part.
4 #include <TString.h>
5 
6 #include <set>
7 #include <vector>
8 
9 class TObject;
10 class TGWindow;
11 
12 namespace Belle2 {
20  class InfoWidget : public TGHtml {
21  public:
23  explicit InfoWidget(const TGWindow* p);
24  ~InfoWidget();
25 
27  void update();
28 
35  void show(const char* uri = "main:", bool clearSelection = true);
36 
41  void show(const TObject* obj);
42 
44  void back();
45 
47  virtual int IsVisited(const char* uri) override;
48 
49  private:
56  struct URI {
57  URI() {}
59  explicit URI(const TString& uri);
60 
62  static TString getURI(const TObject* obj);
63 
64  const TObject* object = nullptr;
65  TString scheme = "";
66  TString entryName = "";
67  int arrayIndex = -1;
68  };
69 
71  TString createMainPage() const;
73  TString createArrayPage(const URI& uri) const;
75  TString createObjectPage(const URI& uri) const;
76 
78  TString getHeader(const URI& uri = URI()) const;
79 
81  static TString getContents(const TObject* obj);
82 
84  static TString getRelatedInfo(const TObject* obj);
85 
86  std::set<TString> m_visited;
88  std::vector<TString> m_history;
91  };
92 
94 }
Belle2::InfoWidget::URI::entryName
TString entryName
name of DataStore entry.
Definition: InfoWidget.h:66
Belle2::InfoWidget::URI
a parsed URI.
Definition: InfoWidget.h:56
Belle2::InfoWidget::URI::getURI
static TString getURI(const TObject *obj)
get URI string to given object.
Definition: InfoWidget.cc:265
Belle2::InfoWidget::show
void show(const char *uri="main:", bool clearSelection=true)
Navigate to given URI.
Definition: InfoWidget.cc:86
Belle2::InfoWidget::m_history
std::vector< TString > m_history
ordered list of all pages viewed in current event.
Definition: InfoWidget.h:88
Belle2::InfoWidget::ClassDefOverride
ClassDefOverride(InfoWidget, 0)
text-based info viewer showing DataStore contents.
Belle2::InfoWidget::URI::scheme
TString scheme
scheme name (part before first colon).
Definition: InfoWidget.h:65
Belle2::InfoWidget
text-based info viewer showing DataStore contents.
Definition: InfoWidget.h:20
Belle2::InfoWidget::back
void back()
navigate to previous page, clearing current page from history.
Definition: InfoWidget.cc:72
Belle2::InfoWidget::m_visited
std::set< TString > m_visited
list of all pages viewed in current event.
Definition: InfoWidget.h:86
Belle2::InfoWidget::URI::arrayIndex
int arrayIndex
index in array, only valid if arrayName and object are filled.
Definition: InfoWidget.h:67
Belle2::InfoWidget::IsVisited
virtual int IsVisited(const char *uri) override
Used to colour visited links.
Definition: InfoWidget.cc:42
Belle2::InfoWidget::InfoWidget
InfoWidget(const TGWindow *p)
ctor.
Definition: InfoWidget.cc:27
Belle2::InfoWidget::getHeader
TString getHeader(const URI &uri=URI()) const
returns string with title, breadcrumbs, menu.
Definition: InfoWidget.cc:200
Belle2::InfoWidget::getRelatedInfo
static TString getRelatedInfo(const TObject *obj)
return HTML-formatted list of related objects.
Definition: InfoWidget.cc:275
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::InfoWidget::createArrayPage
TString createArrayPage(const URI &uri) const
create list of array contents.
Definition: InfoWidget.cc:172
Belle2::InfoWidget::createObjectPage
TString createObjectPage(const URI &uri) const
create object info.
Definition: InfoWidget.cc:191
Belle2::InfoWidget::update
void update()
reset for new event (try to show same object if it exists).
Definition: InfoWidget.cc:48
Belle2::InfoWidget::createMainPage
TString createMainPage() const
create DataStore overview.
Definition: InfoWidget.cc:120
Belle2::InfoWidget::getContents
static TString getContents(const TObject *obj)
Get object contents (member data).
Definition: InfoWidget.cc:322