CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FWTextTableCellRenderer Class Reference

#include <Fireworks/TableWidget/interface/FWTextTableCellRenderer.h>

Inheritance diagram for FWTextTableCellRenderer:
FWTableCellRendererBase FWCheckedTextTableCellRenderer FWCollectionSummaryModelCellRenderer FWColumnLabelCellRenderer FWTextTreeCellRenderer

Public Types

enum  Justify { kJustifyLeft, kJustifyRight, kJustifyCenter }
 

Public Member Functions

const std::string & data ()
 
void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
 
const TGFont * font () const
 
 FWTextTableCellRenderer (const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
 
const TGGC * graphicsContext () const
 
UInt_t height () const override
 returns the minimum height of the cell to which the renderer is representing More...
 
const TGGC * highlightContext () const
 
bool selected ()
 
void setData (const std::string &, bool isSelected)
 
void setData (const char *, bool isSelected)
 
void setGraphicsContext (const TGGC *iContext)
 
void setHighlightContext (const TGGC *context)
 
void setJustify (Justify)
 
UInt_t width () const override
 returns the minimum width of the cell to which the renderer is representing More...
 
 ~FWTextTableCellRenderer () override
 
- Public Member Functions inherited from FWTableCellRendererBase
virtual void buttonEvent (Event_t *iClickEvent, int iRelClickX, int iRelClickY)
 
 FWTableCellRendererBase ()
 
virtual ~FWTableCellRendererBase ()
 

Static Public Member Functions

static const TGGC & getDefaultGC ()
 
static const TGGC & getDefaultHighlightGC ()
 

Private Member Functions

 FWTextTableCellRenderer (const FWTextTableCellRenderer &)=delete
 
const FWTextTableCellRendereroperator= (const FWTextTableCellRenderer &)=delete
 

Private Attributes

const TGGC * m_context
 
std::string m_data
 
TGFont * m_font
 
const TGGC * m_highlightContext
 
bool m_isSelected
 
Justify m_justify
 

Detailed Description

Description: A Cell Renderer who draws text and can show selection of a cell

Usage: Use when the cells of a table are simple text and you want to be able to also show that a cell has been selected.

Definition at line 32 of file FWTextTableCellRenderer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FWTextTableCellRenderer::FWTextTableCellRenderer ( const TGGC *  iContext = &(getDefaultGC()),
const TGGC *  iHighlightContext = &(getDefaultHighlightGC()),
Justify  iJustify = kJustifyLeft 
)

Definition at line 35 of file FWTextTableCellRenderer.cc.

References m_context, and m_font.

Referenced by selected().

35  :
36  m_context(iContext),
37  m_highlightContext(iHighlightContext),
38  m_font(nullptr),
39  m_isSelected(false),
40  m_justify(iJustify)
41 {
42  //TGGC* tggc= gClient->GetGCPool()->GetGC(iContext);
43  m_font = gClient->GetFontPool()->FindFontByHandle(m_context->GetFont());
44 }
FWTextTableCellRenderer::~FWTextTableCellRenderer ( )
override

Definition at line 51 of file FWTextTableCellRenderer.cc.

52 {
53 }
FWTextTableCellRenderer::FWTextTableCellRenderer ( const FWTextTableCellRenderer )
privatedelete

Member Function Documentation

const std::string& FWTextTableCellRenderer::data ( )
inline
void FWTextTableCellRenderer::draw ( Drawable_t  iID,
int  iX,
int  iY,
unsigned int  iWidth,
unsigned int  iHeight 
)
overridevirtual

Called to draw a particular cell: arguments iID: the id for the drawable in the window. Needed in order to do calls to gVirtualX or to TGFont iX: screen x position that the cell drawing area starts iY: screen y position that the cell drawing area starts iWidth: width (x dimension) of cell drawing area. May be larger than value returned from width() iHeight: height (x dimension) of cell drawing area. May be larger than value returned from height()

Implements FWTableCellRendererBase.

Reimplemented in FWTextTreeCellRenderer.

Definition at line 71 of file FWTextTableCellRenderer.cc.

References EnergyCorrector::c, kJustifyCenter, kJustifyRight, FWTabularWidget::kTextBuffer, m_context, m_data, m_font, m_highlightContext, m_isSelected, m_justify, w, and width().

Referenced by FWCheckedTextTableCellRenderer::draw(), FWColumnLabelCellRenderer::draw(), FWCollectionSummaryModelCellRenderer::draw(), Vispa.Gui.PortConnection.PointToPointConnection::paintEvent(), and selected().

72 {
73 
74  if(m_isSelected) {
75  GContext_t c = m_highlightContext->GetGC();
76  gVirtualX->FillRectangle(iID, c, iX - FWTabularWidget::kTextBuffer, iY - FWTabularWidget::kTextBuffer,
78  /*
79  gVirtualX->DrawLine(iID,m_context->GetGC(),iX-1,iY-1,iX-1,iY+iHeight);
80  gVirtualX->DrawLine(iID,m_context->GetGC(),iX+iWidth,iY-1,iX+iWidth,iY+iHeight);
81  gVirtualX->DrawLine(iID,m_context->GetGC(),iX-1,iY-1,iX+iWidth,iY-1);
82  gVirtualX->DrawLine(iID,m_context->GetGC(),iX-1,iY+iHeight,iX+iWidth,iY+iHeight);*
83  */
84  }
85 
86 
87 
88  FontMetrics_t metrics;
89  m_font->GetFontMetrics(&metrics);
90  int dX=0;
92  int w = width();
93  dX = iWidth-w;
94  }
96  int w = width();
97  dX = (iWidth-w)/2;
98 
99  }
100 
101  gVirtualX->DrawString(iID,m_context->GetGC(),iX+dX,iY+metrics.fAscent +1, m_data.c_str(),m_data.size());
102 }
const double w
Definition: UKUtility.cc:23
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
static const int kTextBuffer
const TGFont * FWTextTableCellRenderer::font ( ) const
const TGGC & FWTextTableCellRenderer::getDefaultGC ( )
static

