Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:01:44

0001 #ifndef Fireworks_TableWidget_FWTableCellRendererBase_h
0002 #define Fireworks_TableWidget_FWTableCellRendererBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     TableWidget
0006 // Class  :     FWTableCellRendererBase
0007 //
0008 /**\class FWTableCellRendererBase FWTableCellRendererBase.h Fireworks/TableWidget/interface/FWTableCellRendererBase.h
0009 
0010  Description: base class for classes which handle drawing and interaction with cells in the table
0011 
0012  Usage:
0013     Renderers do the actual drawing of data into the cell (via the 'draw' method) and can allow user interaction with a cell
0014     (via the 'buttonEvent' method).  When drawing a cell in the table, FWTableWidget ask its held FWTableManagerBase for a 
0015     FWTableCellRendererBase for that particular cell and then calls the 'draw' method. Similarly, when a mouse button is pressed
0016     while the cursor is in a particular cell, the FWTableWidget asks its held FWTableManagerBase for a FWTableCellRendererBase for that
0017     particular cell and then calls the 'buttonEvent' method.  For efficiency reasons, we encourage the reuse of the same 
0018     FWTableCellRendererBase instance for multiple cells.  The FWTableWidget is written so that it always requests a renderer from the
0019     FWTableManagerBase thereby allowing this reuse to work even when the renderer holds state information particular for only one cell
0020      (e.g. color).
0021      
0022      Classes which inherit from FWTableManagerBase are responsible for creating the appropriate FWTableCellRendererBase for the data
0023      held in the table's cells.  When the FWTableWidget asks the FWTableManagerBase for a renderer for a particular cell, it is the 
0024      FWTableManagerBase's job to reset the renderer so that it can properly draw and/or interact with that cell.  To allow reuse of
0025      the same object, classes which inherit from FWTableCellRendererBase normally have 'setter' methods which are used to set the
0026      renderer so it can represent a particular cell.
0027     
0028     One inherits from FWTableCellRendererBase in order to provide custom ways to view data in the cell or to customize how users
0029     interact with the cell.  Inheritance can also be used to allow a renderer to work directly with data held by a FWTableManagerBase.
0030 
0031 */
0032 //
0033 // Original Author:  Chris Jones
0034 //         Created:  Mon Feb  2 16:40:18 EST 2009
0035 //
0036 
0037 // system include files
0038 #include "GuiTypes.h"
0039 
0040 // user include files
0041 
0042 // forward declarations
0043 
0044 class FWTableCellRendererBase {
0045 public:
0046   FWTableCellRendererBase();
0047   virtual ~FWTableCellRendererBase();
0048 
0049   // ---------- const member functions ---------------------
0050   ///returns the minimum width of the cell to which the renderer is representing
0051   virtual UInt_t width() const = 0;
0052   ///returns the minimum height of the cell to which the renderer is representing
0053   virtual UInt_t height() const = 0;
0054 
0055   /** Called to draw a particular cell: arguments
0056       iID: the id for the drawable in the window. Needed in order to do calls to gVirtualX or to TGFont
0057       iX: screen x position that the cell drawing area starts
0058       iY: screen y position that the cell drawing area starts
0059       iWidth: width (x dimension) of cell drawing area.  May be larger than value returned from width()
0060       iHeight: height (x dimension) of cell drawing area. May be larger than value returned from height()
0061       */
0062   virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) = 0;
0063 
0064   // ---------- member functions ---------------------------
0065   /** Called when a mouse button event occurs when the cursor is over a particular cell: arguments
0066       iClickEvent: the ROOT GUI event caused by the mouse button
0067       iRelClickX: the x position of the cursor click relative to the start of the cell drawing area
0068       iRelClickY: the y position of the cursor click relative to the start of the cell drawing area
0069       */
0070   virtual void buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY);
0071 
0072   FWTableCellRendererBase(const FWTableCellRendererBase&) = delete;  // stop default
0073 
0074   const FWTableCellRendererBase& operator=(const FWTableCellRendererBase&) = delete;  // stop default
0075 
0076   // ---------- member data --------------------------------
0077 };
0078 
0079 #endif