CMS 3D CMS Logo

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

#include <FWTextTreeCellRenderer.h>

Inheritance diagram for FWTextTreeCellRenderer:
FWTextTableCellRenderer FWTableCellRendererBase

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 More...
 
- Public Member Functions inherited from FWTextTableCellRenderer
const std::string & data ()
 
const TGFont * font () const
 
 FWTextTableCellRenderer (const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
 
const TGGC * graphicsContext () const
 
virtual UInt_t height () const
 returns the minimum height of the cell to which the renderer is representing More...
 
const TGGC * highlightContext () const
 
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)
 
virtual ~FWTextTableCellRenderer ()
 
- Public Member Functions inherited from FWTableCellRendererBase
virtual void buttonEvent (Event_t *iClickEvent, int iRelClickX, int iRelClickY)
 
 FWTableCellRendererBase ()
 
virtual ~FWTableCellRendererBase ()
 

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 Public Member Functions inherited from FWTextTableCellRenderer
static const TGGC & getDefaultGC ()
 
static const TGGC & getDefaultHighlightGC ()
 

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
 

Additional Inherited Members

- Public Types inherited from FWTextTableCellRenderer
enum  Justify { kJustifyLeft, kJustifyRight, kJustifyCenter }
 

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.

26  : FWTextTableCellRenderer(iContext, iHighlightContext, iJustify),
27  m_indentation(0),
28  m_editor(0),
29  m_showEditor(false),
30  m_isParent(false),
31  m_isOpen(false),
32  m_blackIcon(true),
33  m_editContext(0)
34  {}
FWTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)

Member Function Documentation

static const TGPicture* FWTextTreeCellRenderer::closedImage ( bool  isBlack = true)
inlinestatic

Definition at line 48 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

49  {
50  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir()+"arrow-white-right-blackbg.png");
51  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir()+"arrow-black-right.png");
52 
53  return isBlack ? s_picture_black : s_picture_white;
54  }
static const TString & coreIcondir()
static const TString& FWTextTreeCellRenderer::coreIcondir ( )
inlinestatic

Definition at line 37 of file FWTextTreeCellRenderer.h.

References cmsHarvester::path.

Referenced by closedImage(), and openedImage().

37  {
38  static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
39  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
40  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
41  path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
42  }
43 
44  return path;
45  }
tuple path
else: Piece not in the list, fine.
virtual void FWTextTreeCellRenderer::draw ( Drawable_t  iID,
int  iX,
int  iY,
unsigned int  iWidth,
unsigned int  iHeight 
)
inlinevirtual
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.

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

