Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "TVirtualX.h"
00016 #include "TGClient.h"
00017
00018
00019 #include "Fireworks/Core/src/FWCollectionSummaryModelCellRenderer.h"
00020
00021 #include "Fireworks/Core/src/FWColorBoxIcon.h"
00022 #include "Fireworks/Core/src/FWCheckBoxIcon.h"
00023
00024 #include "Fireworks/Core/interface/FWEventItem.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 static const unsigned int kIconSize = 10;
00035 static const unsigned int kSeparation = 2;
00036
00037
00038
00039 FWCollectionSummaryModelCellRenderer::FWCollectionSummaryModelCellRenderer(const TGGC* iGC, const TGGC* iSelectContext):
00040 FWTextTableCellRenderer(iGC,iSelectContext),
00041 m_colorBox( new FWColorBoxIcon(kIconSize)),
00042 m_checkBox( new FWCheckBoxIcon(kIconSize))
00043 {
00044 GCValues_t t = *(iGC->GetAttributes());
00045 m_colorContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
00046 m_colorBox->setColor(m_colorContext->GetGC());
00047 }
00048
00049
00050
00051
00052
00053
00054 FWCollectionSummaryModelCellRenderer::~FWCollectionSummaryModelCellRenderer()
00055 {
00056 delete m_colorBox;
00057 delete m_checkBox;
00058 gClient->GetResourcePool()->GetGCPool()->FreeGC(m_colorContext->GetGC());
00059 }
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 UInt_t
00077 FWCollectionSummaryModelCellRenderer::width() const
00078 {
00079 UInt_t w = FWTextTableCellRenderer::width();
00080 return w+kIconSize+kIconSize+kSeparation+kSeparation;
00081 }
00082
00083 void
00084 FWCollectionSummaryModelCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
00085 {
00086 int dY = (iHeight-kIconSize)/2;
00087 m_checkBox->draw(iID,graphicsContext()->GetGC(),iX,iY+dY);
00088 m_colorBox->draw(iID,graphicsContext()->GetGC(),iX+kIconSize+kSeparation,iY+dY);
00089 FWTextTableCellRenderer::draw(iID, iX+kIconSize+kIconSize+kSeparation+kSeparation, iY,
00090 iWidth-kIconSize-kIconSize-kSeparation-kSeparation, iHeight);
00091 return ;
00092 }
00093
00094 void
00095 FWCollectionSummaryModelCellRenderer::setData(const FWEventItem* iItem, int iIndex)
00096 {
00097 FWEventItem::ModelInfo mi = iItem->modelInfo(iIndex);
00098 FWTextTableCellRenderer::setData(iItem->modelName(iIndex),mi.isSelected());
00099 m_checkBox->setChecked(mi.displayProperties().isVisible());
00100 m_colorContext->SetForeground(gVirtualX->GetPixel(mi.displayProperties().color()));
00101 }
00102
00103
00104
00105
00106 FWCollectionSummaryModelCellRenderer::ClickHit
00107 FWCollectionSummaryModelCellRenderer::clickHit(int iX, int iY) const
00108 {
00109 if(iY < 0 || iY > static_cast<int>(kIconSize)) { return kMiss;}
00110 if(iX>=0 && iX<=static_cast<int>(kIconSize)) {return kHitCheck;}
00111 if(iX>=static_cast<int>(kIconSize+kSeparation) && iX <=static_cast<int>(kIconSize+kSeparation+kIconSize)) { return kHitColor;}
00112 return kMiss;
00113 }
00114
00115
00116
00117