Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Fireworks_TableWidget_FWTableWidget_h
0002 #define Fireworks_TableWidget_FWTableWidget_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     TableWidget
0006 // Class  :     FWTableWidget
0007 //
0008 /**\class FWTableWidget FWTableWidget.h Fireworks/TableWidget/interface/FWTableWidget.h
0009 
0010  Description: ROOT widget for representing data in a tabular form where the data is accessed via a FWTableManagerBase
0011 
0012  Usage:
0013     This widget creates a table made up of cells where the representation of the cells is controlled by the FWTableManagerBase instance
0014     passed to the FWTableWidget's constructor. If the data for the FWTableManagerBase changes, the view is automatically updated. See
0015     the documentation for FWTableManagerBase for further details.
0016 
0017 */
0018 //
0019 // Original Author:  Chris Jones
0020 //         Created:  Mon Feb  2 16:45:47 EST 2009
0021 //
0022 
0023 // system include files
0024 #include "TGFrame.h"
0025 
0026 // user include files
0027 
0028 // forward declarations
0029 class FWTableManagerBase;
0030 class FWTabularWidget;
0031 class TGVScrollBar;
0032 class TGHScrollBar;
0033 class TGGC;
0034 
0035 class FWTableWidget : public TGCompositeFrame {
0036 public:
0037   FWTableWidget(FWTableManagerBase* iManager, const TGWindow* p = nullptr);
0038   ~FWTableWidget() override;
0039 
0040   // ---------- const member functions ---------------------
0041   //the standard method gives the wrong values when using a TGTabularLayout
0042   TGDimension GetDefaultSize() const override;
0043 
0044   // ---------- static member functions --------------------
0045 
0046   // ---------- member functions ---------------------------
0047   using TGFrame::Resize;
0048   void Resize(UInt_t w, UInt_t h) override;
0049   void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0) override;
0050   void SetBackgroundColor(Pixel_t) override;
0051   void SetHeaderBackgroundColor(Pixel_t);
0052   void SetHeaderForegroundColor(Pixel_t);
0053   void SetLineSeparatorColor(Pixel_t);
0054 
0055   Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override;
0056 
0057   /**Sorts the rows of data in the table based on values in column iColumn.
0058       If iDescendingSort is 'true' then the rows are sorted in descending order of the values.
0059    */
0060   void sort(UInt_t iColumn, bool iDescendingSort);
0061 
0062   void buttonReleasedInHeader(Int_t row, Int_t column, Event_t* event, Int_t, Int_t);
0063   void buttonReleasedInBody(Int_t row, Int_t column, Event_t* event, Int_t, Int_t);
0064 
0065   /**This signal is emitted if the mouse button is 'clicked' while the cursor
0066       was over a row. Arguments:
0067       iRow: the unsorted row number (natural ordering) of the row clicked
0068       iButton: the ROOT button value for the click event (e.g. says which button used)
0069       iKeyMod: the ROOT key modifier value for the click event (e.g. says if a keyboard key was being held)
0070       iGlobalX: the X coordinate of the click in global coordinates
0071       iGlobalY: the Y coordinate of the click in global coordinates
0072    */
0073   void rowClicked(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY);  //*SIGNAL*
0074   void cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY);
0075   void columnClicked(Int_t iColumn, Int_t iButton, Int_t iKeyMod);  //*SIGNAL*
0076   void childrenEvent(Event_t*);
0077   void Clicked();
0078 
0079   ClassDefOverride(FWTableWidget, 0);
0080 
0081   void forceLayout() { m_forceLayout = true; }
0082   void dataChanged();
0083 
0084   void buttonPressedInRowHeader(Int_t row, Int_t column, Event_t* event, Int_t relX, Int_t relY);
0085   void buttonReleasedInRowHeader(Int_t row, Int_t column, Event_t* event, Int_t relX, Int_t relY);
0086 
0087   int sortedColumn() const { return m_sortedColumn; }
0088   bool descendingSort() const { return m_descendingSort; }
0089 
0090   FWTabularWidget* body() { return m_body; }
0091 
0092   void disableGrowInWidth();
0093 
0094 protected:
0095   void DoRedraw() override;
0096 
0097 private:
0098   //FWTableWidget(const FWTableWidget&); // stop default
0099 
0100   //const FWTableWidget& operator=(const FWTableWidget&); // stop default
0101 
0102   // ---------- member data --------------------------------
0103   bool handleResize(UInt_t w, UInt_t h);
0104   FWTableManagerBase* m_bodyTable;
0105   FWTableManagerBase* m_headerTable;
0106   FWTableManagerBase* m_rowHeaderTable;
0107   FWTabularWidget* m_header;
0108   FWTabularWidget* m_body;
0109   FWTabularWidget* m_rowHeader;
0110   TGVScrollBar* m_vSlider;
0111   TGHScrollBar* m_hSlider;
0112   bool m_showingVSlider;
0113   bool m_showingHSlider;
0114 
0115   int m_sortedColumn;
0116   bool m_descendingSort;
0117   bool m_forceLayout;
0118 
0119   TGGC* m_headerBackground;
0120   TGGC* m_headerForeground;
0121   TGGC* m_lineSeparator;
0122 };
0123 
0124 #endif