CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Attributes

FWTextTreeCellRenderer Class Reference

#include <FWTextTreeCellRenderer.h>

Inheritance diagram for FWTextTreeCellRenderer:
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)
 FWTextTreeCellRenderer (const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
void setBlackIcon (bool value)
virtual void setCellEditor (TGTextEntry *editor)
virtual void setIndentation (int indentation=0)
void setIsOpen (bool value)
void setIsParent (bool value)
virtual void showEditor (bool value)
virtual UInt_t width () const
 returns the minimum width of the cell to which the renderer is representing

Static Public Member Functions

static const TGPicture * closedImage (bool isBlack=true)
static const TString & coreIcondir ()
static int iconWidth ()
static const TGPicture * openedImage (bool isBlack=true)

Static Protected Attributes

static const int s_iconOffset = 2

Private Attributes

bool m_blackIcon
const TGGC * m_editContext
TGTextEntry * m_editor
int m_indentation
bool m_isOpen
bool m_isParent
bool m_showEditor

Detailed Description

Definition at line 16 of file FWTextTreeCellRenderer.h.


Constructor & Destructor Documentation

FWTextTreeCellRenderer::FWTextTreeCellRenderer ( const TGGC *  iContext = &(getDefaultGC()),
const TGGC *  iHighlightContext = &(getDefaultHighlightGC()),
Justify  iJustify = kJustifyLeft 
) [inline]

Definition at line 23 of file FWTextTreeCellRenderer.h.

      : FWTextTableCellRenderer(iContext, iHighlightContext, iJustify),
        m_indentation(0),
        m_editor(0),
        m_showEditor(false),
        m_isParent(false),
        m_isOpen(false),
        m_blackIcon(true),
        m_editContext(0)
   {}

Member Function Documentation

static const TGPicture* FWTextTreeCellRenderer::closedImage ( bool  isBlack = true) [inline, static]

Definition at line 48 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

   {
      static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir()+"arrow-white-right-blackbg.png");
      static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir()+"arrow-black-right.png");

      return isBlack ? s_picture_black : s_picture_white;
   }
static const TString& FWTextTreeCellRenderer::coreIcondir ( ) [inline, static]

Definition at line 37 of file FWTextTreeCellRenderer.h.

References getHLTPrescaleColumns::path.

Referenced by closedImage(), and openedImage().

                                       {
      static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
      if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
         assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
         path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
      }

      return path;
   }
virtual void FWTextTreeCellRenderer::draw ( Drawable_t  iID,
int  iX,
int  iY,
unsigned int  iWidth,
unsigned int  iHeight 
) [inline, 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 88 of file FWTextTreeCellRenderer.h.

References trackerHits::c, closedImage(), FWTextTableCellRenderer::data(), FWTextTableCellRenderer::font(), FWTextTableCellRenderer::getDefaultGC(), FWTextTableCellRenderer::graphicsContext(), FWTextTableCellRenderer::highlightContext(), FWTabularWidget::kTextBuffer, m_blackIcon, m_editor, m_indentation, m_isOpen, m_isParent, m_showEditor, openedImage(), s_iconOffset, FWTextTableCellRenderer::selected(), and findQualityFiles::size.

   {      
      if (m_showEditor && m_editor)
      {
         //  printf("renderer draw editor %d %d %d %d \n", iX, iY, m_editor->GetWidth(), m_editor->GetHeight());

         // fill to cover buffer offset
         static TGGC editGC(FWTextTableCellRenderer::getDefaultGC()); 
         editGC.SetForeground(m_editor->GetBackground());
         gVirtualX->FillRectangle(iID, editGC(), iX - FWTabularWidget::kTextBuffer, iY - FWTabularWidget::kTextBuffer,
                                  iWidth + 2*FWTabularWidget::kTextBuffer, iHeight + 2*FWTabularWidget::kTextBuffer);

         if ( iY > -2)
         {
            // redraw editor
            if (!m_editor->IsMapped())
            {
               m_editor->MapWindow();
               m_editor->SetFocus();
            }
            m_editor->MoveResize(iX , iY, m_editor->GetWidth(), m_editor->GetHeight());
            m_editor->SetCursorPosition( data().size());
            gClient->NeedRedraw(m_editor);
       
            return;
         }
         else
         {
            // hide editor if selected entry scrolled away
            if (m_editor->IsMapped()) m_editor->UnmapWindow();
         }
      }

      if (selected())
      {
         GContext_t c = highlightContext()->GetGC();
         gVirtualX->FillRectangle(iID, c, iX - FWTabularWidget::kTextBuffer, iY - FWTabularWidget::kTextBuffer,
                                  iWidth + 2*FWTabularWidget::kTextBuffer, iHeight + 2*FWTabularWidget::kTextBuffer);
      } 
      int xOffset = 0;
      if(m_isParent) {
         const TGPicture* img = m_isOpen ?  openedImage(m_blackIcon) : closedImage(m_blackIcon);         
         img->Draw(iID,graphicsContext()->GetGC(),m_indentation+iX,iY +2);
         xOffset += img->GetWidth() + s_iconOffset;
      }

      FontMetrics_t metrics;
      font()->GetFontMetrics(&metrics);


      gVirtualX->DrawString(iID, graphicsContext()->GetGC(),
                            iX+m_indentation+xOffset, iY+metrics.fAscent, 
                            data().c_str(),data().size());
   }
static int FWTextTreeCellRenderer::iconWidth ( ) [inline, static]
static const TGPicture* FWTextTreeCellRenderer::openedImage ( bool  isBlack = true) [inline, static]

Definition at line 57 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

   {
      static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir()+"arrow-white-down-blackbg.png");
      static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir()+"arrow-black-down.png");

      return isBlack ? s_picture_black : s_picture_white;
   }
void FWTextTreeCellRenderer::setBlackIcon ( bool  value) [inline]
virtual void FWTextTreeCellRenderer::setCellEditor ( TGTextEntry *  editor) [inline, virtual]

Definition at line 73 of file FWTextTreeCellRenderer.h.

References idDealer::editor, and m_editor.

Referenced by FWPSetTableManager::setCellValueEditor().

virtual void FWTextTreeCellRenderer::setIndentation ( int  indentation = 0) [inline, virtual]
void FWTextTreeCellRenderer::setIsOpen ( bool  value) [inline]
void FWTextTreeCellRenderer::setIsParent ( bool  value) [inline]
virtual void FWTextTreeCellRenderer::showEditor ( bool  value) [inline, virtual]
virtual UInt_t FWTextTreeCellRenderer::width ( ) const [inline, virtual]

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

Reimplemented from FWTextTableCellRenderer.

Definition at line 81 of file FWTextTreeCellRenderer.h.

References iconWidth(), m_indentation, m_isParent, and w().

   {
      int w = FWTextTableCellRenderer::width() + 15 + m_indentation;
      if (m_isParent)   w += iconWidth();
      return w;
   }

Member Data Documentation

Definition at line 148 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

Definition at line 149 of file FWTextTreeCellRenderer.h.

TGTextEntry* FWTextTreeCellRenderer::m_editor [private]

Definition at line 144 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

Definition at line 143 of file FWTextTreeCellRenderer.h.

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

Definition at line 147 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

Definition at line 146 of file FWTextTreeCellRenderer.h.

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

Definition at line 145 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and showEditor().

const int FWTextTreeCellRenderer::s_iconOffset = 2 [static, protected]

Definition at line 19 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and iconWidth().