89  {
90  if (m_showEditor && m_editor)
91  {
92  // printf("renderer draw editor %d %d %d %d \n", iX, iY, m_editor->GetWidth(), m_editor->GetHeight());
93 
94  // fill to cover buffer offset
95  static TGGC editGC(FWTextTableCellRenderer::getDefaultGC());
96  editGC.SetForeground(m_editor->GetBackground());
97  gVirtualX->FillRectangle(iID, editGC(), iX - FWTabularWidget::kTextBuffer, iY - FWTabularWidget::kTextBuffer,
99 
100  if ( iY > -2)
101  {
102  // redraw editor
103  if (!m_editor->IsMapped())
104  {
105  m_editor->MapWindow();
106  m_editor->SetFocus();
107  }
108  m_editor->MoveResize(iX , iY, m_editor->GetWidth(), m_editor->GetHeight());
109  m_editor->SetCursorPosition( data().size());
110  gClient->NeedRedraw(m_editor);
111 
112  return;
113  }
114  else
115  {
116  // hide editor if selected entry scrolled away
117  if (m_editor->IsMapped()) m_editor->UnmapWindow();
118  }
119  }
120 
121  if (selected())
122  {
123  GContext_t c = highlightContext()->GetGC();
124  gVirtualX->FillRectangle(iID, c, iX - FWTabularWidget::kTextBuffer, iY - FWTabularWidget::kTextBuffer,
126  }
127  int xOffset = 0;
128  if(m_isParent) {
129  const TGPicture* img = m_isOpen ? openedImage(m_blackIcon) : closedImage(m_blackIcon);
130  img->Draw(iID,graphicsContext()->GetGC(),m_indentation+iX,iY +2);
131  xOffset += img->GetWidth() + s_iconOffset;
132  }
133 
134  FontMetrics_t metrics;
135  font()->GetFontMetrics(&metrics);
136 
137 
138  gVirtualX->DrawString(iID, graphicsContext()->GetGC(),
139  iX+m_indentation+xOffset, iY+metrics.fAscent,
140  data().c_str(),data().size());
141  }
static const TGPicture * closedImage(bool isBlack=true)
const TGGC * highlightContext() const
static const TGGC & getDefaultGC()
const TGFont * font() const
const TGGC * graphicsContext() const
const std::string & data()
static const TGPicture * openedImage(bool isBlack=true)
static const int kTextBuffer
tuple size
Write out results.
static int FWTextTreeCellRenderer::iconWidth ( )
inlinestatic

Definition at line 67 of file FWTextTreeCellRenderer.h.

References openedImage(), and s_iconOffset.

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

68  {
69  return openedImage(true)->GetWidth() + s_iconOffset;
70  }
static const TGPicture * openedImage(bool isBlack=true)
static const TGPicture* FWTextTreeCellRenderer::openedImage ( bool  isBlack = true)
inlinestatic

Definition at line 57 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

58  {
59  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir()+"arrow-white-down-blackbg.png");
60  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir()+"arrow-black-down.png");
61 
62  return isBlack ? s_picture_black : s_picture_white;
63  }
static const TString & coreIcondir()
void FWTextTreeCellRenderer::setBlackIcon ( bool  value)
inline
virtual void FWTextTreeCellRenderer::setCellEditor ( TGTextEntry *  editor)
inlinevirtual
virtual void FWTextTreeCellRenderer::setIndentation ( int  indentation = 0)
inlinevirtual
void FWTextTreeCellRenderer::setIsOpen ( bool  value)
inline
void FWTextTreeCellRenderer::setIsParent ( bool  value)
inline
virtual void FWTextTreeCellRenderer::showEditor ( bool  value)
inlinevirtual
virtual UInt_t FWTextTreeCellRenderer::width ( ) const
inlinevirtual

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, w(), and FWTextTableCellRenderer::width().

Referenced by Vispa.Main.MainWindow.MainWindow::_saveIni(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Gui.VispaWidget.VispaWidget::boundingRect(), Vispa.Gui.VispaWidget.VispaWidget::contentRect(), Vispa.Gui.VispaWidget.VispaWidget::defineArrowBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineCircleBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::defineRoundRectBackgroundShape(), Vispa.Gui.VispaWidget.VispaWidget::drawHeaderBackground(), Vispa.Gui.ConnectableWidget.ConnectableWidget::drawPortNames(), Vispa.Gui.VispaWidget.VispaWidget::imageRectF(), Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget(), Vispa.Views.PropertyView.PropertyView::resizeEvent(), Vispa.Views.PropertyView.PropertyView::sectionResized(), Vispa.Gui.VispaWidget.VispaWidget::setZoom(), and Vispa.Main.MainWindow.MainWindow::updateStartupScreenGeometry().

82  {
84  if (m_isParent) w += iconWidth();
85  return w;
86  }
T w() const
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing

Member Data Documentation

bool FWTextTreeCellRenderer::m_blackIcon
private

Definition at line 148 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

const TGGC* FWTextTreeCellRenderer::m_editContext
private

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().

int FWTextTreeCellRenderer::m_indentation
private

Definition at line 143 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_isOpen
private

Definition at line 147 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

bool FWTextTreeCellRenderer::m_isParent
private

Definition at line 146 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_showEditor
private

Definition at line 145 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and showEditor().

const int FWTextTreeCellRenderer::s_iconOffset = 2
staticprotected

Definition at line 19 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and iconWidth().