CMS 3D CMS Logo

FWCheckBoxIcon.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWCheckBoxIcon
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Feb 19 16:25:17 CST 2009
11 //
12 
13 // system include files
14 #include "TGPicture.h"
15 #include "TGClient.h"
16 #include "TSystem.h"
17 #include <cassert>
18 
19 // user include files
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 static const TGPicture* checkImage() {
30  static const TGPicture* s_picture = gClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "check-mark.png");
31  return s_picture;
32 }
33 
34 //
35 // constructors and destructor
36 //
37 FWCheckBoxIcon::FWCheckBoxIcon(unsigned int iEdgeLength) : FWBoxIconBase(iEdgeLength), m_checked(false) {}
38 
39 // FWCheckBoxIcon::FWCheckBoxIcon(const FWCheckBoxIcon& rhs)
40 // {
41 // // do actual copying here;
42 // }
43 
45 
46 //
47 // assignment operators
48 //
49 // const FWCheckBoxIcon& FWCheckBoxIcon::operator=(const FWCheckBoxIcon& rhs)
50 // {
51 // //An exception safe implementation is
52 // FWCheckBoxIcon temp(rhs);
53 // swap(rhs);
54 //
55 // return *this;
56 // }
57 
58 //
59 // member functions
60 //
61 
62 //
63 // const member functions
64 //
65 void FWCheckBoxIcon::drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const {
66  if (m_checked) {
67  int xOffset = (iSize - checkImage()->GetWidth()) / 2;
68  int yOffset = (iSize - checkImage()->GetHeight()) / 2;
69  checkImage()->Draw(iID, iContext, iX + xOffset, iY + yOffset);
70  }
71 }
72 
73 //
74 // static member functions
75 //
76 const TString& FWCheckBoxIcon::coreIcondir() {
77  static TString path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_BASE"));
78  if (gSystem->AccessPathName(path.Data())) { // cannot find directory
79  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
80  path = Form("%s/src/Fireworks/Core/icons/", gSystem->Getenv("CMSSW_RELEASE_BASE"));
81  }
82 
83  return path;
84 }
FWCheckBoxIcon::~FWCheckBoxIcon
~FWCheckBoxIcon() override
Definition: FWCheckBoxIcon.cc:44
FWCheckBoxIcon::coreIcondir
static const TString & coreIcondir()
Definition: FWCheckBoxIcon.cc:76
funct::false
false
Definition: Factorize.h:29
FWCheckBoxIcon.h
cms::cuda::assert
assert(be >=bs)
FWCheckBoxIcon::drawInsideBox
void drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const override
Definition: FWCheckBoxIcon.cc:65
checkImage
static const TGPicture * checkImage()
Definition: FWCheckBoxIcon.cc:29
FWCheckBoxIcon::FWCheckBoxIcon
FWCheckBoxIcon(unsigned int iEdgeLength)
Definition: FWCheckBoxIcon.cc:37
phase1PixelTopology::xOffset
constexpr int16_t xOffset
Definition: phase1PixelTopology.h:19
phase1PixelTopology::yOffset
constexpr int16_t yOffset
Definition: phase1PixelTopology.h:20
FWBoxIconBase
Definition: FWBoxIconBase.h:28
FWCheckBoxIcon::m_checked
bool m_checked
Definition: FWCheckBoxIcon.h:50
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37