test
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 //
12 
13 // system include files
14 #include "TVirtualX.h"
15 #include "TGClient.h"
16 
17 // user include files
19 
22 
24 
25 
26 //
27 // constants, enums and typedefs
28 //
29 
30 //
31 // static data member definitions
32 //
33 static const unsigned int kIconSize = 10;
34 static const unsigned int kSeparation = 2;
35 //
36 // constructors and destructor
37 //
39 FWTextTableCellRenderer(iGC,iSelectContext),
40 m_colorBox( new FWColorBoxIcon(kIconSize)),
41 m_checkBox( new FWCheckBoxIcon(kIconSize))
42 {
43  GCValues_t t = *(iGC->GetAttributes());
44  m_colorContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
46 }
47 
48 // FWCollectionSummaryModelCellRenderer::FWCollectionSummaryModelCellRenderer(const FWCollectionSummaryModelCellRenderer& rhs)
49 // {
50 // // do actual copying here;
51 // }
52 
54 {
55  delete m_colorBox;
56  delete m_checkBox;
57  gClient->GetResourcePool()->GetGCPool()->FreeGC(m_colorContext->GetGC());
58 }
59 
60 //
61 // assignment operators
62 //
63 // const FWCollectionSummaryModelCellRenderer& FWCollectionSummaryModelCellRenderer::operator=(const FWCollectionSummaryModelCellRenderer& rhs)
64 // {
65 // //An exception safe implementation is
66 // FWCollectionSummaryModelCellRenderer temp(rhs);
67 // swap(rhs);
68 //
69 // return *this;
70 // }
71 
72 //
73 // member functions
74 //
75 UInt_t
77 {
80 }
81 
82 void
83 FWCollectionSummaryModelCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
84 {
85  int dY = (iHeight-kIconSize)/2;
86  m_checkBox->draw(iID,graphicsContext()->GetGC(),iX,iY+dY);
87  m_colorBox->draw(iID,graphicsContext()->GetGC(),iX+kIconSize+kSeparation,iY+dY);
89  iWidth-kIconSize-kIconSize-kSeparation-kSeparation, iHeight);
90  return ;
91 }
92 
93 void
95 {
96  FWEventItem::ModelInfo mi = iItem->modelInfo(iIndex);
99  m_colorContext->SetForeground(gVirtualX->GetPixel(mi.displayProperties().color()));
100 }
101 
102 //
103 // const member functions
104 //
107 {
108  if(iY < 0 || iY > static_cast<int>(kIconSize)) { return kMiss;}
109  if(iX>=0 && iX<=static_cast<int>(kIconSize)) {return kHitCheck;}
110  if(iX>=static_cast<int>(kIconSize+kSeparation) && iX <=static_cast<int>(kIconSize+kSeparation+kIconSize)) { return kHitColor;}
111  return kMiss;
112 }
113 
114 //
115 // static member functions
116 //
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
const double w
Definition: UKUtility.cc:23
std::string modelName(int iIndex) const
Definition: FWEventItem.cc:574
bool isSelected() const
Definition: FWEventItem.h:70
FWCollectionSummaryModelCellRenderer(const TGGC *iContext, const TGGC *iSelectContext)
static const unsigned int kSeparation
Color_t color() const
return((rh^lh)&mask)
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)
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
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)