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 ) :
50  m_guiManager(gm),
51  m_colorManager(colorm),
52 m_itemChanged(false)
53 {
54  colorm->colorsHaveChanged_.connect(boost::bind(&FWSummaryManager::colorsChanged,this));
55  sm->selectionChanged_.connect(boost::bind(&FWSummaryManager::selectionChanged,this,_1));
56  eim->newItem_.connect(boost::bind(&FWSummaryManager::newItem,
57  this, _1) );
58  eim->goingToClearItems_.connect(boost::bind(&FWSummaryManager::removeAllItems, this));
60 
61  m_pack = new TGVerticalFrame(iParent);
62  m_pack->SetLayoutManager( new FWCompactVerticalLayout(m_pack));
63  const unsigned int backgroundColor=0x2f2f2f;
64  m_pack->SetBackgroundColor(backgroundColor);
65  cm->changeSignalsAreDone_.connect(boost::bind(&FWSummaryManager::changesDone,this));
66 }
67 
68 // FWSummaryManager::FWSummaryManager(const FWSummaryManager& rhs)
69 // {
70 // // do actual copying here;
71 // }
72 
74 {
75 }
76 
77 //
78 // assignment operators
79 //
80 // const FWSummaryManager& FWSummaryManager::operator=(const FWSummaryManager& rhs)
81 // {
82 // //An exception safe implementation is
83 // FWSummaryManager temp(rhs);
84 // swap(rhs);
85 //
86 // return *this;
87 // }
88 
89 //
90 // member functions
91 //
92 void
94 {
95  TGLayoutHints* hints = new TGLayoutHints(kLHintsExpandX);
97  m_pack->AddFrame(lst, hints);
98  m_collectionWidgets.push_back(lst);
100  lst->setBackgroundToWhite(backgroundIsWhite);
101  iItem->goingToBeDestroyed_.connect(boost::bind(&FWSummaryManager::itemDestroyed,this,_1));
102  iItem->itemChanged_.connect(boost::bind(&FWSummaryManager::itemChanged,this,_1));
103  lst->Connect("requestForInfo(FWEventItem*)","FWSummaryManager",this,"requestForInfo(FWEventItem*)");
104  lst->Connect("requestForFilter(FWEventItem*)","FWSummaryManager",this,"requestForFilter(FWEventItem*)");
105  lst->Connect("requestForErrorInfo(FWEventItem*)","FWSummaryManager",this,"requestForError(FWEventItem*)");
106  lst->Connect("requestForController(FWEventItem*)","FWSummaryManager",this,"requestForController(FWEventItem*)");
107  lst->Connect("requestForModelContextMenu(Int_t,Int_t)","FWSummaryManager",this,"requestForSelectedModelContextMenu(Int_t,Int_t)");
108 }
109 
110 void
112 {
113  m_pack->HideFrame(m_collectionWidgets[iItem->id()]);
114  m_pack->RemoveFrame(m_collectionWidgets[iItem->id()]);
115  delete m_collectionWidgets[iItem->id()];
116  m_collectionWidgets[iItem->id()]=0;
117  m_pack->Layout();
118  gClient->NeedRedraw(m_pack);
119 }
120 
121 void
123 {
124  m_itemChanged = true;
125 }
126 
127 void
129 {
130  for(std::vector<FWCollectionSummaryWidget*>::iterator it = m_collectionWidgets.begin(),
131  itEnd = m_collectionWidgets.end();
132  it != itEnd;
133  ++it) {
134  if(0!=*it) {
135  m_pack->HideFrame(*it);
136  m_pack->RemoveFrame(*it);
137  delete *it;
138  *it=0;
139  }
140  }
141  m_collectionWidgets.clear();
142  m_pack->Layout();
143  gClient->NeedRedraw(m_pack);
144 }
145 
146 void
148 {
149 }
150 
151 void
153 {
154  if(m_itemChanged) {
155  m_pack->Layout();
156  m_itemChanged=false;
157  }
158 }
159 
160 void
162 {
164 
166  m_pack->SetBackgroundColor(TGFrame::GetDefaultFrameBackground());
167  } else {
168  const unsigned int backgroundColor=0x2f2f2f;
169  m_pack->SetBackgroundColor(backgroundColor);
170  }
171  gClient->NeedRedraw(m_pack);
172  for(std::vector<FWCollectionSummaryWidget*>::iterator it = m_collectionWidgets.begin(),
173  itEnd = m_collectionWidgets.end();
174  it != itEnd;
175  ++it) {
176  if(0!=*it) {
177  (*it)->setBackgroundToWhite(backgroundIsWhite);
178  }
179  }
180 }
181 
182 void
184 {
186 }
187 void
189 {
191 }
192 void
194 {
196 }
197 
198 void
200 {
202 }
203 
204 void
206 {
207  m_guiManager->showSelectedModelContextMenu(iGlobalX,iGlobalY,0);
208 }
209 
210 //
211 // const member functions
212 //
213 TGCompositeFrame*
215 {
216  return m_pack;
217 }
218 
219 //
220 // static member functions
221 //
Bool_t isColorSetLight() const
TGCompositeFrame * widget() const
std::vector< FWCollectionSummaryWidget * > m_collectionWidgets
void requestForInfo(FWEventItem *)
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:218
FWColorManager * m_colorManager
int lst[30]
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:202
sigc::signal< void, FWEventItem * > newItem_
unsigned int id() const
Definition: FWEventItem.cc:496
FWSummaryManager(TGFrame *iParent, FWSelectionManager *, FWEventItemsManager *, FWGUIManager *, FWModelChangeManager *, FWColorManager *)
void requestForFilter(FWEventItem *)
sigc::signal< void > changeSignalsAreDone_
void requestForSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY)
virtual ~FWSummaryManager()
void requestForError(FWEventItem *)
void selectionChanged(const FWSelectionManager &)
sigc::signal< void, const FWSelectionManager & > selectionChanged_
void newItem(FWEventItem *iItem)
void requestForController(FWEventItem *)
void showSelectedModelContextMenu(Int_t iGlobalX, Int_t iGlobalY, FWViewContextMenuHandlerBase *iHandler)
sigc::signal< void > colorsHaveChanged_
void itemDestroyed(const FWEventItem *)
sigc::signal< void > goingToClearItems_
FWGUIManager * m_guiManager