Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:52

0001 #ifndef Fireworks_TableWidget_FWFramedTextTableCellRenderer_h
0002 #define Fireworks_TableWidget_FWFramedTextTableCellRenderer_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     TableWidget
0006 // Class  :     FWFramedTextTableCellRenderer
0007 //
0008 /**\class FWFramedTextTableCellRenderer FWFramedTextTableCellRenderer.h Fireworks/TableWidget/interface/FWFramedTextTableCellRenderer.h
0009 
0010  Description: A Cell Renderer who draws text with an outline and fills in the background
0011 
0012  Usage:
0013     The background color of the text graphics context will be used to draw an outline around the regular text
0014  and the color of the regular text is set by the foreground color of the text graphics context.
0015 
0016 */
0017 //
0018 // Original Author:  Chris Jones
0019 //         Created:  Mon Feb  2 16:43:50 EST 2009
0020 //
0021 
0022 // system include files
0023 #include <string>
0024 #include "GuiTypes.h"
0025 #include "TGResourcePool.h"
0026 #include "TGGC.h"
0027 
0028 // user include files
0029 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
0030 
0031 // forward declarations
0032 
0033 class FWFramedTextTableCellRenderer : public FWTableCellRendererBase {
0034 public:
0035   static const TGGC& getDefaultGC();
0036   static const TGGC& getFillGC();
0037 
0038   enum Justify { kJustifyLeft, kJustifyRight, kJustifyCenter };
0039 
0040   FWFramedTextTableCellRenderer(const TGGC* iTextContext = &(getDefaultGC()),
0041                                 const TGGC* iFillContext = &(getFillGC()),
0042                                 Justify iJustify = kJustifyLeft);
0043   ~FWFramedTextTableCellRenderer() override;
0044 
0045   // ---------- const member functions ---------------------
0046   const TGGC* graphicsContext() const { return m_context; }
0047   UInt_t width() const override;
0048   UInt_t height() const override;
0049 
0050   const TGFont* font() const;
0051   // ---------- static member functions --------------------
0052 
0053   // ---------- member functions ---------------------------
0054   void setData(const std::string&);
0055   void setGraphicsContext(const TGGC* iContext) { m_context = iContext; }
0056   void setJustify(Justify);
0057 
0058   void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override;
0059 
0060   FWFramedTextTableCellRenderer(const FWFramedTextTableCellRenderer&) = delete;  // stop default
0061 
0062   const FWFramedTextTableCellRenderer& operator=(const FWFramedTextTableCellRenderer&) = delete;  // stop default
0063 
0064 private:
0065   // ---------- member data --------------------------------
0066   const TGGC* m_context;
0067   const TGGC* m_frameContext;
0068   TGFont* m_font;
0069   std::string m_data;
0070   Justify m_justify;
0071 };
0072 
0073 #endif