CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 // $Id: FWCollectionSummaryModelCellRenderer.cc,v 1.1 2009/03/04 16:40:50 chrjones Exp $
12 //
13 
14 // system include files
15 #include "TVirtualX.h"
16 #include "TGClient.h"
17 
18 // user include files
20 
23 
25 
26 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 static const unsigned int kIconSize = 10;
35 static const unsigned int kSeparation = 2;
36 //
37 // constructors and destructor
38 //
40 FWTextTableCellRenderer(iGC,iSelectContext),
41 m_colorBox( new FWColorBoxIcon(kIconSize)),
42 m_checkBox( new FWCheckBoxIcon(kIconSize))
43 {
44  GCValues_t t = *(iGC->GetAttributes());
45  m_colorContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
47 }
48 
49 // FWCollectionSummaryModelCellRenderer::FWCollectionSummaryModelCellRenderer(const FWCollectionSummaryModelCellRenderer& rhs)
50 // {
51 // // do actual copying here;
52 // }
53 
55 {
56  delete m_colorBox;
57  delete m_checkBox;
58  gClient->GetResourcePool()->GetGCPool()->FreeGC(m_colorContext->GetGC());
59 }
60 
61 //
62 // assignment operators
63 //
64 // const FWCollectionSummaryModelCellRenderer& FWCollectionSummaryModelCellRenderer::operator=(const FWCollectionSummaryModelCellRenderer& rhs)
65 // {
66 // //An exception safe implementation is
67 // FWCollectionSummaryModelCellRenderer temp(rhs);
68 // swap(rhs);
69 //
70 // return *this;
71 // }
72 
73 //
74 // member functions
75 //
76 UInt_t
78 {
81 }
82 
83 void
84 FWCollectionSummaryModelCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
85 {
86  int dY = (iHeight-kIconSize)/2;
87  m_checkBox->draw(iID,graphicsContext()->GetGC(),iX,iY+dY);
88  m_colorBox->draw(iID,graphicsContext()->GetGC(),iX+kIconSize+kSeparation,iY+dY);
90  iWidth-kIconSize-kIconSize-kSeparation-kSeparation, iHeight);
91  return ;
92 }
93 
94 void
96 {
97  FWEventItem::ModelInfo mi = iItem->modelInfo(iIndex);
100  m_colorContext->SetForeground(gVirtualX->GetPixel(mi.displayProperties().color()));
101 }
102 
103 //
104 // const member functions
105 //
108 {
109  if(iY < 0 || iY > static_cast<int>(kIconSize)) { return kMiss;}
110  if(iX>=0 && iX<=static_cast<int>(kIconSize)) {return kHitCheck;}
111  if(iX>=static_cast<int>(kIconSize+kSeparation) && iX <=static_cast<int>(kIconSize+kSeparation+kIconSize)) { return kHitColor;}
112  return kMiss;
113 }
114 
115 //
116 // static member functions
117 //
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:575
bool isSelected() const
Definition: FWEventItem.h:71
FWCollectionSummaryModelCellRenderer(const TGGC *iContext, const TGGC *iSelectContext)
static const unsigned int kSeparation
Color_t color() const
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)
unsigned int UInt_t
Definition: FUTypes.h:12
void setData(const std::string &, bool isSelected)
void setData(const FWEventItem *iItem, int iIndex)
T w() const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:536
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
void setColor(GContext_t iColorContext)