CMS 3D CMS Logo

FWCollectionSummaryModelCellRenderer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWCollectionSummaryModelCellRenderer
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Wed Feb 25 10:03:23 CST 2009
11 //
12 
13 // system include files
14 #include "TVirtualX.h"
15 #include "TGClient.h"
16 
17 // user include files
19 
22 
24 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 static const unsigned int kIconSize = 10;
33 static const unsigned int kSeparation = 2;
34 //
35 // constructors and destructor
36 //
38  : FWTextTableCellRenderer(iGC, iSelectContext),
39  m_colorBox(new FWColorBoxIcon(kIconSize)),
40  m_checkBox(new FWCheckBoxIcon(kIconSize)) {
41  GCValues_t t = *(iGC->GetAttributes());
42  m_colorContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t, kTRUE);
44 }
45 
46 // FWCollectionSummaryModelCellRenderer::FWCollectionSummaryModelCellRenderer(const FWCollectionSummaryModelCellRenderer& rhs)
47 // {
48 // // do actual copying here;
49 // }
50 
52  delete m_colorBox;
53  delete m_checkBox;
54  gClient->GetResourcePool()->GetGCPool()->FreeGC(m_colorContext->GetGC());
55 }
56 
57 //
58 // assignment operators
59 //
60 // const FWCollectionSummaryModelCellRenderer& FWCollectionSummaryModelCellRenderer::operator=(const FWCollectionSummaryModelCellRenderer& rhs)
61 // {
62 // //An exception safe implementation is
63 // FWCollectionSummaryModelCellRenderer temp(rhs);
64 // swap(rhs);
65 //
66 // return *this;
67 // }
68 
69 //
70 // member functions
71 //
75 }
76 
78  Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) {
79  int dY = (iHeight - kIconSize) / 2;
80  m_checkBox->draw(iID, graphicsContext()->GetGC(), iX, iY + dY);
81  m_colorBox->draw(iID, graphicsContext()->GetGC(), iX + kIconSize + kSeparation, iY + dY);
84  iY,
86  iHeight);
87  return;
88 }
89 
91  FWEventItem::ModelInfo mi = iItem->modelInfo(iIndex);
94  m_colorContext->SetForeground(gVirtualX->GetPixel(mi.displayProperties().color()));
95 }
96 
97 //
98 // const member functions
99 //
101  if (iY < 0 || iY > static_cast<int>(kIconSize)) {
102  return kMiss;
103  }
104  if (iX >= 0 && iX <= static_cast<int>(kIconSize)) {
105  return kHitCheck;
106  }
107  if (iX >= static_cast<int>(kIconSize + kSeparation) && iX <= static_cast<int>(kIconSize + kSeparation + kIconSize)) {
108  return kHitColor;
109  }
110  return kMiss;
111 }
112 
113 //
114 // static member functions
115 //
FWTextTableCellRenderer::draw
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
Definition: FWTextTableCellRenderer.cc:66
FWCollectionSummaryModelCellRenderer::kHitColor
Definition: FWCollectionSummaryModelCellRenderer.h:36
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
FWDisplayProperties::isVisible
bool isVisible() const
Definition: FWDisplayProperties.h:51
FWCollectionSummaryModelCellRenderer::m_colorBox
FWColorBoxIcon * m_colorBox
Definition: FWCollectionSummaryModelCellRenderer.h:56
FWTextTableCellRenderer::graphicsContext
const TGGC * graphicsContext() const
Definition: FWTextTableCellRenderer.h:45
FWCheckBoxIcon.h
FWTextTableCellRenderer
Definition: FWTextTableCellRenderer.h:32
FWCheckBoxIcon
Definition: FWCheckBoxIcon.h:28
FWDisplayProperties::color
Color_t color() const
Definition: FWDisplayProperties.h:47
kSeparation
static const unsigned int kSeparation
Definition: FWCollectionSummaryModelCellRenderer.cc:33
FWCollectionSummaryModelCellRenderer::draw
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
Definition: FWCollectionSummaryModelCellRenderer.cc:77
FWBoxIconBase::draw
void draw(Drawable_t iID, GContext_t iContext, int iX, int iY) const
Definition: FWBoxIconBase.cc:58
FWEventItem::ModelInfo
Definition: FWEventItem.h:58
FWCollectionSummaryModelCellRenderer.h
kIconSize
static const unsigned int kIconSize
Definition: FWCollectionSummaryModelCellRenderer.cc:32
FWTextTableCellRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWTextTableCellRenderer.cc:113
w
const double w
Definition: UKUtility.cc:23
FWCollectionSummaryModelCellRenderer::~FWCollectionSummaryModelCellRenderer
~FWCollectionSummaryModelCellRenderer() override
Definition: FWCollectionSummaryModelCellRenderer.cc:51
FWCollectionSummaryModelCellRenderer::setData
void setData(const FWEventItem *iItem, int iIndex)
Definition: FWCollectionSummaryModelCellRenderer.cc:90
FWCollectionSummaryModelCellRenderer::kMiss
Definition: FWCollectionSummaryModelCellRenderer.h:36
FWCollectionSummaryModelCellRenderer::FWCollectionSummaryModelCellRenderer
FWCollectionSummaryModelCellRenderer(const TGGC *iContext, const TGGC *iSelectContext)
Definition: FWCollectionSummaryModelCellRenderer.cc:37
FWEventItem::modelName
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:471
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition: FWEventItem.h:65
FWCollectionSummaryModelCellRenderer::clickHit
ClickHit clickHit(int iX, int iY) const
Definition: FWCollectionSummaryModelCellRenderer.cc:100
FWCollectionSummaryModelCellRenderer::m_colorContext
TGGC * m_colorContext
Definition: FWCollectionSummaryModelCellRenderer.h:58
FWEventItem.h
FWEventItem::ModelInfo::displayProperties
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
FWTextTableCellRenderer::setData
void setData(const std::string &, bool isSelected)
Definition: FWTextTableCellRenderer.cc:98
FWColorBoxIcon.h
FWCollectionSummaryModelCellRenderer::kHitCheck
Definition: FWCollectionSummaryModelCellRenderer.h:36
FWEventItem
Definition: FWEventItem.h:56
FWColorBoxIcon
Definition: FWColorBoxIcon.h:28
FWCollectionSummaryModelCellRenderer::ClickHit
ClickHit
Definition: FWCollectionSummaryModelCellRenderer.h:36
FWColorBoxIcon::setColor
void setColor(GContext_t iColorContext)
Definition: FWColorBoxIcon.h:38
FWCollectionSummaryModelCellRenderer::m_checkBox
FWCheckBoxIcon * m_checkBox
Definition: FWCollectionSummaryModelCellRenderer.h:57
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
FWCheckBoxIcon::setChecked
void setChecked(bool iChecked)
Definition: FWCheckBoxIcon.h:40
FWCollectionSummaryModelCellRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWCollectionSummaryModelCellRenderer.cc:72