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 <boost/bind.hpp>
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(boost::bind(&FWSummaryManager::colorsChanged, this));
51  sm->selectionChanged_.connect(boost::bind(&FWSummaryManager::selectionChanged, this, _1));
52  eim->newItem_.connect(boost::bind(&FWSummaryManager::newItem, this, _1));
53  eim->goingToClearItems_.connect(boost::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(boost::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(boost::bind(&FWSummaryManager::itemDestroyed, this, _1));
93  iItem->itemChanged_.connect(boost::bind(&FWSummaryManager::itemChanged, this, _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 //
FWDataCategories.h
FWModelChangeManager.h
FWGUIManager
Definition: FWGUIManager.h:94
funct::false
false
Definition: Factorize.h:34
FWSummaryManager::m_itemChanged
bool m_itemChanged
Definition: FWSummaryManager.h:84
FWSummaryManager::selectionChanged
void selectionChanged(const FWSelectionManager &)
Definition: FWSummaryManager.cc:132
FWColorManager::colorsHaveChanged_
sigc::signal< void > colorsHaveChanged_
Definition: FWColorManager.h:101
FWEventItemsManager
Definition: FWEventItemsManager.h:44
FWSummaryManager.h
FWEventItem::goingToBeDestroyed_
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
FWSummaryManager::requestForController
void requestForController(FWEventItem *)
Definition: FWSummaryManager.cc:165
FWCompactVerticalLayout.h
FWSummaryManager::FWSummaryManager
FWSummaryManager(TGFrame *iParent, FWSelectionManager *, FWEventItemsManager *, FWGUIManager *, FWModelChangeManager *, FWColorManager *)
Definition: FWSummaryManager.cc:43
FWSummaryManager::requestForError
void requestForError(FWEventItem *)
Definition: FWSummaryManager.cc:163
FWModelChangeManager::itemsGoingToBeClearedSlot
void itemsGoingToBeClearedSlot(void)
Definition: FWModelChangeManager.cc:170
FWColorManager::backgroundColorIndex
BackgroundColorIndex backgroundColorIndex() const
Definition: FWColorManager.cc:260
FWEventItem::id
unsigned int id() const
Definition: FWEventItem.cc:433
FWModelChangeManager
Definition: FWModelChangeManager.h:33
FWSummaryManager::requestForFilter
void requestForFilter(FWEventItem *)
Definition: FWSummaryManager.cc:162
FWEventItemsManager::goingToClearItems_
sigc::signal< void > goingToClearItems_
Definition: FWEventItemsManager.h:75
FWSummaryManager::newItem
void newItem(FWEventItem *iItem)
Definition: FWSummaryManager.cc:85
FWModelChangeManager::changeSignalsAreDone_
sigc::signal< void > changeSignalsAreDone_
Definition: FWModelChangeManager.h:50
FWSummaryManager::requestForSelectedModelContextMenu
void requestForSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY)
Definition: FWSummaryManager.cc:167
FWSummaryManager::~FWSummaryManager
virtual ~FWSummaryManager()
Definition: FWSummaryManager.cc:68
FWSelectionManager.h
FWSummaryManager::itemDestroyed
void itemDestroyed(const FWEventItem *)
Definition: FWSummaryManager.cc:104
FWColorManager.h
kData
Definition: FWDataCategories.h:26
FWSelectionManager::selectionChanged_
sigc::signal< void, const FWSelectionManager & > selectionChanged_
Definition: FWSelectionManager.h:53
FWSummaryManager::widget
TGCompositeFrame * widget() const
Definition: FWSummaryManager.cc:174
lst
int lst[30]
Definition: CascadeWrapper.h:19
FWSummaryManager::colorsChanged
void colorsChanged()
Definition: FWSummaryManager.cc:141
FWSummaryManager::m_guiManager
FWGUIManager * m_guiManager
Definition: FWSummaryManager.h:82
FWGUIManager::showEDIFrame
void showEDIFrame(int iInfoToShow=-1)
Allowed values are -1 or ones from FWDataCategories enum.
Definition: FWGUIManager.cc:557
FWEventItem::itemChanged_
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
FWSelectionManager
Definition: FWSelectionManager.h:34
FWGUIManager::showSelectedModelContextMenu
void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase *iHandler)
Definition: FWGUIManager.cc:673
FWSummaryManager::changesDone
void changesDone()
Definition: FWSummaryManager.cc:134
FWColorManager
Definition: FWColorManager.h:45
FWSummaryManager::m_collectionWidgets
std::vector< FWCollectionSummaryWidget * > m_collectionWidgets
Definition: FWSummaryManager.h:81
FWEventItem.h
FWCompactVerticalLayout
Definition: FWCompactVerticalLayout.h:28
FWSummaryManager::requestForInfo
void requestForInfo(FWEventItem *)
Definition: FWSummaryManager.cc:161
kFilter
Definition: FWDataCategories.h:26
FWColorManager::kWhiteIndex
Definition: FWColorManager.h:73
FWEventItem
Definition: FWEventItem.h:56
FWSummaryManager::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWSummaryManager.cc:113
FWSummaryManager::m_colorManager
FWColorManager * m_colorManager
Definition: FWSummaryManager.h:83
FWSummaryManager::removeAllItems
void removeAllItems()
Definition: FWSummaryManager.cc:115
FWEventItemsManager::newItem_
sigc::signal< void, FWEventItem * > newItem_
Definition: FWEventItemsManager.h:73
FWCollectionSummaryWidget
Definition: FWCollectionSummaryWidget.h:49
FWEventItemsManager.h
FWCollectionSummaryWidget.h
FWSummaryManager::m_pack
TGCompositeFrame * m_pack
Definition: FWSummaryManager.h:80
FWColorManager::isColorSetLight
Bool_t isColorSetLight() const
Definition: FWColorManager.h:58
FWGUIManager.h