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

24  : FWTextTableCellRenderer(iContext, iHighlightContext, iJustify),
25  m_indentation(0),
26  m_editor(nullptr),
27  m_showEditor(false),
28  m_isParent(false),
29  m_isOpen(false),
30  m_blackIcon(true) {}
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 43 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

43  {
44  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir() + "arrow-white-right-blackbg.png");
45  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir() + "arrow-black-right.png");
46 
47  return isBlack ? s_picture_black : s_picture_white;
48  }
static const TString & coreIcondir()
static const TString& FWTextTreeCellRenderer::coreIcondir ( )
inlinestatic

Definition at line 33 of file FWTextTreeCellRenderer.h.

References castor_dqm_sourceclient_file_cfg::path.

Referenced by closedImage(), and openedImage().

33  {
34  static TString path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_BASE"));
35  if (gSystem->AccessPathName(path.Data())) { // cannot find directory
36  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
37  path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_RELEASE_BASE"));
38  }
39 
40  return path;
41  }
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 74 of file FWTextTreeCellRenderer.h.

References HltBtagPostValidation_cff::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().

74  {
75  if (m_showEditor && m_editor) {
76  // printf("renderer draw editor %d %d %d %d \n", iX, iY, m_editor->GetWidth(), m_editor->GetHeight());
77 
78  // fill to cover buffer offset
79  static TGGC editGC(FWTextTableCellRenderer::getDefaultGC());
80  editGC.SetForeground(m_editor->GetBackground());
81  gVirtualX->FillRectangle(iID,
82  editGC(),
85  iWidth + 2 * FWTabularWidget::kTextBuffer,
86  iHeight + 2 * FWTabularWidget::kTextBuffer);
87 
88  if (iY > -2) {
89  // redraw editor
90  if (!m_editor->IsMapped()) {
91  m_editor->MapWindow();
92  m_editor->SetFocus();
93  }
94  m_editor->MoveResize(iX, iY, m_editor->GetWidth(), m_editor->GetHeight());
95  m_editor->SetCursorPosition(data().size());
96  gClient->NeedRedraw(m_editor);
97 
98  return;
99  } else {
100  // hide editor if selected entry scrolled away
101  if (m_editor->IsMapped())
102  m_editor->UnmapWindow();
103  }
104  }
105 
106  if (selected()) {
107  GContext_t c = highlightContext()->GetGC();
108  gVirtualX->FillRectangle(iID,
109  c,
112  iWidth + 2 * FWTabularWidget::kTextBuffer,
113  iHeight + 2 * FWTabularWidget::kTextBuffer);
114  }
115  int xOffset = 0;
116  if (m_isParent) {
117  const TGPicture* img = m_isOpen ? openedImage(m_blackIcon) : closedImage(m_blackIcon);
118  img->Draw(iID, graphicsContext()->GetGC(), m_indentation + iX, iY + 2);
119  xOffset += img->GetWidth() + s_iconOffset;
120  }
121 
122  FontMetrics_t metrics;
123  font()->GetFontMetrics(&metrics);
124 
125  gVirtualX->DrawString(iID,
126  graphicsContext()->GetGC(),
127  iX + m_indentation + xOffset,
128  iY + metrics.fAscent,
129  data().c_str(),
130  data().size());
131  }
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 57 of file FWTextTreeCellRenderer.h.

References openedImage(), and s_iconOffset.

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

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

Definition at line 50 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

50  {
51  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir() + "arrow-white-down-blackbg.png");
52  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir() + "arrow-black-down.png");
53 
54  return isBlack ? s_picture_black : s_picture_white;
55  }
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 67 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::drawPortLines(), Vispa.Gui.ConnectableWidget.ConnectableWidget::drawPortNames(), Vispa.Gui.VispaWidget.VispaWidget::imageRectF(), Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget(), Vispa.Gui.VispaWidget.VispaWidget::resize(), Vispa.Views.PropertyView.PropertyView::resizeEvent(), Vispa.Views.PropertyView.PropertyView::sectionResized(), Vispa.Gui.VispaWidget.VispaWidget::setZoom(), and Vispa.Main.MainWindow.MainWindow::updateStartupScreenGeometry().

67  {
69  if (m_isParent)
70  w += iconWidth();
71  return w;
72  }
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 139 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

TGTextEntry* FWTextTreeCellRenderer::m_editor
private

Definition at line 135 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

int FWTextTreeCellRenderer::m_indentation
private

Definition at line 134 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_isOpen
private

Definition at line 138 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

bool FWTextTreeCellRenderer::m_isParent
private

Definition at line 137 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_showEditor
private

Definition at line 136 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and showEditor().

const int FWTextTreeCellRenderer::s_iconOffset = 2
staticprotected

Definition at line 18 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and iconWidth().