15 #include "TGScrollBar.h" 16 #include "TGTableLayout.h" 17 #include "TGResourcePool.h" 30 static const UInt_t
kRowOptions = kLHintsExpandX|kLHintsFillX|kLHintsShrinkX;
31 static const UInt_t
kColOptions = kLHintsExpandY|kLHintsFillY|kLHintsShrinkY;
42 m_bodyTable(iManager),
47 m_showingVSlider(
true),
48 m_showingHSlider(
true),
50 m_descendingSort(
true),
56 SetLayoutManager(
new TGTableLayout(
this,3,3) );
61 if (
m_bodyTable->
cellDataIsSortable())
m_header->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
"FWTableWidget",
this,
"buttonReleasedInHeader(Int_t,Int_t,Event_t*,Int_t,Int_t)");
66 m_body->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
"FWTableWidget",
this,
"buttonReleasedInBody(Int_t,Int_t,Event_t*,Int_t,Int_t)");
72 for(std::vector<unsigned int>::iterator it = columnWidths.begin(), itEnd=columnWidths.end(), itHeader=headerWidths.begin();
89 m_rowHeader->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
"FWTableWidget",
this,
"buttonReleasedInBody(Int_t,Int_t,Event_t*,Int_t,Int_t)");
90 m_rowHeader->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
"FWTableWidget",
this,
"buttonReleasedInRowHeader(Int_t,Int_t,Event_t*,Int_t,Int_t)");
96 m_hSlider->Connect(
"ProcessedEvent(Event_t*)",
"FWTableWidget",
this,
"childrenEvent(Event_t *)");
100 m_vSlider->Connect(
"ProcessedEvent(Event_t*)",
"FWTableWidget",
this,
"childrenEvent(Event_t *)");
108 m_hSlider->SetEditDisabled(kEditDisable | kEditDisableGrab | kEditDisableBtnEnable);
109 m_vSlider->SetEditDisabled(kEditDisable | kEditDisableGrab | kEditDisableBtnEnable);
110 m_bodyTable->Connect(
"dataChanged()",
"FWTableWidget",
this,
"dataChanged()");
128 gClient->GetResourcePool()->GetGCPool()->FreeGC(
m_lineSeparator->GetGC());
165 TGFrame::SetBackgroundColor(iColor);
171 m_header->SetBackgroundColor(iColor);
174 m_body->SetBackgroundColor(iColor);
183 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
195 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
208 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
209 m_lineSeparator = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
223 TGCompositeFrame::Resize(w,h);
230 bool redoLayout=
false;
233 UInt_t fullWidth = def.fWidth;
238 UInt_t headerHeight = 0;
240 headerHeight =
m_header->GetHeight();
242 UInt_t fullHeight = def.fHeight + headerHeight;
244 UInt_t sBarWidth = (h < fullHeight) ?
m_vSlider->GetWidth() : 0;
245 UInt_t sBarHeight = (w < fullWidth) ?
m_hSlider->GetHeight() : 0;
246 if (sBarWidth == 0 && sBarHeight > 0 && h < fullHeight + sBarHeight)
248 else if (sBarHeight == 0 && sBarWidth > 0 && h < fullWidth + sBarWidth)
250 fullWidth += sBarWidth;
251 fullHeight += sBarHeight;
295 if(w != GetWidth() || h != GetHeight()) {
298 TGCompositeFrame::MoveResize(x,y,w,h);
306 switch (GET_MSG(msg)) {
308 switch (GET_SUBMSG(msg)) {
309 case kSB_SLIDERTRACK:
320 switch (GET_SUBMSG(msg)) {
321 case kSB_SLIDERTRACK:
340 Int_t btn =
event->fCode;
341 Int_t keyMod =
event->fState;
343 if (btn == kButton1 || btn == kButton3) {
356 Int_t btn =
event->fCode;
357 Int_t keyMod =
event->fState;
379 if(btn != kButton1 && btn != kButton3) {
return;}
380 if(row>=-1 and row < m_bodyTable->numberOfRows()) {
381 Int_t globalX,globalY;
383 gVirtualX->TranslateCoordinates(
m_body->GetId(),
384 gClient->GetDefaultRoot()->GetId(),
385 event->fX,
event->fY,globalX,globalY,childdum);
394 keyMod = (keyMod&(kKeyShiftMask|kKeyControlMask));
398 args[1]=(Long_t)column;
400 args[3]=(Long_t)keyMod;
401 args[4]=(Long_t)iGlobalX;
402 args[5]=(Long_t)iGlobalY;
403 Emit(
"cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",args);
421 keyMod = (keyMod&(kKeyShiftMask|kKeyControlMask));
426 args[2]=(Long_t)keyMod;
427 args[3]=(Long_t)iGlobalX;
428 args[4]=(Long_t)iGlobalY;
429 Emit(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",args);
435 keyMod = (keyMod&(kKeyShiftMask|kKeyControlMask));
438 args[0]=(Long_t)column;
440 args[2]=(Long_t)keyMod;
441 Emit(
"columnClicked(Int_t,Int_t,Int_t)",args);
460 for(std::vector<unsigned int>::iterator it = columnWidths.begin(), itEnd=columnWidths.end(), itHeader=headerWidths.begin();
463 if(*itHeader > *it) {
472 bool layoutDoneByhandleResize =
handleResize(GetWidth(), GetHeight());
473 if (needs_layout && ! layoutDoneByhandleResize)
477 gClient->NeedRedraw(
m_body);
486 Int_t btn =
event->fCode;
487 if(btn != kButton1 && btn != kButton3) {
return;}
493 Int_t btn =
event->fCode;
494 if(btn != kButton1 && btn != kButton3) {
return;}
504 TGDimension returnValue;
506 returnValue.fHeight +=
m_header->GetDefaultHeight();
509 returnValue.fWidth +=
m_rowHeader->GetDefaultWidth();
512 returnValue.fHeight +=
m_hSlider->GetDefaultHeight();
513 returnValue.fWidth +=
m_vSlider->GetDefaultWidth();
virtual bool cellDataIsSortable() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void sort(int iCol, bool iSortOrder)
Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder...
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
virtual int unsortedRowNumber(int iSortedRowNumber) const =0
when passed the index to the sorted order of the rows it returns the original row number from the und...