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
FWFramedTextTableCellRenderer Class Reference

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

Inheritance diagram for FWFramedTextTableCellRenderer:
FWTableCellRendererBase

Public Types

enum  Justify { kJustifyLeft, kJustifyRight, kJustifyCenter }
 

Public Member Functions

virtual void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
 
const TGFont * font () const
 
 FWFramedTextTableCellRenderer (const TGGC *iTextContext=&(getDefaultGC()), const TGGC *iFillContext=&(getFillGC()), 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...
 
void setData (const std::string &)
 
void setGraphicsContext (const TGGC *iContext)
 
void setJustify (Justify)
 
virtual UInt_t width () const
 returns the minimum width of the cell to which the renderer is representing More...
 
virtual ~FWFramedTextTableCellRenderer ()
 
- 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 & getFillGC ()
 

Private Member Functions

 FWFramedTextTableCellRenderer (const FWFramedTextTableCellRenderer &)
 
const
FWFramedTextTableCellRenderer
operator= (const FWFramedTextTableCellRenderer &)
 

Private Attributes

const TGGC * m_context
 
std::string m_data
 
TGFont * m_font
 
const TGGC * m_frameContext
 
Justify m_justify
 

Detailed Description

Description: A Cell Renderer who draws text with an outline and fills in the background

Usage: The background color of the text graphics context will be used to draw an outline around the regular text and the color of the regular text is set by the foreground color of the text graphics context.

Definition at line 33 of file FWFramedTextTableCellRenderer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FWFramedTextTableCellRenderer::FWFramedTextTableCellRenderer ( const TGGC *  iTextContext = &(getDefaultGC()),
const TGGC *  iFillContext = &(getFillGC()),
Justify  iJustify = kJustifyLeft 
)

Definition at line 34 of file FWFramedTextTableCellRenderer.cc.

References m_context, and m_font.

34  :
35  m_context(iTextContext),
36  m_frameContext(iFillContext),
37  m_font(0),
38  m_justify(iJustify)
39 {
40  //TGGC* tggc= gClient->GetGCPool()->GetGC(iContext);
41  m_font = gClient->GetFontPool()->FindFontByHandle(m_context->GetFont());
42 }
FWFramedTextTableCellRenderer::~FWFramedTextTableCellRenderer ( )
virtual

Definition at line 49 of file FWFramedTextTableCellRenderer.cc.

50 {
51 }
FWFramedTextTableCellRenderer::FWFramedTextTableCellRenderer ( const FWFramedTextTableCellRenderer )
private

Member Function Documentation

void FWFramedTextTableCellRenderer::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.

Definition at line 69 of file FWFramedTextTableCellRenderer.cc.

References kJustifyCenter, kJustifyRight, m_context, m_data, m_font, m_frameContext, m_justify, w, and width().

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

70 {
71  // GContext_t c = m_frameContext->GetGC();
72 
73  gVirtualX->DrawLine(iID,m_frameContext->GetGC(),iX-1,iY-1,iX-1,iY+iHeight);
74  gVirtualX->DrawLine(iID,m_frameContext->GetGC(),iX+iWidth,iY-1,iX+iWidth,iY+iHeight);
75  gVirtualX->DrawLine(iID,m_frameContext->GetGC(),iX-1,iY-1,iX+iWidth,iY-1);
76  gVirtualX->DrawLine(iID,m_frameContext->GetGC(),iX-1,iY+iHeight,iX+iWidth,iY+iHeight);
77 
78  FontMetrics_t metrics;
79  m_font->GetFontMetrics(&metrics);
80  int dX=2;
82  int w = width();
83  dX = iWidth-w;
84  }
86  int w = width();
87  dX = (iWidth-w)/2;
88 
89  }
90 
91  gVirtualX->DrawString(iID,m_context->GetGC(),iX+dX,iY+metrics.fAscent, m_data.c_str(),m_data.size());
92 }
const double w
Definition: UKUtility.cc:23
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
const TGFont * FWFramedTextTableCellRenderer::font ( ) const
const TGGC & FWFramedTextTableCellRenderer::getDefaultGC ( )
static

Definition at line 132 of file FWFramedTextTableCellRenderer.cc.

133 {
134  static const TGGC* s_default = gClient->GetResourcePool()->GetFrameGC();
135  return *s_default;
136 }
const TGGC & FWFramedTextTableCellRenderer::getFillGC ( )
static

Definition at line 139 of file FWFramedTextTableCellRenderer.cc.

140 {
141  // Return graphics context for highlighted frame background.
142  static const TGGC* s_default = 0;
143  if (!s_default) {
144  GCValues_t gval;
145  gval.fMask = kGCForeground | kGCBackground | kGCTile |
146  kGCFillStyle | kGCGraphicsExposures;
147  gval.fForeground = gClient->GetResourcePool()->GetFrameHiliteColor();
148  gval.fBackground = gClient->GetResourcePool()->GetFrameBgndColor();
149  gval.fFillStyle = kFillTiled;
150  gval.fTile = gClient->GetResourcePool()->GetCheckeredPixmap();
151  gval.fGraphicsExposures = kFALSE;
152  s_default = gClient->GetGC(&gval, kTRUE);
153  }
154  return *s_default;
155 }
const TGGC* FWFramedTextTableCellRenderer::graphicsContext ( ) const
inline

Definition at line 51 of file FWFramedTextTableCellRenderer.h.

References m_context.

UInt_t FWFramedTextTableCellRenderer::height ( ) const
virtual
const FWFramedTextTableCellRenderer& FWFramedTextTableCellRenderer::operator= ( const FWFramedTextTableCellRenderer )
private
void FWFramedTextTableCellRenderer::setData ( const std::string &  iData)

Definition at line 95 of file FWFramedTextTableCellRenderer.cc.

References m_data.

Referenced by FWTableViewTableManager::rowHeader().

95  {
96  m_data = iData;
97 }
void FWFramedTextTableCellRenderer::setGraphicsContext ( const TGGC *  iContext)
inline

Definition at line 60 of file FWFramedTextTableCellRenderer.h.

References m_context.

60 { m_context = iContext;}
void FWFramedTextTableCellRenderer::setJustify ( Justify  iJustify)

Definition at line 100 of file FWFramedTextTableCellRenderer.cc.

References m_justify.

101 {
102  m_justify=iJustify;
103 }
UInt_t FWFramedTextTableCellRenderer::width ( ) const
virtual

Member Data Documentation

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

Definition at line 75 of file FWFramedTextTableCellRenderer.h.

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

TGFont* FWFramedTextTableCellRenderer::m_font
private
const TGGC* FWFramedTextTableCellRenderer::m_frameContext
private

Definition at line 73 of file FWFramedTextTableCellRenderer.h.

Referenced by draw().

Justify FWFramedTextTableCellRenderer::m_justify
private

Definition at line 76 of file FWFramedTextTableCellRenderer.h.

Referenced by draw(), and setJustify().