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)
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 ()
static const TString & coreIcondir ()
static int iconWidth ()
static const TGPicture * openedImage ()

Static Protected Attributes

static const int s_iconOffset = 2

Private Attributes

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

Detailed Description

Definition at line 15 of file FWTextTreeCellRenderer.h.


Constructor & Destructor Documentation

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

Definition at line 22 of file FWTextTreeCellRenderer.h.

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

Member Function Documentation

static const TGPicture* FWTextTreeCellRenderer::closedImage ( ) [inline, static]

Definition at line 45 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

   {
      static const TGPicture* s_picture=gClient->GetPicture(coreIcondir()+"arrow-black-right.png");
      return s_picture;
   }
static const TString& FWTextTreeCellRenderer::coreIcondir ( ) [inline, static]

Definition at line 34 of file FWTextTreeCellRenderer.h.

References 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 78 of file FWTextTreeCellRenderer.h.

References trackerHits::c, closedImage(), FWTextTableCellRenderer::data(), FWTextTableCellRenderer::font(), FWTextTableCellRenderer::getDefaultGC(), FWTextTableCellRenderer::graphicsContext(), FWTextTableCellRenderer::highlightContext(), FWTabularWidget::kTextBuffer, 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) {
         if(m_isOpen) {
            openedImage()->Draw(iID,graphicsContext()->GetGC(),m_indentation+iX,iY +2);
            xOffset += openedImage()->GetWidth() + s_iconOffset;
         } else {
            closedImage()->Draw(iID,graphicsContext()->GetGC(),m_indentation+iX,iY +2);
            xOffset += closedImage()->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]

Definition at line 59 of file FWTextTreeCellRenderer.h.

References openedImage(), and s_iconOffset.

Referenced by FWGeometryTableManager::cellRenderer(), FWPSetTableManager::cellRenderer(), and width().

   {
      return  openedImage()->GetWidth() + s_iconOffset;
   }
static const TGPicture* FWTextTreeCellRenderer::openedImage ( ) [inline, static]

Definition at line 52 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

   {
      static const TGPicture* s_picture=gClient->GetPicture(coreIcondir()+"arrow-black-down.png");
      return s_picture;
   }
virtual void FWTextTreeCellRenderer::setCellEditor ( TGTextEntry *  editor) [inline, virtual]

Definition at line 65 of file FWTextTreeCellRenderer.h.

References idDealer::editor, and m_editor.

Referenced by FWPSetTableManager::setCellValueEditor().

virtual void FWTextTreeCellRenderer::setIndentation ( int  indentation = 0) [inline, virtual]

Definition at line 64 of file FWTextTreeCellRenderer.h.

References m_indentation.

Referenced by FWGeometryTableManager::cellRenderer(), and FWPSetTableManager::cellRenderer().

{ m_indentation = indentation; }
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 71 of file FWTextTreeCellRenderer.h.

References iconWidth(), m_indentation, and m_isParent.

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

Member Data Documentation

Definition at line 142 of file FWTextTreeCellRenderer.h.

TGTextEntry* FWTextTreeCellRenderer::m_editor [private]

Definition at line 138 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

Definition at line 137 of file FWTextTreeCellRenderer.h.

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

Definition at line 141 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

Definition at line 140 of file FWTextTreeCellRenderer.h.

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

Definition at line 139 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and showEditor().

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

Definition at line 18 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and iconWidth().