Go to the documentation of this file.00001 #ifndef Fireworks_TableWidget_FWTextTableCellRenderer_h
00002 #define Fireworks_TableWidget_FWTextTableCellRenderer_h
00003
00004
00005
00006
00007
00016
00017
00018
00019
00020
00021
00022
00023 #include <string>
00024 #include "GuiTypes.h"
00025 #include "TGResourcePool.h"
00026 #include "TGGC.h"
00027
00028
00029 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
00030
00031
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
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
00058
00059
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&);
00073
00074 const FWTextTableCellRenderer& operator=(const FWTextTableCellRenderer&);
00075
00076
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