Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:33

0001 // -*- C++ -*-
0002 //
0003 // Package:     TableWidget
0004 // Class  :     FWTableManagerBase
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Mon Feb  2 16:40:44 EST 2009
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
0017 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
0018 
0019 //
0020 // constants, enums and typedefs
0021 //
0022 
0023 //
0024 // static data member definitions
0025 //
0026 
0027 //
0028 // constructors and destructor
0029 //
0030 FWTableManagerBase::FWTableManagerBase() : m_sortColumn(-1), m_sortOrder(false) {}
0031 
0032 // FWTableManagerBase::FWTableManagerBase(const FWTableManagerBase& rhs)
0033 // {
0034 //    // do actual copying here;
0035 // }
0036 
0037 FWTableManagerBase::~FWTableManagerBase() {}
0038 
0039 //
0040 // assignment operators
0041 //
0042 // const FWTableManagerBase& FWTableManagerBase::operator=(const FWTableManagerBase& rhs)
0043 // {
0044 //   //An exception safe implementation is
0045 //   FWTableManagerBase temp(rhs);
0046 //   swap(rhs);
0047 //
0048 //   return *this;
0049 // }
0050 
0051 //
0052 // member functions
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 // const member functions
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 // static member functions
0117 //
0118 ClassImp(FWTableManagerBase);