CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Fireworks/TableWidget/src/FWTableManagerBase.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     TableWidget
00004 // Class  :     FWTableManagerBase
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Mon Feb  2 16:40:44 EST 2009
00011 // $Id: FWTableManagerBase.cc,v 1.6 2011/03/09 14:20:45 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
00018 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
00019 
00020 
00021 //
00022 // constants, enums and typedefs
00023 //
00024 
00025 //
00026 // static data member definitions
00027 //
00028 
00029 //
00030 // constructors and destructor
00031 //
00032 FWTableManagerBase::FWTableManagerBase():
00033 m_sortColumn(-1),
00034 m_sortOrder(false)
00035 {
00036 }
00037 
00038 // FWTableManagerBase::FWTableManagerBase(const FWTableManagerBase& rhs)
00039 // {
00040 //    // do actual copying here;
00041 // }
00042 
00043 FWTableManagerBase::~FWTableManagerBase()
00044 {
00045 }
00046 
00047 //
00048 // assignment operators
00049 //
00050 // const FWTableManagerBase& FWTableManagerBase::operator=(const FWTableManagerBase& rhs)
00051 // {
00052 //   //An exception safe implementation is
00053 //   FWTableManagerBase temp(rhs);
00054 //   swap(rhs);
00055 //
00056 //   return *this;
00057 // }
00058 
00059 //
00060 // member functions
00061 //
00062 void 
00063 FWTableManagerBase::sort(int col, bool sortOrder)
00064 {
00065    if(col <= numberOfColumns()) {
00066       m_sortColumn = col;
00067       m_sortOrder = sortOrder;
00068       implSort(col,sortOrder);
00069       visualPropertiesChanged();
00070    }
00071 }
00072 
00073 void FWTableManagerBase::dataChanged()
00074 {
00075    if(-1 != m_sortColumn) {
00076       implSort(m_sortColumn,m_sortOrder);
00077    }
00078    Emit("dataChanged()");
00079 }
00080       
00081 void FWTableManagerBase::visualPropertiesChanged()
00082 {
00083    Emit("visualPropertiesChanged()");
00084 }
00085 
00086 //
00087 // const member functions
00088 //
00089 unsigned int FWTableManagerBase::cellHeight() const
00090 {
00091    FWTableCellRendererBase* cr = cellRenderer(0,0);
00092    if(cr) {
00093       return cr->height();
00094    }
00095    if(hasRowHeaders()) {
00096       cr = rowHeader(0);
00097       if(cr) {
00098          return cr->height();
00099       }
00100    }
00101    return 0;
00102 }
00103       
00104 std::vector<unsigned int> FWTableManagerBase::maxWidthForColumns() const
00105 {
00106    std::vector<unsigned int> returnValue;
00107    returnValue.reserve(numberOfColumns());
00108    const int numCols= numberOfColumns();
00109    const int numRows = numberOfRows();
00110    for(int col = 0; col < numCols; ++col) {
00111       unsigned int max = 0;
00112       for(int row=0; row < numRows; ++row) {
00113          unsigned int width = cellRenderer(row,col)->width();
00114          if(width > max) {
00115             max = width;
00116          }
00117       }
00118       returnValue.push_back(max);
00119    }
00120    return returnValue;
00121 }
00122 
00123 bool FWTableManagerBase::hasLabelHeaders() const
00124 {
00125    return true;
00126 }
00127 
00128 bool FWTableManagerBase::hasRowHeaders() const
00129 {
00130    return false;
00131 }
00132 FWTableCellRendererBase* FWTableManagerBase::rowHeader(int iRow) const
00133 {
00134    return 0;
00135 }
00136 
00137 void 
00138 FWTableManagerBase::buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY)
00139 {
00140 }
00141 void 
00142 FWTableManagerBase::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY)
00143 {
00144 }
00145 
00146 //
00147 // static member functions
00148 //
00149 ClassImp(FWTableManagerBase)