CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

FWCheckedTextTableCellRenderer Class Reference

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

Inheritance diagram for FWCheckedTextTableCellRenderer:
FWTextTableCellRenderer FWTableCellRendererBase

List of all members.

Public Member Functions

virtual void buttonEvent (Event_t *iClickEvent, int iRelClickX, int iRelClickY)
void checkBoxClicked ()
 ClassDef (FWCheckedTextTableCellRenderer, 0)
virtual void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
 FWCheckedTextTableCellRenderer (const TGGC *iContext=&(getDefaultGC()))
bool isChecked () const
void setChecked (bool)
virtual UInt_t width () const
 returns the minimum width of the cell to which the renderer is representing
virtual ~FWCheckedTextTableCellRenderer ()

Private Attributes

bool m_isChecked

Static Private Attributes

static const UInt_t kGap = 2

Detailed Description

Description: A Cell renderer which shows both a check box and text

Usage: <usage>

Definition at line 30 of file FWCheckedTextTableCellRenderer.h.


Constructor & Destructor Documentation

FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer ( const TGGC *  iContext = &(getDefaultGC()))

Definition at line 32 of file FWCheckedTextTableCellRenderer.cc.

                                                                                  :
FWTextTableCellRenderer(iContext), 
m_isChecked(false) {}
FWCheckedTextTableCellRenderer::~FWCheckedTextTableCellRenderer ( ) [virtual]

Definition at line 41 of file FWCheckedTextTableCellRenderer.cc.

{
}

Member Function Documentation

void FWCheckedTextTableCellRenderer::buttonEvent ( Event_t *  iClickEvent,
int  iRelClickX,
int  iRelClickY 
) [virtual]

Called when a mouse button event occurs when the cursor is over a particular cell: arguments iClickEvent: the ROOT GUI event caused by the mouse button iRelClickX: the x position of the cursor click relative to the start of the cell drawing area iRelClickY: the y position of the cursor click relative to the start of the cell drawing area

Reimplemented from FWTableCellRendererBase.

Definition at line 84 of file FWCheckedTextTableCellRenderer.cc.

References checkBoxClicked(), h, and FWTextTableCellRenderer::height().

{
   const int h = height();
   
   bool wasClicked = iClickEvent->fType==kButtonRelease &&
                     iRelClickX >=0 &&
                     iRelClickX <=h &&
                     iRelClickY >=0 &&
                     iRelClickY <=h;
   if(wasClicked) {
      //std::cout <<"clicked"<<std::endl;
      checkBoxClicked();
   }
}
void FWCheckedTextTableCellRenderer::checkBoxClicked ( )

Definition at line 100 of file FWCheckedTextTableCellRenderer.cc.

Referenced by buttonEvent().

{
   Emit("checkBoxClicked()");
}
FWCheckedTextTableCellRenderer::ClassDef ( FWCheckedTextTableCellRenderer  ,
 
)
void FWCheckedTextTableCellRenderer::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 65 of file FWCheckedTextTableCellRenderer.cc.

References trackerHits::c, FWTextTableCellRenderer::graphicsContext(), h, FWTextTableCellRenderer::height(), kGap, and m_isChecked.

{
   const UInt_t h = height();
   
   //draw the check box
   GContext_t c = graphicsContext()->GetGC();
   gVirtualX->DrawLine(iID,c,iX,iY,iX,iY+h);
   gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX,iY+h);
   gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX+h,iY);
   gVirtualX->DrawLine(iID,c,iX+h,iY,iX,iY);
   
   if(m_isChecked) {
      gVirtualX->DrawLine(iID,c,iX,iY+h/2,iX+h/2,iY+h);      
      gVirtualX->DrawLine(iID,c,iX+h,iY,iX+h/2,iY+h);      
   }
   FWTextTableCellRenderer::draw(iID,iX+kGap+h,iY,iWidth-kGap-h,iHeight);
}
bool FWCheckedTextTableCellRenderer::isChecked ( ) const

Definition at line 108 of file FWCheckedTextTableCellRenderer.cc.

References m_isChecked.

{
   return m_isChecked;
}
void FWCheckedTextTableCellRenderer::setChecked ( bool  iChecked)

Definition at line 60 of file FWCheckedTextTableCellRenderer.cc.

References m_isChecked.

                                                             {
   m_isChecked = iChecked;
}
UInt_t FWCheckedTextTableCellRenderer::width ( ) const [virtual]

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

Reimplemented from FWTextTableCellRenderer.

Definition at line 113 of file FWCheckedTextTableCellRenderer.cc.

References h, FWTextTableCellRenderer::height(), and kGap.


Member Data Documentation

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

Definition at line 61 of file FWCheckedTextTableCellRenderer.h.

Referenced by draw(), and width().

Definition at line 62 of file FWCheckedTextTableCellRenderer.h.

Referenced by draw(), isChecked(), and setChecked().