File indexing completed on 2024-04-06 12:11:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
0017 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 FWTableManagerBase::FWTableManagerBase() : m_sortColumn(-1), m_sortOrder(false) {}
0031
0032
0033
0034
0035
0036
0037 FWTableManagerBase::~FWTableManagerBase() {}
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 void FWTableManagerBase::sort(int col, bool sortOrder) {
0055 if (col <= numberOfColumns()) {
0056 m_sortColumn = col;
0057 m_sortOrder = sortOrder;
0058 implSort(col, sortOrder);
0059 visualPropertiesChanged();
0060 }
0061 }
0062
0063 void FWTableManagerBase::dataChanged() {
0064 if (-1 != m_sortColumn) {
0065 implSort(m_sortColumn, m_sortOrder);
0066 }
0067 Emit("dataChanged()");
0068 }
0069
0070 void FWTableManagerBase::visualPropertiesChanged() { Emit("visualPropertiesChanged()"); }
0071
0072
0073
0074
0075 unsigned int FWTableManagerBase::cellHeight() const {
0076 FWTableCellRendererBase* cr = cellRenderer(0, 0);
0077 if (cr) {
0078 return cr->height();
0079 }
0080 if (hasRowHeaders()) {
0081 cr = rowHeader(0);
0082 if (cr) {
0083 return cr->height();
0084 }
0085 }
0086 return 0;
0087 }
0088
0089 std::vector<unsigned int> FWTableManagerBase::maxWidthForColumns() const {
0090 std::vector<unsigned int> returnValue;
0091 returnValue.reserve(numberOfColumns());
0092 const int numCols = numberOfColumns();
0093 const int numRows = numberOfRows();
0094 for (int col = 0; col < numCols; ++col) {
0095 unsigned int max = 0;
0096 for (int row = 0; row < numRows; ++row) {
0097 unsigned int width = cellRenderer(row, col)->width();
0098 if (width > max) {
0099 max = width;
0100 }
0101 }
0102 returnValue.push_back(max);
0103 }
0104 return returnValue;
0105 }
0106
0107 bool FWTableManagerBase::hasLabelHeaders() const { return true; }
0108
0109 bool FWTableManagerBase::hasRowHeaders() const { return false; }
0110 FWTableCellRendererBase* FWTableManagerBase::rowHeader(int iRow) const { return nullptr; }
0111
0112 void FWTableManagerBase::buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
0113 void FWTableManagerBase::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
0114
0115
0116
0117
0118 ClassImp(FWTableManagerBase);