CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

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)
 
 FWTextTableCellRenderer (const FWTextTableCellRenderer &)=delete
 
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
 
const FWTextTableCellRendereroperator= (const FWTextTableCellRenderer &)=delete
 
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 ()
 
 FWTableCellRendererBase (const FWTableCellRendererBase &)=delete
 
const FWTableCellRendererBaseoperator= (const FWTableCellRendererBase &)=delete
 
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 17 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.

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) {}
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 44 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw().

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  }
static const TString & coreIcondir()
static const TString& FWTextTreeCellRenderer::coreIcondir ( )
inlinestatic

Definition at line 34 of file FWTextTreeCellRenderer.h.

References cms::cuda::assert(), and fed_dqm_sourceclient-live_cfg::path.

Referenced by closedImage(), and openedImage().

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  }
assert(be >=bs)
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.

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, PostProcessorHGCAL_cfi::metrics, openedImage(), s_iconOffset, FWTextTableCellRenderer::selected(), findQualityFiles::size, and phase1PixelTopology::xOffset.

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  }
static const TGPicture * closedImage(bool isBlack=true)
const edm::EventSetup & c
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
tuple size
Write out results.
static int FWTextTreeCellRenderer::iconWidth ( )
inlinestatic

Definition at line 58 of file FWTextTreeCellRenderer.h.

References openedImage(), and s_iconOffset.

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

58 { 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 51 of file FWTextTreeCellRenderer.h.

References coreIcondir().

Referenced by draw(), and iconWidth().

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

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

68  {
70  if (m_isParent)
71  w += iconWidth();
72  return w;
73  }
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
T w() const

Member Data Documentation

bool FWTextTreeCellRenderer::m_blackIcon
private

Definition at line 140 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setBlackIcon().

TGTextEntry* FWTextTreeCellRenderer::m_editor
private

Definition at line 136 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setCellEditor().

int FWTextTreeCellRenderer::m_indentation
private

Definition at line 135 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_isOpen
private

Definition at line 139 of file FWTextTreeCellRenderer.h.

Referenced by draw(), and setIsOpen().

bool FWTextTreeCellRenderer::m_isParent
private

Definition at line 138 of file FWTextTreeCellRenderer.h.

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

bool FWTextTreeCellRenderer::m_showEditor
private

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