Belle II Software development
InfoWidget.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 <TGHtml.h> //huge number of defines, might want to hide that part.
11#include <TString.h>
12
13#include <set>
14#include <vector>
15
16class TObject;
17class TGWindow;
18
19namespace Belle2 {
27 class InfoWidget : public TGHtml {
28 public:
30 explicit InfoWidget(const TGWindow* p);
32
34 void update();
35
42 void show(const char* uri = "main:", bool clearSelection = true);
43
48 void show(const TObject* obj);
49
51 void back();
52
54 virtual int IsVisited(const char* uri) override;
55
56 private:
63 struct URI {
64 URI() {}
66 explicit URI(const TString& uri);
67
69 static TString getURI(const TObject* obj);
70
71 const TObject* object = nullptr;
72 TString scheme = "";
73 TString entryName = "";
74 int arrayIndex = -1;
75 };
76
78 TString createMainPage() const;
80 TString createArrayPage(const URI& uri) const;
82 TString createObjectPage(const URI& uri) const;
83
85 TString getHeader(const URI& uri = URI()) const;
86
88 static TString getContents(const TObject* obj);
89
91 static TString getRelatedInfo(const TObject* obj);
92
93 std::set<TString> m_visited;
95 std::vector<TString> m_history;
98 };
99
101}
text-based info viewer showing DataStore contents.
Definition: InfoWidget.h:27
static TString getRelatedInfo(const TObject *obj)
return HTML-formatted list of related objects.
Definition: InfoWidget.cc:282
void back()
navigate to previous page, clearing current page from history.
Definition: InfoWidget.cc:79
ClassDefOverride(InfoWidget, 0)
text-based info viewer showing DataStore contents.
TString createObjectPage(const URI &uri) const
create object info.
Definition: InfoWidget.cc:198
std::set< TString > m_visited
list of all pages viewed in current event.
Definition: InfoWidget.h:93
virtual int IsVisited(const char *uri) override
Used to colour visited links.
Definition: InfoWidget.cc:49
void show(const char *uri="main:", bool clearSelection=true)
Navigate to given URI.
Definition: InfoWidget.cc:93
static TString getContents(const TObject *obj)
Get object contents (member data).
Definition: InfoWidget.cc:329
std::vector< TString > m_history
ordered list of all pages viewed in current event.
Definition: InfoWidget.h:95
void update()
reset for new event (try to show same object if it exists).
Definition: InfoWidget.cc:55
TString getHeader(const URI &uri=URI()) const
returns string with title, breadcrumbs, menu.
Definition: InfoWidget.cc:207
TString createArrayPage(const URI &uri) const
create list of array contents.
Definition: InfoWidget.cc:179
TString createMainPage() const
create DataStore overview.
Definition: InfoWidget.cc:127
Abstract base class for different kinds of events.
TString scheme
scheme name (part before first colon).
Definition: InfoWidget.h:72
int arrayIndex
index in array, only valid if arrayName and object are filled.
Definition: InfoWidget.h:74
TString entryName
name of DataStore entry.
Definition: InfoWidget.h:73
static TString getURI(const TObject *obj)
get URI string to given object.
Definition: InfoWidget.cc:272