File indexing completed on 2024-04-06 12:11:52
0001 #ifndef Fireworks_TableWidget_FWTextTableCellRenderer_h
0002 #define Fireworks_TableWidget_FWTextTableCellRenderer_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <string>
0023 #include "GuiTypes.h"
0024 #include "TGResourcePool.h"
0025 #include "TGGC.h"
0026
0027
0028 #include "Fireworks/TableWidget/interface/FWTableCellRendererBase.h"
0029
0030
0031
0032 class FWTextTableCellRenderer : public FWTableCellRendererBase {
0033 public:
0034 static const TGGC& getDefaultGC();
0035 static const TGGC& getDefaultHighlightGC();
0036
0037 enum Justify { kJustifyLeft, kJustifyRight, kJustifyCenter };
0038
0039 FWTextTableCellRenderer(const TGGC* iContext = &(getDefaultGC()),
0040 const TGGC* iHighlightContext = &(getDefaultHighlightGC()),
0041 Justify iJustify = kJustifyLeft);
0042 ~FWTextTableCellRenderer() override;
0043
0044
0045 const TGGC* graphicsContext() const { return m_context; }
0046 const TGGC* highlightContext() const { return m_highlightContext; }
0047 UInt_t width() const override;
0048 UInt_t height() const override;
0049
0050 const TGFont* font() const;
0051
0052
0053
0054 void setData(const std::string&, bool isSelected);
0055 void setData(const char*, bool isSelected);
0056 const std::string& data() { return m_data; }
0057 void setGraphicsContext(const TGGC* iContext) { m_context = iContext; }
0058 void setHighlightContext(const TGGC* context) { m_highlightContext = context; }
0059 void setJustify(Justify);
0060 bool selected() { return m_isSelected; }
0061
0062 void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override;
0063
0064 FWTextTableCellRenderer(const FWTextTableCellRenderer&) = delete;
0065
0066 const FWTextTableCellRenderer& operator=(const FWTextTableCellRenderer&) = delete;
0067
0068 private:
0069
0070 const TGGC* m_context;
0071 const TGGC* m_highlightContext;
0072 TGFont* m_font;
0073 std::string m_data;
0074 bool m_isSelected;
0075 Justify m_justify;
0076 };
0077
0078 #endif