CMS 3D CMS Logo

FWTableManagerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TableWidget
4 // Class : FWTableManagerBase
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Mon Feb 2 16:40:44 EST 2009
11 //
12 
13 // system include files
14 
15 // user include files
18 
19 
20 //
21 // constants, enums and typedefs
22 //
23 
24 //
25 // static data member definitions
26 //
27 
28 //
29 // constructors and destructor
30 //
32 m_sortColumn(-1),
33 m_sortOrder(false)
34 {
35 }
36 
37 // FWTableManagerBase::FWTableManagerBase(const FWTableManagerBase& rhs)
38 // {
39 // // do actual copying here;
40 // }
41 
43 {
44 }
45 
46 //
47 // assignment operators
48 //
49 // const FWTableManagerBase& FWTableManagerBase::operator=(const FWTableManagerBase& rhs)
50 // {
51 // //An exception safe implementation is
52 // FWTableManagerBase temp(rhs);
53 // swap(rhs);
54 //
55 // return *this;
56 // }
57 
58 //
59 // member functions
60 //
61 void
63 {
64  if(col <= numberOfColumns()) {
65  m_sortColumn = col;
67  implSort(col,sortOrder);
69  }
70 }
71 
73 {
74  if(-1 != m_sortColumn) {
76  }
77  Emit("dataChanged()");
78 }
79 
81 {
82  Emit("visualPropertiesChanged()");
83 }
84 
85 //
86 // const member functions
87 //
88 unsigned int FWTableManagerBase::cellHeight() const
89 {
91  if(cr) {
92  return cr->height();
93  }
94  if(hasRowHeaders()) {
95  cr = rowHeader(0);
96  if(cr) {
97  return cr->height();
98  }
99  }
100  return 0;
101 }
102 
103 std::vector<unsigned int> FWTableManagerBase::maxWidthForColumns() const
104 {
105  std::vector<unsigned int> returnValue;
106  returnValue.reserve(numberOfColumns());
107  const int numCols= numberOfColumns();
108  const int numRows = numberOfRows();
109  for(int col = 0; col < numCols; ++col) {
110  unsigned int max = 0;
111  for(int row=0; row < numRows; ++row) {
112  unsigned int width = cellRenderer(row,col)->width();
113  if(width > max) {
114  max = width;
115  }
116  }
117  returnValue.push_back(max);
118  }
119  return returnValue;
120 }
121 
123 {
124  return true;
125 }
126 
128 {
129  return false;
130 }
132 {
133  return nullptr;
134 }
135 
136 void
137 FWTableManagerBase::buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY)
138 {
139 }
140 void
141 FWTableManagerBase::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY)
142 {
143 }
144 
145 //
146 // static member functions
147 //
bool sortOrder(void)
The current sort order for the table.
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const =0
virtual int numberOfRows() const =0
Number of rows in the table.
virtual void implSort(int iCol, bool iSortOrder)=0
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
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 UInt_t height() const =0
returns the minimum height of the cell to which the renderer is representing
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column ...
virtual bool hasLabelHeaders() const
ClassImp(AliDaqEventHeader) ClassImp(AliDaqPosition2D) ClassImp(AliDaqPositionCOPS) ClassImp(AliDaqTilt) ClassImp(AliDaqDistance) ClassImp(AliDaqTemperature) ClassImp(CocoaDaqRootEvent) CocoaDaqRootEvent
virtual int numberOfColumns() const =0
Number of columns in the table.
virtual UInt_t width() const =0
returns the minimum width of the cell to which the renderer is representing
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
virtual void buttonPressedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
Called if mouse button pressed in Row Header, defaults is to do nothing.
~FWTableManagerBase() override
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
col
Definition: cuy.py:1010
virtual unsigned int cellHeight() const
require all cells to be the same height
virtual FWTableCellRendererBase * rowHeader(int iSortedRowNumber) const
Returns the renderer for the row header for the sorted row number iSortedRowNumber.
Definition: event.py:1
virtual bool hasRowHeaders() const
Returns &#39;true&#39; if this table has row headers. Defaults return value is false.