1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
// -*- C++ -*-
//
// Package: TableWidget
// Class : FWTableManagerBase
//
// Implementation:
// <Notes on implementation>
//
// Original Author: Chris Jones
// Created: Mon Feb 2 16:40:44 EST 2009
//
// system include files
// user include files
#include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
#include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// constructors and destructor
//
FWTableManagerBase::FWTableManagerBase() : m_sortColumn(-1), m_sortOrder(false) {}
// FWTableManagerBase::FWTableManagerBase(const FWTableManagerBase& rhs)
// {
// // do actual copying here;
// }
FWTableManagerBase::~FWTableManagerBase() {}
//
// assignment operators
//
// const FWTableManagerBase& FWTableManagerBase::operator=(const FWTableManagerBase& rhs)
// {
// //An exception safe implementation is
// FWTableManagerBase temp(rhs);
// swap(rhs);
//
// return *this;
// }
//
// member functions
//
void FWTableManagerBase::sort(int col, bool sortOrder) {
if (col <= numberOfColumns()) {
m_sortColumn = col;
m_sortOrder = sortOrder;
implSort(col, sortOrder);
visualPropertiesChanged();
}
}
void FWTableManagerBase::dataChanged() {
if (-1 != m_sortColumn) {
implSort(m_sortColumn, m_sortOrder);
}
Emit("dataChanged()");
}
void FWTableManagerBase::visualPropertiesChanged() { Emit("visualPropertiesChanged()"); }
//
// const member functions
//
unsigned int FWTableManagerBase::cellHeight() const {
FWTableCellRendererBase* cr = cellRenderer(0, 0);
if (cr) {
return cr->height();
}
if (hasRowHeaders()) {
cr = rowHeader(0);
if (cr) {
return cr->height();
}
}
return 0;
}
std::vector<unsigned int> FWTableManagerBase::maxWidthForColumns() const {
std::vector<unsigned int> returnValue;
returnValue.reserve(numberOfColumns());
const int numCols = numberOfColumns();
const int numRows = numberOfRows();
for (int col = 0; col < numCols; ++col) {
unsigned int max = 0;
for (int row = 0; row < numRows; ++row) {
unsigned int width = cellRenderer(row, col)->width();
if (width > max) {
max = width;
}
}
returnValue.push_back(max);
}
return returnValue;
}
bool FWTableManagerBase::hasLabelHeaders() const { return true; }
bool FWTableManagerBase::hasRowHeaders() const { return false; }
FWTableCellRendererBase* FWTableManagerBase::rowHeader(int iRow) const { return nullptr; }
void FWTableManagerBase::buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
void FWTableManagerBase::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY) {}
//
// static member functions
//
ClassImp(FWTableManagerBase);
|