Definition at line 149 of file FWTextTableCellRenderer.cc.

Referenced by FWPSetTableManager::cellRenderer(), and FWTextTreeCellRenderer::draw().

150 {
151  static const TGGC* s_default = gClient->GetResourcePool()->GetFrameGC();
152  return *s_default;
153 }
const TGGC & FWTextTableCellRenderer::getDefaultHighlightGC ( )
static

Definition at line 156 of file FWTextTableCellRenderer.cc.

Referenced by FWPSetTableManager::FWPSetTableManager().

157 {
158  // Return graphics context for highlighted frame background.
159  static const TGGC* s_default = nullptr;
160  if (!s_default) {
161  GCValues_t gval;
162  gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
163  gval.fForeground = gVirtualX->GetPixel(kGray);//gClient->GetResourcePool()->GetFrameHiliteColor();
164  gval.fBackground = gVirtualX->GetPixel(kWhite);//gClient->GetResourcePool()->GetFrameBgndColor();
165  gval.fFillStyle = kFillOpaqueStippled; // kFillTiled;
166  gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
167  gval.fGraphicsExposures = kFALSE;
168  s_default = gClient->GetGC(&gval, kTRUE);
169  }
170  return *s_default;
171 }
const TGGC* FWTextTableCellRenderer::graphicsContext ( ) const
inline
UInt_t FWTextTableCellRenderer::height ( ) const
overridevirtual
const TGGC* FWTextTableCellRenderer::highlightContext ( ) const
inline
const FWTextTableCellRenderer& FWTextTableCellRenderer::operator= ( const FWTextTableCellRenderer )
privatedelete

Referenced by selected().

bool FWTextTableCellRenderer::selected ( )
inline
void FWTextTableCellRenderer::setData ( const std::string &  iData,
bool  isSelected 
)
void FWTextTableCellRenderer::setData ( const char *  iData,
bool  isSelected 
)

Definition at line 111 of file FWTextTableCellRenderer.cc.

References m_data, and m_isSelected.

111  {
112  m_data = iData;
113  m_isSelected=iIsSelected;
114 }
void FWTextTableCellRenderer::setGraphicsContext ( const TGGC *  iContext)
inline
void FWTextTableCellRenderer::setHighlightContext ( const TGGC *  context)
inline
void FWTextTableCellRenderer::setJustify ( Justify  iJustify)

Definition at line 117 of file FWTextTableCellRenderer.cc.

References m_justify.

Referenced by setHighlightContext().

118 {
119  m_justify=iJustify;
120 }
UInt_t FWTextTableCellRenderer::width ( ) const
overridevirtual

returns the minimum width of the cell to which the renderer is representing

Implements FWTableCellRendererBase.

Reimplemented in FWTextTreeCellRenderer.

Definition at line 126 of file FWTextTableCellRenderer.cc.

References m_data, and m_font.

Referenced by Vispa.Main.MainWindow.MainWindow::_saveIni(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Gui.VispaWidget.VispaWidget::boundingRect(), Vispa.Gui.VispaWidget.VispaWidget::contentRect(), Vispa.Gui.VispaWidget.VispaWidget::defineArrowBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineCircleBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineRoundRectBackgroundShape(), draw(), Vispa.Gui.VispaWidget.VispaWidget::drawHeaderBackground(), Vispa.Gui.ConnectableWidget.ConnectableWidget::drawPortNames(), highlightContext(), Vispa.Gui.VispaWidget.VispaWidget::imageRectF(), Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget(), Vispa.Views.PropertyView.PropertyView::resizeEvent(), Vispa.Views.PropertyView.PropertyView::sectionResized(), Vispa.Gui.VispaWidget.VispaWidget::setZoom(), Vispa.Main.MainWindow.MainWindow::updateStartupScreenGeometry(), FWCheckedTextTableCellRenderer::width(), FWColumnLabelCellRenderer::width(), FWCollectionSummaryModelCellRenderer::width(), and FWTextTreeCellRenderer::width().

127 {
128  if(!m_data.empty()) {
129  return m_font->TextWidth(m_data.c_str(),-1);// + 2*kTextBuffer;
130  }
131  return 0;
132 }

Member Data Documentation

const TGGC* FWTextTableCellRenderer::m_context
private
std::string FWTextTableCellRenderer::m_data
private

Definition at line 79 of file FWTextTableCellRenderer.h.

Referenced by data(), draw(), setData(), and width().

TGFont* FWTextTableCellRenderer::m_font
private

Definition at line 78 of file FWTextTableCellRenderer.h.

Referenced by draw(), font(), FWTextTableCellRenderer(), height(), and width().

const TGGC* FWTextTableCellRenderer::m_highlightContext
private

Definition at line 77 of file FWTextTableCellRenderer.h.

Referenced by draw(), highlightContext(), and setHighlightContext().

bool FWTextTableCellRenderer::m_isSelected
private

Definition at line 80 of file FWTextTableCellRenderer.h.

Referenced by draw(), selected(), and setData().

Justify FWTextTableCellRenderer::m_justify
private

Definition at line 81 of file FWTextTableCellRenderer.h.

Referenced by draw(), and setJustify().