CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
FWColumnLabelCellRenderer Class Reference

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

Inheritance diagram for FWColumnLabelCellRenderer:
FWTextTableCellRenderer FWTableCellRendererBase

Public Member Functions

void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
 
 FWColumnLabelCellRenderer (const TGGC *iContext=&(getDefaultGC()), bool isSortable=true)
 
void setSortOrder (fireworks::table::SortOrder)
 
fireworks::table::SortOrder sortOrder () const
 
UInt_t width () const override
 returns the minimum width of the cell to which the renderer is representing More...
 
 ~FWColumnLabelCellRenderer () override
 
- Public Member Functions inherited from FWTextTableCellRenderer
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)
 
 FWTextTableCellRenderer (const FWTextTableCellRenderer &)=delete
 
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
 
const FWTextTableCellRendereroperator= (const FWTextTableCellRenderer &)=delete
 
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 ()
 
 FWTableCellRendererBase (const FWTableCellRendererBase &)=delete
 
const FWTableCellRendererBaseoperator= (const FWTableCellRendererBase &)=delete
 
virtual ~FWTableCellRendererBase ()
 

Private Attributes

bool m_isSortable
 
int m_sizeOfOrderIcon
 
int m_sizeOfOrderIconStartX
 
fireworks::table::SortOrder m_sortOrder
 

Static Private Attributes

static const UInt_t kGap = 2
 

Additional Inherited Members

- Public Types inherited from FWTextTableCellRenderer
enum  Justify { kJustifyLeft, kJustifyRight, kJustifyCenter }
 
- Static Public Member Functions inherited from FWTextTableCellRenderer
static const TGGC & getDefaultGC ()
 
static const TGGC & getDefaultHighlightGC ()
 

Detailed Description

Description: Cell Renderer which handles the labels at the top of columns

Usage: This renderer will draw both the text of the column's label and if the sort order has been set to kAscendingSort or kDescendingSort it will also draw the appropriate symbol denoting the sort order of the column.

Definition at line 30 of file FWColumnLabelCellRenderer.h.

Constructor & Destructor Documentation

◆ FWColumnLabelCellRenderer()

FWColumnLabelCellRenderer::FWColumnLabelCellRenderer ( const TGGC *  iContext = &(getDefaultGC()),
bool  isSortable = true 
)

Definition at line 33 of file FWColumnLabelCellRenderer.cc.

References FWTextTableCellRenderer::font(), m_isSortable, m_sizeOfOrderIcon, m_sizeOfOrderIconStartX, and mergeResourcesJson::metrics.

34  : FWTextTableCellRenderer(iContext),
37  m_isSortable(isSortable) {
38  if (m_isSortable) {
39  FontMetrics_t metrics;
40  font()->GetFontMetrics(&metrics);
41 
42  m_sizeOfOrderIcon -= 2 * metrics.fDescent;
44  //we want the number to be even so that the point of the triangle
45  // will be right in the middle
46  if (1 == m_sizeOfOrderIcon % 2) {
48  }
49  }
50 }
FWTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
UInt_t height() const override
returns the minimum height of the cell to which the renderer is representing
fireworks::table::SortOrder m_sortOrder

◆ ~FWColumnLabelCellRenderer()

FWColumnLabelCellRenderer::~FWColumnLabelCellRenderer ( )
override

Definition at line 57 of file FWColumnLabelCellRenderer.cc.

57 {}

Member Function Documentation

◆ draw()

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

Definition at line 81 of file FWColumnLabelCellRenderer.cc.

References DummyCfis::c, FWTextTableCellRenderer::draw(), dY(), FWTextTableCellRenderer::graphicsContext(), h, fireworks::table::kAscendingSort, kDescendingSort, kGap, m_isSortable, m_sizeOfOrderIcon, m_sizeOfOrderIconStartX, and m_sortOrder.

81  {
82  if (m_isSortable) {
83  using namespace fireworks::table;
84  UInt_t h = m_sizeOfOrderIcon;
85  const GContext_t c = graphicsContext()->GetGC();
87 
88  if (kAscendingSort == m_sortOrder) {
89  gVirtualX->DrawLine(iID, c, iX + h / 2, iY + 2 + dY, iX, iY + h - 2 + dY);
90  gVirtualX->DrawLine(iID, c, iX, iY + h - 2 + dY, iX + h, iY + h - 2 + dY);
91  gVirtualX->DrawLine(iID, c, iX + h / 2, iY + 2 + dY, iX + h, iY + h - 2 + dY);
92  }
94  gVirtualX->DrawLine(iID, c, iX, iY + 2 + dY, iX + h, iY + 2 + dY);
95  gVirtualX->DrawLine(iID, c, iX + h / 2, iY + h - 2 + dY, iX + h, iY + 2 + dY);
96  gVirtualX->DrawLine(iID, c, iX + h / 2, iY + h - 2 + dY, iX, iY + 2 + dY);
97  }
98  FWTextTableCellRenderer::draw(iID, iX + kGap + h, iY, iWidth - kGap - h, iHeight);
99  } else {
100  return FWTextTableCellRenderer::draw(iID, iX + kGap, iY - kGap, iWidth, iHeight);
101  }
102 }
static const std::string kDescendingSort
Definition: FWTableView.cc:193
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
const TGGC * graphicsContext() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
fireworks::table::SortOrder m_sortOrder
float dY(const MatchPair &match)

◆ setSortOrder()

void FWColumnLabelCellRenderer::setSortOrder ( fireworks::table::SortOrder  iOrder)

◆ sortOrder()

fireworks::table::SortOrder FWColumnLabelCellRenderer::sortOrder ( ) const

Definition at line 107 of file FWColumnLabelCellRenderer.cc.

References m_sortOrder.

107 { return m_sortOrder; }
fireworks::table::SortOrder m_sortOrder

◆ width()

UInt_t FWColumnLabelCellRenderer::width ( ) const
overridevirtual

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

Implements FWTableCellRendererBase.

Definition at line 109 of file FWColumnLabelCellRenderer.cc.

References kGap, m_isSortable, m_sizeOfOrderIcon, and FWTextTableCellRenderer::width().

109  {
110  if (m_isSortable)
112  else {
113  return FWTextTableCellRenderer::width() + kGap * 2;
114  }
115 }
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing

Member Data Documentation

◆ kGap

const UInt_t FWColumnLabelCellRenderer::kGap = 2
staticprivate

Definition at line 53 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), and width().

◆ m_isSortable

bool FWColumnLabelCellRenderer::m_isSortable
private

Definition at line 58 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), FWColumnLabelCellRenderer(), setSortOrder(), and width().

◆ m_sizeOfOrderIcon

int FWColumnLabelCellRenderer::m_sizeOfOrderIcon
private

Definition at line 55 of file FWColumnLabelCellRenderer.h.

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

◆ m_sizeOfOrderIconStartX

int FWColumnLabelCellRenderer::m_sizeOfOrderIconStartX
private

Definition at line 56 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), and FWColumnLabelCellRenderer().

◆ m_sortOrder

fireworks::table::SortOrder FWColumnLabelCellRenderer::m_sortOrder
private

Definition at line 54 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), setSortOrder(), and sortOrder().