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 //
ClassImp(FWTableManagerBase)
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
bool sortOrder(void)
The current sort order for the table.
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column ...
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...
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual FWTableCellRendererBase * rowHeader(int iSortedRowNumber) const
Returns the renderer for the row header for the sorted row number iSortedRowNumber.
virtual int numberOfRows() const =0
Number of rows in the table.
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const =0
virtual bool hasRowHeaders() const
Returns &#39;true&#39; if this table has row headers. Defaults return value is false.
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
virtual bool hasLabelHeaders() const
virtual unsigned int cellHeight() const
require all cells to be the same height
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.
virtual UInt_t height() const =0
returns the minimum height of the cell to which the renderer is representing
~FWTableManagerBase() override
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
col
Definition: cuy.py:1009
Definition: event.py:1