CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
74  return w + kIconSize + kIconSize + kSeparation + kSeparation;
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 //
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
const double w
Definition: UKUtility.cc:23
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:471
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
bool isSelected() const
Definition: FWEventItem.h:65
FWCollectionSummaryModelCellRenderer(const TGGC *iContext, const TGGC *iSelectContext)
static const unsigned int kSeparation
Color_t color() const
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
void draw(Drawable_t iID, GContext_t iContext, int iX, int iY) const
static const unsigned int kIconSize
const TGGC * graphicsContext() const
void setChecked(bool iChecked)
void setData(const std::string &, bool isSelected)
void setData(const FWEventItem *iItem, int iIndex)
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
void setColor(GContext_t iColorContext)