CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
 
const TGFont * font () const
 
 FWTextTableCellRenderer (const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
 
const TGGC * graphicsContext () const
 
virtual UInt_t height () const
 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)
 
virtual UInt_t width () const
 returns the minimum width of the cell to which the renderer is representing More...
 
virtual ~FWTextTableCellRenderer ()
 
- 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 &)
 
const FWTextTableCellRendereroperator= (const FWTextTableCellRenderer &)
 

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 33 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 36 of file FWTextTableCellRenderer.cc.

References m_context, and m_font.

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

Definition at line 52 of file FWTextTableCellRenderer.cc.

53 {
54 }
FWTextTableCellRenderer::FWTextTableCellRenderer ( const FWTextTableCellRenderer )
private

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 
)
virtual
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, FWCollectionSummaryModelCellRenderer, FWColumnLabelCellRenderer, and FWCheckedTextTableCellRenderer.

Definition at line 72 of file FWTextTableCellRenderer.cc.

References trackerHits::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(), and Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

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

Definition at line 150 of file FWTextTableCellRenderer.cc.

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

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

Definition at line 157 of file FWTextTableCellRenderer.cc.

Referenced by FWPSetTableManager::FWPSetTableManager().

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

Definition at line 52 of file FWTextTableCellRenderer.h.

References m_highlightContext.

Referenced by FWTextTreeCellRenderer::draw().

52 { return m_highlightContext; }
const FWTextTableCellRenderer& FWTextTableCellRenderer::operator= ( const FWTextTableCellRenderer )
private
bool FWTextTableCellRenderer::selected ( )
inline

Definition at line 66 of file FWTextTableCellRenderer.h.

References m_isSelected.

Referenced by FWTextTreeCellRenderer::draw().

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

Definition at line 112 of file FWTextTableCellRenderer.cc.

References m_data, and m_isSelected.

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

Definition at line 118 of file FWTextTableCellRenderer.cc.

References m_justify.

119 {
120  m_justify=iJustify;
121 }
UInt_t FWTextTableCellRenderer::width ( ) const
virtual

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

Implements FWTableCellRendererBase.

Reimplemented in FWTextTreeCellRenderer, FWCollectionSummaryModelCellRenderer, FWColumnLabelCellRenderer, and FWCheckedTextTableCellRenderer.

Definition at line 127 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(), 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().

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

Member Data Documentation

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

Definition at line 80 of file FWTextTableCellRenderer.h.

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

TGFont* FWTextTableCellRenderer::m_font
private

Definition at line 79 of file FWTextTableCellRenderer.h.

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

const TGGC* FWTextTableCellRenderer::m_highlightContext
private

Definition at line 78 of file FWTextTableCellRenderer.h.

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

bool FWTextTableCellRenderer::m_isSelected
private

Definition at line 81 of file FWTextTableCellRenderer.h.

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

Justify FWTextTableCellRenderer::m_justify
private

Definition at line 82 of file FWTextTableCellRenderer.h.

Referenced by draw(), and setJustify().