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 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.

35  :
36  m_context(iContext),
37  m_highlightContext(iHighlightContext),
38  m_font(0),
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 ( )
virtual

Definition at line 51 of file FWTextTableCellRenderer.cc.

52 {
53 }
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 71 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().

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
static const int kTextBuffer
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
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 = 0;
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
virtual
const TGGC* FWTextTableCellRenderer::highlightContext ( ) const
inline

Definition at line 51 of file FWTextTableCellRenderer.h.

References m_highlightContext.

Referenced by FWTextTreeCellRenderer::draw().

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

Definition at line 65 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 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.

118 {
119  m_justify=iJustify;
120 }
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 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(), 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.size()) {
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().