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 char *, bool isSelected)
 
void setData (const std::string &, 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

const static 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 17 of file FWTextTreeCellRenderer.h.

Constructor & Destructor Documentation

◆ FWTextTreeCellRenderer()

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

Definition at line 22 of file FWTextTreeCellRenderer.h.

25  : FWTextTableCellRenderer(iContext, iHighlightContext, iJustify),
26  m_indentation(0),
27  m_editor(nullptr),
28  m_showEditor(false),
29  m_isParent(false),
30  m_isOpen(false),
31  m_blackIcon(true) {}

Member Function Documentation

◆ closedImage()

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

Definition at line 44 of file FWTextTreeCellRenderer.h.

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

References coreIcondir().

Referenced by draw().

◆ coreIcondir()

static const TString& FWTextTreeCellRenderer::coreIcondir ( )
inlinestatic

Definition at line 34 of file FWTextTreeCellRenderer.h.

34  {
35  static TString path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_BASE"));
36  if (gSystem->AccessPathName(path.Data())) { // cannot find directory
37  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
38  path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_RELEASE_BASE"));
39  }
40 
41  return path;
42  }

References cms::cuda::assert(), and castor_dqm_sourceclient_file_cfg::path.

Referenced by closedImage(), and openedImage().

◆ draw()

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

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

References 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.

◆ iconWidth()

static int FWTextTreeCellRenderer::iconWidth ( )
inlinestatic

◆ openedImage()

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

Definition at line 51 of file FWTextTreeCellRenderer.h.

51  {
52  static const TGPicture* s_picture_white = gClient->GetPicture(coreIcondir() + "arrow-white-down-blackbg.png");
53  static const TGPicture* s_picture_black = gClient->GetPicture(coreIcondir() + "arrow-black-down.png");
54 
55  return isBlack ? s_picture_black : s_picture_white;
56  }

References coreIcondir().

Referenced by draw(), and iconWidth().

◆ setBlackIcon()

void FWTextTreeCellRenderer::setBlackIcon ( bool  value)
inline

◆ setCellEditor()

virtual void FWTextTreeCellRenderer::setCellEditor ( TGTextEntry *  editor)
inlinevirtual

◆ setIndentation()

virtual void FWTextTreeCellRenderer::setIndentation ( int  indentation = 0)
inlinevirtual

◆ setIsOpen()

void FWTextTreeCellRenderer::setIsOpen ( bool  value)
inline

◆ setIsParent()

void FWTextTreeCellRenderer::setIsParent ( bool  value)
inline

◆ showEditor()

virtual void FWTextTreeCellRenderer::showEditor ( bool  value)
inlinevirtual

◆ width()

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

68  {
70  if (m_isParent)
71  w += iconWidth();
72  return w;
73  }

References iconWidth(), m_indentation, m_isParent, w, and FWTextTableCellRenderer::width().

Member Data Documentation

◆ m_blackIcon

bool FWTextTreeCellRenderer::m_blackIcon
private

Definition at line 140 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

◆ m_editor

TGTextEntry* FWTextTreeCellRenderer::m_editor
private

Definition at line 136 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

◆ m_indentation

int FWTextTreeCellRenderer::m_indentation
private

Definition at line 135 of file FWTextTreeCellRenderer.h.

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

◆ m_isOpen

bool FWTextTreeCellRenderer::m_isOpen
private

Definition at line 139 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

◆ m_isParent

bool FWTextTreeCellRenderer::m_isParent
private

Definition at line 138 of file FWTextTreeCellRenderer.h.

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

◆ m_showEditor

bool FWTextTreeCellRenderer::m_showEditor
private

Definition at line 137 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and showEditor().

◆ s_iconOffset

const static int FWTextTreeCellRenderer::s_iconOffset = 2
staticprotected

Definition at line 19 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and iconWidth().

FWTextTreeCellRenderer::openedImage
static const TGPicture * openedImage(bool isBlack=true)
Definition: FWTextTreeCellRenderer.h:51
FWTextTableCellRenderer::FWTextTableCellRenderer
FWTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()), const TGGC *iHighlightContext=&(getDefaultHighlightGC()), Justify iJustify=kJustifyLeft)
Definition: FWTextTableCellRenderer.cc:34
FWTextTreeCellRenderer::s_iconOffset
const static int s_iconOffset
Definition: FWTextTreeCellRenderer.h:19
FWTextTableCellRenderer::graphicsContext
const TGGC * graphicsContext() const
Definition: FWTextTableCellRenderer.h:45
cms::cuda::assert
assert(be >=bs)
FWTextTreeCellRenderer::m_blackIcon
bool m_blackIcon
Definition: FWTextTreeCellRenderer.h:140
FWTabularWidget::kTextBuffer
static const int kTextBuffer
Definition: FWTabularWidget.h:35
FWTextTableCellRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWTextTableCellRenderer.cc:113
FWTextTreeCellRenderer::iconWidth
static int iconWidth()
Definition: FWTextTreeCellRenderer.h:58
FWTextTreeCellRenderer::closedImage
static const TGPicture * closedImage(bool isBlack=true)
Definition: FWTextTreeCellRenderer.h:44
w
const double w
Definition: UKUtility.cc:23
FWTextTableCellRenderer::selected
bool selected()
Definition: FWTextTableCellRenderer.h:60
FWTextTreeCellRenderer::m_editor
TGTextEntry * m_editor
Definition: FWTextTreeCellRenderer.h:136
FWTextTableCellRenderer::highlightContext
const TGGC * highlightContext() const
Definition: FWTextTableCellRenderer.h:46
FWTextTreeCellRenderer::m_isParent
bool m_isParent
Definition: FWTextTreeCellRenderer.h:138
FWTextTreeCellRenderer::m_isOpen
bool m_isOpen
Definition: FWTextTreeCellRenderer.h:139
FWTextTableCellRenderer::data
const std::string & data()
Definition: FWTextTableCellRenderer.h:56
FWTextTableCellRenderer::getDefaultGC
static const TGGC & getDefaultGC()
Definition: FWTextTableCellRenderer.cc:128
FWTextTreeCellRenderer::coreIcondir
static const TString & coreIcondir()
Definition: FWTextTreeCellRenderer.h:34
phase1PixelTopology::xOffset
constexpr int16_t xOffset
Definition: phase1PixelTopology.h:19
FWTextTableCellRenderer::font
const TGFont * font() const
Definition: FWTextTableCellRenderer.cc:123
relativeConstraints.value
value
Definition: relativeConstraints.py:53
printContent_cfi.indentation
indentation
Definition: printContent_cfi.py:10
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
FWTextTreeCellRenderer::m_indentation
int m_indentation
Definition: FWTextTreeCellRenderer.h:135
FWTextTreeCellRenderer::m_showEditor
bool m_showEditor
Definition: FWTextTreeCellRenderer.h:137
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443