CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Fireworks/TableWidget/interface/FWTextTableCellRenderer.h

Go to the documentation of this file.
00001 #ifndef Fireworks_TableWidget_FWTextTableCellRenderer_h
00002 #define Fireworks_TableWidget_FWTextTableCellRenderer_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     TableWidget
00006 // Class  :     FWTextTableCellRenderer
00007 // 
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Mon Feb  2 16:43:50 EST 2009
00019 // $Id: FWTextTableCellRenderer.h,v 1.6 2011/03/02 18:34:17 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 #include <string>
00024 #include "GuiTypes.h"
00025 #include "TGResourcePool.h"
00026 #include "TGGC.h"
00027 
00028 // user include files
00029 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
00030 
00031 // forward declarations
00032 
00033 class FWTextTableCellRenderer : public FWTableCellRendererBase {
00034    
00035 public:
00036    static const TGGC&  getDefaultGC();
00037    static const TGGC&  getDefaultHighlightGC();  
00038    
00039    enum Justify {
00040       kJustifyLeft,
00041       kJustifyRight,
00042       kJustifyCenter
00043    };
00044    
00045    FWTextTableCellRenderer(const TGGC* iContext=&(getDefaultGC()), 
00046                            const TGGC* iHighlightContext=&(getDefaultHighlightGC()),
00047                            Justify iJustify=kJustifyLeft);
00048    virtual ~FWTextTableCellRenderer();
00049    
00050    // ---------- const member functions ---------------------
00051    const TGGC* graphicsContext() const { return m_context; }
00052    const TGGC* highlightContext() const { return m_highlightContext; }
00053    virtual UInt_t width() const;
00054    virtual UInt_t height() const;
00055    
00056    const TGFont* font() const;
00057    // ---------- static member functions --------------------
00058    
00059    // ---------- member functions ---------------------------
00060    void setData(const std::string&, bool isSelected);
00061    void setData(const char*, bool isSelected);
00062    const std::string &data() { return m_data; }
00063    void setGraphicsContext(const TGGC* iContext) { m_context = iContext;}
00064    void setHighlightContext(const TGGC* context) { m_highlightContext = context; }
00065    void setJustify(Justify);
00066    bool selected() { return m_isSelected; }
00067    
00068    virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight);
00069    
00070    
00071 private:
00072    FWTextTableCellRenderer(const FWTextTableCellRenderer&); // stop default
00073    
00074    const FWTextTableCellRenderer& operator=(const FWTextTableCellRenderer&); // stop default
00075    
00076    // ---------- member data --------------------------------
00077    const TGGC* m_context;
00078    const TGGC* m_highlightContext;
00079    TGFont* m_font;
00080    std::string m_data;
00081    bool m_isSelected;
00082    Justify m_justify;
00083 };
00084 
00085 
00086 #endif