CMS 3D CMS Logo

FWSummaryManager.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWSummaryManager
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Mar 4 09:35:32 EST 2008
11 //
12 
13 // system include files
14 #include <functional>
15 
16 #include "TGFrame.h"
17 
18 // user include files
26 
29 
31 
32 //
33 // constants, enums and typedefs
34 //
35 
36 //
37 // static data member definitions
38 //
39 
40 //
41 // constructors and destructor
42 //
46  FWGUIManager* gm,
48  FWColorManager* colorm)
49  : m_guiManager(gm), m_colorManager(colorm), m_itemChanged(false) {
50  colorm->colorsHaveChanged_.connect(std::bind(&FWSummaryManager::colorsChanged, this));
51  sm->selectionChanged_.connect(std::bind(&FWSummaryManager::selectionChanged, this, std::placeholders::_1));
52  eim->newItem_.connect(std::bind(&FWSummaryManager::newItem, this, std::placeholders::_1));
53  eim->goingToClearItems_.connect(std::bind(&FWSummaryManager::removeAllItems, this));
55 
56  m_pack = new TGVerticalFrame(iParent);
57  m_pack->SetLayoutManager(new FWCompactVerticalLayout(m_pack));
58  const unsigned int backgroundColor = 0x2f2f2f;
59  m_pack->SetBackgroundColor(backgroundColor);
60  cm->changeSignalsAreDone_.connect(std::bind(&FWSummaryManager::changesDone, this));
61 }
62 
63 // FWSummaryManager::FWSummaryManager(const FWSummaryManager& rhs)
64 // {
65 // // do actual copying here;
66 // }
67 
69 
70 //
71 // assignment operators
72 //
73 // const FWSummaryManager& FWSummaryManager::operator=(const FWSummaryManager& rhs)
74 // {
75 // //An exception safe implementation is
76 // FWSummaryManager temp(rhs);
77 // swap(rhs);
78 //
79 // return *this;
80 // }
81 
82 //
83 // member functions
84 //
86  TGLayoutHints* hints = new TGLayoutHints(kLHintsExpandX);
88  m_pack->AddFrame(lst, hints);
89  m_collectionWidgets.push_back(lst);
91  lst->setBackgroundToWhite(backgroundIsWhite);
92  iItem->goingToBeDestroyed_.connect(std::bind(&FWSummaryManager::itemDestroyed, this, std::placeholders::_1));
93  iItem->itemChanged_.connect(std::bind(&FWSummaryManager::itemChanged, this, std::placeholders::_1));
94  lst->Connect("requestForInfo(FWEventItem*)", "FWSummaryManager", this, "requestForInfo(FWEventItem*)");
95  lst->Connect("requestForFilter(FWEventItem*)", "FWSummaryManager", this, "requestForFilter(FWEventItem*)");
96  lst->Connect("requestForErrorInfo(FWEventItem*)", "FWSummaryManager", this, "requestForError(FWEventItem*)");
97  lst->Connect("requestForController(FWEventItem*)", "FWSummaryManager", this, "requestForController(FWEventItem*)");
98  lst->Connect("requestForModelContextMenu(Int_t,Int_t)",
99  "FWSummaryManager",
100  this,
101  "requestForSelectedModelContextMenu(Int_t,Int_t)");
102 }
103 
105  m_pack->HideFrame(m_collectionWidgets[iItem->id()]);
106  m_pack->RemoveFrame(m_collectionWidgets[iItem->id()]);
107  delete m_collectionWidgets[iItem->id()];
108  m_collectionWidgets[iItem->id()] = nullptr;
109  m_pack->Layout();
110  gClient->NeedRedraw(m_pack);
111 }
112 
114 
116  for (std::vector<FWCollectionSummaryWidget*>::iterator it = m_collectionWidgets.begin(),
117  itEnd = m_collectionWidgets.end();
118  it != itEnd;
119  ++it) {
120  if (nullptr != *it) {
121  m_pack->HideFrame(*it);
122  m_pack->RemoveFrame(*it);
123  delete *it;
124  *it = nullptr;
125  }
126  }
127  m_collectionWidgets.clear();
128  m_pack->Layout();
129  gClient->NeedRedraw(m_pack);
130 }
131 
133 
135  if (m_itemChanged) {
136  m_pack->Layout();
137  m_itemChanged = false;
138  }
139 }
140 
142  bool backgroundIsWhite = m_colorManager->backgroundColorIndex() == FWColorManager::kWhiteIndex;
143 
145  m_pack->SetBackgroundColor(TGFrame::GetDefaultFrameBackground());
146  } else {
147  const unsigned int backgroundColor = 0x2f2f2f;
148  m_pack->SetBackgroundColor(backgroundColor);
149  }
150  gClient->NeedRedraw(m_pack);
151  for (std::vector<FWCollectionSummaryWidget*>::iterator it = m_collectionWidgets.begin(),
152  itEnd = m_collectionWidgets.end();
153  it != itEnd;
154  ++it) {
155  if (nullptr != *it) {
156  (*it)->setBackgroundToWhite(backgroundIsWhite);
157  }
158  }
159 }
160 
164 
166 
167 void FWSummaryManager::requestForSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY) {
168  m_guiManager->showSelectedModelContextMenu(iGlobalX, iGlobalY, nullptr);
169 }
170 
171 //
172 // const member functions
173 //
174 TGCompositeFrame* FWSummaryManager::widget() const { return m_pack; }
175 
176 //
177 // static member functions
178 //
std::vector< FWCollectionSummaryWidget * > m_collectionWidgets
sigc::signal< void(FWEventItem *)> newItem_
void requestForInfo(FWEventItem *)
unsigned int id() const
Definition: FWEventItem.cc:433
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
FWColorManager * m_colorManager
void showEDIFrame(int iInfoToShow=-1)
Allowed values are -1 or ones from FWDataCategories enum.
TGCompositeFrame * m_pack
void itemChanged(const FWEventItem *)
BackgroundColorIndex backgroundColorIndex() const
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
Bool_t isColorSetLight() const
sigc::signal< void()> changeSignalsAreDone_
FWSummaryManager(TGFrame *iParent, FWSelectionManager *, FWEventItemsManager *, FWGUIManager *, FWModelChangeManager *, FWColorManager *)
void requestForFilter(FWEventItem *)
void requestForSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY)
virtual ~FWSummaryManager()
void requestForError(FWEventItem *)
void selectionChanged(const FWSelectionManager &)
void newItem(FWEventItem *iItem)
void requestForController(FWEventItem *)
void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase *iHandler)
void itemDestroyed(const FWEventItem *)
sigc::signal< void()> colorsHaveChanged_
sigc::signal< void()> goingToClearItems_
FWGUIManager * m_guiManager
TGCompositeFrame * widget() const