FWTableViewTableManager

Macros

Line Code
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 119 120 121 122
// -*- C++ -*-
#ifndef Fireworks_Core_FWTableViewTableManager_h
#define Fireworks_Core_FWTableViewTableManager_h
//
// Package:     Core
// Class  :     FWTableViewTableManager
//
/**\class FWTableViewTableManager FWTableViewTableManager.h Fireworks/Core/interface/FWTableViewTableManager.h

*/
//
// Original Author:
//         Created:  Mon Feb  2 16:40:52 EST 2009
//

// system include files
#include <vector>
#include <string>
#include "TQObject.h"
#include "GuiTypes.h"

// user include files
#include "Fireworks/TableWidget/interface/FWTableManagerBase.h"
#include "Fireworks/TableWidget/interface/FWTextTableCellRenderer.h"
#include "Fireworks/Core/interface/FWTableViewManager.h"
#include "Fireworks/Core/interface/FWExpressionEvaluator.h"

// forward declarations
class FWTableView;
class FWFramedTextTableCellRenderer;

class FWTableViewTableManager : public FWTableManagerBase {
  friend class FWTableView;

public:
  FWTableViewTableManager(const FWTableView *);
  ~FWTableViewTableManager() override;

  // ---------- const member functions ---------------------
  ///Number of rows in the table
  int numberOfRows() const override;
  ///Number of columns in the table
  int numberOfColumns() const override;

  ///returns the title names for each column
  std::vector<std::string> getTitles() const override;

  ///when passed the index to the sorted order of the rows it
  ///returns the original row number from the underlying data
  int unsortedRowNumber(int iSortedRowNumber) const override;

  /** Returns the particular renderer used to handle the requested
	 cell.  Arguments: iSortedRowNumber: the row number from the
	 present sort (i.e. the cell number of the view) iCol: the column
	 number of the cell.  The returned value must be used immediately
	 and not held onto since the same Renderer can be used for
	 subsequent calls
     */
  FWTableCellRendererBase *cellRenderer(int iSortedRowNumber, int iCol) const override;

  ///require all cells to be the same height
  // virtual unsigned int cellHeight() const;

  ///for each column in the table this returns the present maximum width for that column
  // virtual std::vector<unsigned int> maxWidthForColumns() const;

  ///Returns 'true' if this table has row headers. Defaults return value is false.
  bool hasRowHeaders() const override;
  ///Returns the renderer for the row header for the sorted row number iSortedRowNumber
  FWTableCellRendererBase *rowHeader(int iSortedRowNumber) const override;

  ///Called if mouse button pressed in Row Header, defaults is to do nothing
  //virtual void buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY);
  //virtual void buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY);

  // ---------- static member functions --------------------

  // ---------- member functions ---------------------------
  ///Call to have table sorted on values in column iCol with the
  ///sort order being descending if iSortOrder is 'true'
  // void sort(int iCol, bool iSortOrder);

  ///Classes which inherit from FWTableViewTableManager must call
  ///this when their underlying data changes
  void dataChanged();  //*SIGNAL*

  ///Classes which inherit from FWTableViewTableManager must call
  ///this when how the data is shown (e.g. color) changes
  // void visualPropertiesChanged(); //*SIGNAL*

  // ClassDef(FWTableViewTableManager,0);
  void updateEvaluators();

protected:
  ///Called by 'sort' method to actually handle the sorting of the
  ///rows. Arguments are the same as 'sort'
  void implSort(int iCol, bool iSortOrder) override;
  std::vector<int> m_sortedToUnsortedIndices;

  const FWTableView *m_view;
  TGGC *m_graphicsContext;
  TGGC *m_highlightContext;
  FWTextTableCellRenderer *m_renderer;

  TGGC *m_rowContext;
  TGGC *m_rowFillContext;
  FWFramedTextTableCellRenderer *m_rowRenderer;

  std::vector<FWExpressionEvaluator> m_evaluators;
  std::vector<FWTableViewManager::TableEntry> *m_tableFormats;

  // ---------- member data --------------------------------
  // int m_sortColumn;
  // bool m_sortOrder;
  mutable bool m_caughtExceptionInCellRender;

public:
  FWTableViewTableManager(const FWTableViewTableManager &) = delete;                   // stop default
  const FWTableViewTableManager &operator=(const FWTableViewTableManager &) = delete;  // stop default
};

#endif