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 // constants, enums and typedefs
21 //
22 
23 //
24 // static data member definitions
25 //
26 
27 //
28 // constructors and destructor
29 //
30 FWTableManagerBase::FWTableManagerBase() : m_sortColumn(-1), m_sortOrder(false) {}
31 
32 // FWTableManagerBase::FWTableManagerBase(const FWTableManagerBase& rhs)
33 // {
34 // // do actual copying here;
35 // }
36 
38 
39 //
40 // assignment operators
41 //
42 // const FWTableManagerBase& FWTableManagerBase::operator=(const FWTableManagerBase& rhs)
43 // {
44 // //An exception safe implementation is
45 // FWTableManagerBase temp(rhs);
46 // swap(rhs);
47 //
48 // return *this;
49 // }
50 
51 //
52 // member functions
53 //
54 void FWTableManagerBase::sort(int col, bool sortOrder) {
55  if (col <= numberOfColumns()) {
56  m_sortColumn = col;
60  }
61 }
62 
64  if (-1 != m_sortColumn) {
66  }
67  Emit("dataChanged()");
68 }
69 
70 void FWTableManagerBase::visualPropertiesChanged() { Emit("visualPropertiesChanged()"); }
71 
72 //
73 // const member functions
74 //
75 unsigned int FWTableManagerBase::cellHeight() const {
77  if (cr) {
78  return cr->height();
79  }
80  if (hasRowHeaders()) {
81  cr = rowHeader(0);
82  if (cr) {
83  return cr->height();
84  }
85  }
86  return 0;
87 }
88 
89 std::vector<unsigned int> FWTableManagerBase::maxWidthForColumns() const {
90  std::vector<unsigned int> returnValue;
91  returnValue.reserve(numberOfColumns());
92  const int numCols = numberOfColumns();
93  const int numRows = numberOfRows();
94  for (int col = 0; col < numCols; ++col) {
95  unsigned int max = 0;
96  for (int row = 0; row < numRows; ++row) {
97  unsigned int width = cellRenderer(row, col)->width();
98  if (width > max) {
99  max = width;
100  }
101  }
102  returnValue.push_back(max);
103  }
104  return returnValue;
105 }
106 
107 bool FWTableManagerBase::hasLabelHeaders() const { return true; }
108 
109 bool FWTableManagerBase::hasRowHeaders() const { return false; }
110 FWTableCellRendererBase* FWTableManagerBase::rowHeader(int iRow) const { return nullptr; }
111 
112 void FWTableManagerBase::buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
113 void FWTableManagerBase::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
114 
115 //
116 // static member functions
117 //
FWTableManagerBase::cellRenderer
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const =0
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
FWTableManagerBase::sort
void sort(int iCol, bool iSortOrder)
Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder...
Definition: FWTableManagerBase.cc:54
funct::false
false
Definition: Factorize.h:29
FWTableManagerBase::buttonReleasedInRowHeader
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
Definition: FWTableManagerBase.cc:113
cuy.col
col
Definition: cuy.py:1010
ClassImp
ClassImp(FWTableManagerBase)
FWTableCellRendererBase::width
virtual UInt_t width() const =0
returns the minimum width of the cell to which the renderer is representing
FWTableManagerBase::buttonPressedInRowHeader
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.
Definition: FWTableManagerBase.cc:112
FWTableManagerBase::numberOfRows
virtual int numberOfRows() const =0
Number of rows in the table.
FWTableManagerBase::visualPropertiesChanged
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e....
Definition: FWTableManagerBase.cc:70
FWTableManagerBase::hasRowHeaders
virtual bool hasRowHeaders() const
Returns 'true' if this table has row headers. Defaults return value is false.
Definition: FWTableManagerBase.cc:109
FWTableManagerBase::~FWTableManagerBase
~FWTableManagerBase() override
Definition: FWTableManagerBase.cc:37
FWTableManagerBase
Definition: FWTableManagerBase.h:44
FWTableManagerBase::hasLabelHeaders
virtual bool hasLabelHeaders() const
Definition: FWTableManagerBase.cc:107
FWTableManagerBase::dataChanged
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
Definition: FWTableManagerBase.cc:63
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FWTableManagerBase::numberOfColumns
virtual int numberOfColumns() const =0
Number of columns in the table.
FWTableManagerBase::implSort
virtual void implSort(int iCol, bool iSortOrder)=0
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
FWTableCellRendererBase
Definition: FWTableCellRendererBase.h:44
FWTableCellRendererBase::height
virtual UInt_t height() const =0
returns the minimum height of the cell to which the renderer is representing
FWTableManagerBase::sortOrder
bool sortOrder(void)
The current sort order for the table.
Definition: FWTableManagerBase.h:102
FWTableManagerBase::rowHeader
virtual FWTableCellRendererBase * rowHeader(int iSortedRowNumber) const
Returns the renderer for the row header for the sorted row number iSortedRowNumber.
Definition: FWTableManagerBase.cc:110
FWTableManagerBase::m_sortOrder
bool m_sortOrder
Definition: FWTableManagerBase.h:118
FWTableCellRendererBase.h
FWTableManagerBase::m_sortColumn
int m_sortColumn
Definition: FWTableManagerBase.h:117
event
Definition: event.py:1
FWTableManagerBase::cellHeight
virtual unsigned int cellHeight() const
require all cells to be the same height
Definition: FWTableManagerBase.cc:75
FWTableManagerBase::maxWidthForColumns
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column
Definition: FWTableManagerBase.cc:89
FWTableManagerBase::FWTableManagerBase
FWTableManagerBase()
Definition: FWTableManagerBase.cc:30
FWTableManagerBase.h