CMS 3D CMS Logo

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

void draw (Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
 
 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)
 
UInt_t width () const override
 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
 
UInt_t height () const override
 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)
 
 ~FWTextTableCellRenderer () override
 
- 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
 
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(nullptr),
29  m_showEditor(false),
30  m_isParent(false),
31  m_isOpen(false),
32  m_blackIcon(true)
33  {}
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 47 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

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

Definition at line 36 of file FWTextTreeCellRenderer.h.

References callgraph::path.

Referenced by closedImage(), and openedImage().

36  {
37  static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
38  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
39  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
40  path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
41  }
42 
43  return path;
44  }
void FWTextTreeCellRenderer::draw ( Drawable_t  iID,
int  iX,
int  iY,
unsigned int  iWidth,
unsigned int  iHeight 
)
inlineoverridevirtual

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

References EnergyCorrector::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(), findQualityFiles::size, and phase1PixelTopology::xOffset.

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

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

Definition at line 66 of file FWTextTreeCellRenderer.h.

References openedImage(), and s_iconOffset.

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

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

Definition at line 56 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

57  {
58  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir()+"arrow-white-down-blackbg.png");
59  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir()+"arrow-black-down.png");
60 
61  return isBlack ? s_picture_black : s_picture_white;
62  }
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
UInt_t FWTextTreeCellRenderer::width ( ) const
inlineoverridevirtual

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

Reimplemented from FWTextTableCellRenderer.

Definition at line 80 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().

81  {
83  if (m_isParent) w += iconWidth();
84  return w;
85  }
const double w
Definition: UKUtility.cc:23
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing

Member Data Documentation

bool FWTextTreeCellRenderer::m_blackIcon
private

Definition at line 147 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

TGTextEntry* FWTextTreeCellRenderer::m_editor
private

Definition at line 143 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

int FWTextTreeCellRenderer::m_indentation
private

Definition at line 142 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_isOpen
private

Definition at line 146 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

bool FWTextTreeCellRenderer::m_isParent
private

Definition at line 145 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_showEditor
private

Definition at line 144 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().