CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
30 const TGPicture* checkImage()
31 {
32  static const TGPicture* s_picture=gClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"check-mark.png");
33  return s_picture;
34 }
35 
36 //
37 // constructors and destructor
38 //
39 FWCheckBoxIcon::FWCheckBoxIcon(unsigned int iEdgeLength):
40 FWBoxIconBase(iEdgeLength),
41 m_checked(false)
42 {
43 }
44 
45 // FWCheckBoxIcon::FWCheckBoxIcon(const FWCheckBoxIcon& rhs)
46 // {
47 // // do actual copying here;
48 // }
49 
51 {
52 }
53 
54 //
55 // assignment operators
56 //
57 // const FWCheckBoxIcon& FWCheckBoxIcon::operator=(const FWCheckBoxIcon& rhs)
58 // {
59 // //An exception safe implementation is
60 // FWCheckBoxIcon temp(rhs);
61 // swap(rhs);
62 //
63 // return *this;
64 // }
65 
66 //
67 // member functions
68 //
69 
70 //
71 // const member functions
72 //
73 void
74 FWCheckBoxIcon::drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const
75 {
76  if(m_checked) {
77  int xOffset = (iSize - checkImage()->GetWidth()) /2;
78  int yOffset = (iSize - checkImage()->GetHeight())/2;
79  checkImage()->Draw(iID,iContext,iX+xOffset,iY+yOffset);
80  }
81 }
82 
83 //
84 // static member functions
85 //
86 const TString& FWCheckBoxIcon::coreIcondir() {
87  static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
88  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
89  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
90  path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
91  }
92 
93  return path;
94 }
static const TString & coreIcondir()
virtual ~FWCheckBoxIcon()
assert(m_qm.get())
FWCheckBoxIcon(unsigned int iEdgeLength)
static const TGPicture * checkImage()
void drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const
volatile std::atomic< bool > shutdown_flag false