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/src/FWAdapterHeaderTableManager.h"
0017 #include "Fireworks/TableWidget/interface/FWColumnLabelCellRenderer.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 FWAdapterHeaderTableManager::FWAdapterHeaderTableManager(const FWTableManagerBase* iTable)
0030 : m_table(iTable),
0031 m_renderer(
0032 new FWColumnLabelCellRenderer(&(FWTextTableCellRenderer::getDefaultGC()), iTable->cellDataIsSortable())),
0033 m_sortedColumn(-1),
0034 m_descendingSort(true) {}
0035
0036
0037
0038
0039
0040
0041 FWAdapterHeaderTableManager::~FWAdapterHeaderTableManager() {}
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 void FWAdapterHeaderTableManager::implSort(int col, bool sortOrder) {
0059 m_sortedColumn = col;
0060 m_descendingSort = sortOrder;
0061 }
0062
0063
0064
0065
0066 int FWAdapterHeaderTableManager::numberOfRows() const { return 1; }
0067
0068 int FWAdapterHeaderTableManager::numberOfColumns() const { return m_table->numberOfColumns(); }
0069
0070 int FWAdapterHeaderTableManager::unsortedRowNumber(int iRow) const { return iRow; }
0071
0072 std::vector<std::string> FWAdapterHeaderTableManager::getTitles() const { return m_table->getTitles(); }
0073
0074 FWTableCellRendererBase* FWAdapterHeaderTableManager::cellRenderer(int , int iCol) const {
0075 if (iCol == m_sortedColumn) {
0076 if (m_descendingSort) {
0077 m_renderer->setSortOrder(fireworks::table::kDescendingSort);
0078 } else {
0079 m_renderer->setSortOrder(fireworks::table::kAscendingSort);
0080 }
0081 } else {
0082 m_renderer->setSortOrder(fireworks::table::kNotSorted);
0083 }
0084 if (iCol < m_table->numberOfColumns()) {
0085 m_renderer->setData(*(getTitles().begin() + iCol), false);
0086 } else {
0087 m_renderer->setData("", false);
0088 }
0089 return m_renderer;
0090 }
0091
0092
0093
0094