|
||||
File indexing completed on 2024-04-06 12:11:52
0001 #ifndef Fireworks_TableWidget_FWTableManagerBase_h 0002 #define Fireworks_TableWidget_FWTableManagerBase_h 0003 // -*- C++ -*- 0004 // 0005 // Package: TableWidget 0006 // Class : FWTableManagerBase 0007 // 0008 /**\class FWTableManagerBase FWTableManagerBase.h Fireworks/TableWidget/interface/FWTableManagerBase.h 0009 0010 Description: Base class for classes that work as interfaces that translate underlying data into a table form 0011 0012 Usage: 0013 Classes which inherit from FWTableManagerBase are used as adapters to allow external data to be shown in tabular form 0014 via the FWTableWidget. The table is made of three parts 0015 1) The column headers: Each column is described by a 'title' and the title is drawn in the column header 0016 2) The body: the actual data of the table laid out in rows and columns 0017 3) the row headers: optional identifier for a row. If given, the row header will always be visible on the screen if any part 0018 of the row is visible 0019 0020 The FWTableWidget actually draws the cells in the table by asking the FWTableManagerBase for a FWTableCellRendererBase for 0021 a particular cell. The renderer will then be asked to draw the cell into the appropriate part of the graphics window. Therfore 0022 it is the FWTableManagerBase's responsibility to create FWTableCellRendererBases which are appropriate for the data to be 0023 shown in each cell of the table. See the documentation of FWTableCellRendererBase for further information. 0024 0025 FWTableManagerBase must also be able to sort the rows of data based on the values in a specified column. 0026 0027 */ 0028 // 0029 // Original Author: Chris Jones 0030 // Created: Mon Feb 2 16:40:52 EST 2009 0031 // 0032 0033 // system include files 0034 #include <vector> 0035 #include <string> 0036 #include "TQObject.h" 0037 #include "GuiTypes.h" 0038 0039 // user include files 0040 0041 // forward declarations 0042 class FWTableCellRendererBase; 0043 0044 class FWTableManagerBase : public TQObject { 0045 public: 0046 FWTableManagerBase(); 0047 ~FWTableManagerBase() override; 0048 0049 // ---------- const member functions --------------------- 0050 ///Number of rows in the table 0051 virtual int numberOfRows() const = 0; 0052 ///Number of columns in the table 0053 virtual int numberOfColumns() const = 0; 0054 0055 ///returns the title names for each column 0056 virtual std::vector<std::string> getTitles() const = 0; 0057 0058 ///when passed the index to the sorted order of the rows it returns the original row number from the underlying data 0059 virtual int unsortedRowNumber(int iSortedRowNumber) const = 0; 0060 0061 /** Returns the particular renderer used to handle the requested cell. Arguments: 0062 iSortedRowNumber: the row number from the present sort (i.e. the cell number of the view) 0063 iCol: the column number of the cell. 0064 The returned value must be used immediately and not held onto since the same Renderer can be used for subsequent calls 0065 */ 0066 virtual FWTableCellRendererBase* cellRenderer(int iSortedRowNumber, int iCol) const = 0; 0067 0068 ///require all cells to be the same height 0069 virtual unsigned int cellHeight() const; 0070 0071 ///for each column in the table this returns the present maximum width for that column 0072 virtual std::vector<unsigned int> maxWidthForColumns() const; 0073 0074 virtual bool hasLabelHeaders() const; 0075 0076 ///Returns 'true' if this table has row headers. Defaults return value is false. 0077 virtual bool hasRowHeaders() const; 0078 ///Returns the renderer for the row header for the sorted row number iSortedRowNumber 0079 virtual FWTableCellRendererBase* rowHeader(int iSortedRowNumber) const; 0080 0081 virtual bool cellDataIsSortable() const { return true; } 0082 0083 ///Called if mouse button pressed in Row Header, defaults is to do nothing 0084 virtual void buttonPressedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY); 0085 virtual void buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY); 0086 0087 // ---------- static member functions -------------------- 0088 0089 // ---------- member functions --------------------------- 0090 ///Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true' 0091 void sort(int iCol, bool iSortOrder); 0092 0093 ///Classes which inherit from FWTableManagerBase must call this when their underlying data changes 0094 void dataChanged(); //*SIGNAL* 0095 0096 ///Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes 0097 void visualPropertiesChanged(); //*SIGNAL* 0098 0099 ClassDefOverride(FWTableManagerBase, 0); 0100 0101 /// The current sort order for the table. 0102 bool sortOrder(void) { return m_sortOrder; } 0103 0104 /// The current sort column 0105 int sortColumn(void) { return m_sortColumn; } 0106 0107 protected: 0108 ///Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort' 0109 virtual void implSort(int iCol, bool iSortOrder) = 0; 0110 0111 private: 0112 //FWTableManagerBase(const FWTableManagerBase&); // stop default 0113 0114 //const FWTableManagerBase& operator=(const FWTableManagerBase&); // stop default 0115 0116 // ---------- member data -------------------------------- 0117 int m_sortColumn; 0118 bool m_sortOrder; 0119 }; 0120 0121 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |