CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

FWColumnLabelCellRenderer Class Reference

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

Inheritance diagram for FWColumnLabelCellRenderer:
FWTextTableCellRenderer FWTableCellRendererBase

List of all members.

Public Member Functions

virtual void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
 FWColumnLabelCellRenderer (const TGGC *iContext=&(getDefaultGC()), bool isSortable=true)
void setSortOrder (fireworks::table::SortOrder)
fireworks::table::SortOrder sortOrder () const
virtual UInt_t width () const
 returns the minimum width of the cell to which the renderer is representing
virtual ~FWColumnLabelCellRenderer ()

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

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 31 of file FWColumnLabelCellRenderer.h.


Constructor & Destructor Documentation

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

Definition at line 35 of file FWColumnLabelCellRenderer.cc.

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

                                                                                         :
FWTextTableCellRenderer(iContext), 
m_sortOrder(fireworks::table::kNotSorted),
m_sizeOfOrderIcon(height()),
m_isSortable(isSortable)
{
  if (m_isSortable)
  {
   FontMetrics_t metrics;
   font()->GetFontMetrics(&metrics);

   m_sizeOfOrderIcon -= 2*metrics.fDescent;
   m_sizeOfOrderIconStartX = metrics.fDescent;
   //we want the number to be even so that the point of the triangle 
   // will be right in the middle
   if(1 == m_sizeOfOrderIcon % 2) {
      ++m_sizeOfOrderIcon;
   }
  }
}
FWColumnLabelCellRenderer::~FWColumnLabelCellRenderer ( ) [virtual]

Definition at line 62 of file FWColumnLabelCellRenderer.cc.

{
}

Member Function Documentation

void FWColumnLabelCellRenderer::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()

Reimplemented from FWTextTableCellRenderer.

Definition at line 89 of file FWColumnLabelCellRenderer.cc.

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

{
  if (m_isSortable) 
  {
    using namespace fireworks::table;
    UInt_t h = m_sizeOfOrderIcon;
    const GContext_t c = graphicsContext()->GetGC();
    int dY = m_sizeOfOrderIconStartX;
    
    if(kAscendingSort == m_sortOrder) {
      gVirtualX->DrawLine(iID, c, iX+h/2, iY+2+dY,   iX,   iY+h-2+dY);
      gVirtualX->DrawLine(iID, c, iX,     iY+h-2+dY, iX+h, iY+h-2+dY);
      gVirtualX->DrawLine(iID, c, iX+h/2, iY+2+dY,   iX+h, iY+h-2+dY);
    }
    if(kDescendingSort == m_sortOrder){
      gVirtualX->DrawLine(iID, c, iX,     iY+2+dY,   iX+h, iY+2+dY);
      gVirtualX->DrawLine(iID, c, iX+h/2, iY+h-2+dY, iX+h, iY+2+dY);
      gVirtualX->DrawLine(iID, c, iX+h/2, iY+h-2+dY, iX,   iY+2+dY);      
    }
    FWTextTableCellRenderer::draw(iID,iX+kGap+h,iY,iWidth-kGap-h,iHeight);
  }
  else
  {
    return FWTextTableCellRenderer::draw(iID, iX+kGap, iY-kGap, iWidth, iHeight);
  }

}
void FWColumnLabelCellRenderer::setSortOrder ( fireworks::table::SortOrder  iOrder)
fireworks::table::SortOrder FWColumnLabelCellRenderer::sortOrder ( ) const

Definition at line 120 of file FWColumnLabelCellRenderer.cc.

References m_sortOrder.

{
   return m_sortOrder;
}
UInt_t FWColumnLabelCellRenderer::width ( ) const [virtual]

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

Reimplemented from FWTextTableCellRenderer.

Definition at line 125 of file FWColumnLabelCellRenderer.cc.

References kGap, m_isSortable, and m_sizeOfOrderIcon.


Member Data Documentation

const UInt_t FWColumnLabelCellRenderer::kGap = 2 [static, private]

Definition at line 56 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), and width().

Definition at line 61 of file FWColumnLabelCellRenderer.h.

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

Definition at line 58 of file FWColumnLabelCellRenderer.h.

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

Definition at line 59 of file FWColumnLabelCellRenderer.h.

Referenced by draw(), and FWColumnLabelCellRenderer().

Definition at line 57 of file FWColumnLabelCellRenderer.h.

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