Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:09:59

0001 // -*- C++ -*-
0002 #ifndef Fireworks_Core_FWTableViewTableManager_h
0003 #define Fireworks_Core_FWTableViewTableManager_h
0004 //
0005 // Package:     Core
0006 // Class  :     FWTableViewTableManager
0007 //
0008 /**\class FWTableViewTableManager FWTableViewTableManager.h Fireworks/Core/interface/FWTableViewTableManager.h
0009 
0010 */
0011 //
0012 // Original Author:
0013 //         Created:  Mon Feb  2 16:40:52 EST 2009
0014 //
0015 
0016 // system include files
0017 #include <vector>
0018 #include <string>
0019 #include "TQObject.h"
0020 #include "GuiTypes.h"
0021 
0022 // user include files
0023 #include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
0024 #include "Fireworks/TableWidget/interface/FWTextTableCellRenderer.h"
0025 #include "Fireworks/Core/interface/FWTableViewManager.h"
0026 #include "Fireworks/Core/interface/FWExpressionEvaluator.h"
0027 
0028 // forward declarations
0029 class FWTableView;
0030 class FWFramedTextTableCellRenderer;
0031 
0032 class FWTableViewTableManager : public FWTableManagerBase {
0033   friend class FWTableView;
0034 
0035 public:
0036   FWTableViewTableManager(const FWTableView *);
0037   ~FWTableViewTableManager() override;
0038 
0039   // ---------- const member functions ---------------------
0040   ///Number of rows in the table
0041   int numberOfRows() const override;
0042   ///Number of columns in the table
0043   int numberOfColumns() const override;
0044 
0045   ///returns the title names for each column
0046   std::vector<std::string> getTitles() const override;
0047 
0048   ///when passed the index to the sorted order of the rows it
0049   ///returns the original row number from the underlying data
0050   int unsortedRowNumber(int iSortedRowNumber) const override;
0051 
0052   /** Returns the particular renderer used to handle the requested
0053      cell.  Arguments: iSortedRowNumber: the row number from the
0054      present sort (i.e. the cell number of the view) iCol: the column
0055      number of the cell.  The returned value must be used immediately
0056      and not held onto since the same Renderer can be used for
0057      subsequent calls
0058      */
0059   FWTableCellRendererBase *cellRenderer(int iSortedRowNumber, int iCol) const override;
0060 
0061   ///require all cells to be the same height
0062   // virtual unsigned int cellHeight() const;
0063 
0064   ///for each column in the table this returns the present maximum width for that column
0065   // virtual std::vector<unsigned int> maxWidthForColumns() const;
0066 
0067   ///Returns 'true' if this table has row headers. Defaults return value is false.
0068   bool hasRowHeaders() const override;
0069   ///Returns the renderer for the row header for the sorted row number iSortedRowNumber
0070   FWTableCellRendererBase *rowHeader(int iSortedRowNumber) const override;
0071 
0072   ///Called if mouse button pressed in Row Header, defaults is to do nothing
0073   //virtual void buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY);
0074   //virtual void buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY);
0075 
0076   // ---------- static member functions --------------------
0077 
0078   // ---------- member functions ---------------------------
0079   ///Call to have table sorted on values in column iCol with the
0080   ///sort order being descending if iSortOrder is 'true'
0081   // void sort(int iCol, bool iSortOrder);
0082 
0083   ///Classes which inherit from FWTableViewTableManager must call
0084   ///this when their underlying data changes
0085   void dataChanged();  //*SIGNAL*
0086 
0087   ///Classes which inherit from FWTableViewTableManager must call
0088   ///this when how the data is shown (e.g. color) changes
0089   // void visualPropertiesChanged(); //*SIGNAL*
0090 
0091   // ClassDef(FWTableViewTableManager,0);
0092   void updateEvaluators();
0093 
0094 protected:
0095   ///Called by 'sort' method to actually handle the sorting of the
0096   ///rows. Arguments are the same as 'sort'
0097   void implSort(int iCol, bool iSortOrder) override;
0098   std::vector<int> m_sortedToUnsortedIndices;
0099 
0100   const FWTableView *m_view;
0101   TGGC *m_graphicsContext;
0102   TGGC *m_highlightContext;
0103   FWTextTableCellRenderer *m_renderer;
0104 
0105   TGGC *m_rowContext;
0106   TGGC *m_rowFillContext;
0107   FWFramedTextTableCellRenderer *m_rowRenderer;
0108 
0109   std::vector<FWExpressionEvaluator> m_evaluators;
0110   std::vector<FWTableViewManager::TableEntry> *m_tableFormats;
0111 
0112   // ---------- member data --------------------------------
0113   // int m_sortColumn;
0114   // bool m_sortOrder;
0115   mutable bool m_caughtExceptionInCellRender;
0116 
0117 public:
0118   FWTableViewTableManager(const FWTableViewTableManager &) = delete;                   // stop default
0119   const FWTableViewTableManager &operator=(const FWTableViewTableManager &) = delete;  // stop default
0120 };
0121 
0122 #endif