15 #include "TGScrollBar.h" 16 #include "TGTableLayout.h" 17 #include "TGResourcePool.h" 29 static const UInt_t
kRowOptions = kLHintsExpandX | kLHintsFillX | kLHintsShrinkX;
30 static const UInt_t
kColOptions = kLHintsExpandY | kLHintsFillY | kLHintsShrinkY;
40 : TGCompositeFrame(
p),
41 m_bodyTable(iManager),
48 m_showingVSlider(
true),
49 m_showingHSlider(
true),
51 m_descendingSort(
true),
53 m_headerBackground(nullptr),
54 m_headerForeground(nullptr),
55 m_lineSeparator(nullptr) {
56 SetLayoutManager(
new TGTableLayout(
this, 3, 3));
60 AddFrame(
m_header,
new TGTableLayoutHints(1, 2, 0, 1, kLHintsTop | kLHintsLeft |
kRowOptions));
62 m_header->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
65 "buttonReleasedInHeader(Int_t,Int_t,Event_t*,Int_t,Int_t)");
70 m_body->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
73 "buttonReleasedInBody(Int_t,Int_t,Event_t*,Int_t,Int_t)");
79 for (std::vector<unsigned int>::iterator
it = columnWidths.begin(),
80 itEnd = columnWidths.end(),
81 itHeader = headerWidths.begin();
84 if (*itHeader > *
it) {
98 m_rowHeader->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
101 "buttonReleasedInBody(Int_t,Int_t,Event_t*,Int_t,Int_t)");
102 m_rowHeader->Connect(
"buttonReleased(Int_t,Int_t,Event_t*,Int_t,Int_t)",
105 "buttonReleasedInRowHeader(Int_t,Int_t,Event_t*,Int_t,Int_t)");
111 m_hSlider->Connect(
"ProcessedEvent(Event_t*)",
"FWTableWidget",
this,
"childrenEvent(Event_t *)");
115 m_vSlider->Connect(
"ProcessedEvent(Event_t*)",
"FWTableWidget",
this,
"childrenEvent(Event_t *)");
123 m_hSlider->SetEditDisabled(kEditDisable | kEditDisableGrab | kEditDisableBtnEnable);
124 m_vSlider->SetEditDisabled(kEditDisable | kEditDisableGrab | kEditDisableBtnEnable);
125 m_bodyTable->Connect(
"dataChanged()",
"FWTableWidget",
this,
"dataChanged()");
142 gClient->GetResourcePool()->GetGCPool()->FreeGC(
m_lineSeparator->GetGC());
174 TGFrame::SetBackgroundColor(iColor);
180 m_header->SetBackgroundColor(iColor);
183 m_body->SetBackgroundColor(iColor);
190 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
200 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
211 GCValues_t
t = *(gClient->GetResourcePool()->GetFrameGC()->GetAttributes());
212 m_lineSeparator = gClient->GetResourcePool()->GetGCPool()->GetGC(&
t, kTRUE);
223 TGCompositeFrame::Resize(
w,
h);
228 bool redoLayout =
false;
231 UInt_t fullWidth =
def.fWidth;
236 UInt_t headerHeight = 0;
238 headerHeight =
m_header->GetHeight();
240 UInt_t fullHeight =
def.fHeight + headerHeight;
242 UInt_t sBarWidth = (
h < fullHeight) ?
m_vSlider->GetWidth() : 0;
243 UInt_t sBarHeight = (
w < fullWidth) ?
m_hSlider->GetHeight() : 0;
244 if (sBarWidth == 0 && sBarHeight > 0 &&
h < fullHeight + sBarHeight)
246 else if (sBarHeight == 0 && sBarWidth > 0 &&
h < fullWidth + sBarWidth)
248 fullWidth += sBarWidth;
249 fullHeight += sBarHeight;
267 if (
h < fullHeight) {
291 if (
w != GetWidth() ||
h != GetHeight()) {
294 TGCompositeFrame::MoveResize(
x,
y,
w,
h);
300 switch (GET_MSG(
msg)) {
302 switch (GET_SUBMSG(
msg)) {
303 case kSB_SLIDERTRACK:
314 switch (GET_SUBMSG(
msg)) {
315 case kSB_SLIDERTRACK:
332 Int_t btn =
event->fCode;
333 Int_t keyMod =
event->fState;
335 if (btn == kButton1 || btn == kButton3) {
346 Int_t btn =
event->fCode;
347 Int_t keyMod =
event->fState;
348 if (btn == kButton5) {
361 if (btn == kButton4) {
373 if (btn != kButton1 && btn != kButton3) {
376 if (row >= -1 and row < m_bodyTable->numberOfRows()) {
377 Int_t globalX, globalY;
379 gVirtualX->TranslateCoordinates(
380 m_body->GetId(), gClient->GetDefaultRoot()->GetId(),
event->fX,
event->fY, globalX, globalY, childdum);
387 keyMod = (keyMod & (kKeyShiftMask | kKeyControlMask));
390 args[0] = (Long_t)row;
391 args[1] = (Long_t)column;
392 args[2] = (Long_t)btn;
393 args[3] = (Long_t)keyMod;
394 args[4] = (Long_t)iGlobalX;
395 args[5] = (Long_t)iGlobalY;
396 Emit(
"cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
args);
404 keyMod = (keyMod & (kKeyShiftMask | kKeyControlMask));
407 args[0] = (Long_t)row;
408 args[1] = (Long_t)btn;
409 args[2] = (Long_t)keyMod;
410 args[3] = (Long_t)iGlobalX;
411 args[4] = (Long_t)iGlobalY;
412 Emit(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
args);
416 keyMod = (keyMod & (kKeyShiftMask | kKeyControlMask));
419 args[0] = (Long_t)column;
420 args[1] = (Long_t)btn;
421 args[2] = (Long_t)keyMod;
422 Emit(
"columnClicked(Int_t,Int_t,Int_t)",
args);
440 for (std::vector<unsigned int>::iterator
it = columnWidths.begin(),
441 itEnd = columnWidths.end(),
442 itHeader = headerWidths.begin();
445 if (*itHeader > *
it) {
454 bool layoutDoneByhandleResize =
handleResize(GetWidth(), GetHeight());
455 if (needs_layout && !layoutDoneByhandleResize) {
458 gClient->NeedRedraw(
m_body);
466 Int_t btn =
event->fCode;
467 if (btn != kButton1 && btn != kButton3) {
473 Int_t btn =
event->fCode;
474 if (btn != kButton1 && btn != kButton3) {
484 TGDimension returnValue;
486 returnValue.fHeight +=
m_header->GetDefaultHeight();
489 returnValue.fWidth +=
m_rowHeader->GetDefaultWidth();
492 returnValue.fHeight +=
m_hSlider->GetDefaultHeight();
493 returnValue.fWidth +=
m_vSlider->GetDefaultWidth();
int def(FILE *, FILE *, int)
virtual bool cellDataIsSortable() const
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 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...
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.