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 // $Id: FWCheckBoxIcon.cc,v 1.5 2010/06/18 10:17:14 yana Exp $
12 //
13 
14 // system include files
15 #include "TGPicture.h"
16 #include "TGClient.h"
17 #include "TSystem.h"
18 #include <cassert>
19 
20 // user include files
22 
23 //
24 // constants, enums and typedefs
25 //
26 
27 //
28 // static data member definitions
29 //
30 static
31 const TGPicture* checkImage()
32 {
33  static const TGPicture* s_picture=gClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"check-mark.png");
34  return s_picture;
35 }
36 
37 //
38 // constructors and destructor
39 //
40 FWCheckBoxIcon::FWCheckBoxIcon(unsigned int iEdgeLength):
41 FWBoxIconBase(iEdgeLength),
42 m_checked(false)
43 {
44 }
45 
46 // FWCheckBoxIcon::FWCheckBoxIcon(const FWCheckBoxIcon& rhs)
47 // {
48 // // do actual copying here;
49 // }
50 
52 {
53 }
54 
55 //
56 // assignment operators
57 //
58 // const FWCheckBoxIcon& FWCheckBoxIcon::operator=(const FWCheckBoxIcon& rhs)
59 // {
60 // //An exception safe implementation is
61 // FWCheckBoxIcon temp(rhs);
62 // swap(rhs);
63 //
64 // return *this;
65 // }
66 
67 //
68 // member functions
69 //
70 
71 //
72 // const member functions
73 //
74 void
75 FWCheckBoxIcon::drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const
76 {
77  if(m_checked) {
78  int xOffset = (iSize - checkImage()->GetWidth()) /2;
79  int yOffset = (iSize - checkImage()->GetHeight())/2;
80  checkImage()->Draw(iID,iContext,iX+xOffset,iY+yOffset);
81  }
82 }
83 
84 //
85 // static member functions
86 //
87 const TString& FWCheckBoxIcon::coreIcondir() {
88  static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
89  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
90  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
91  path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
92  }
93 
94  return path;
95 }
static const TString & coreIcondir()
virtual ~FWCheckBoxIcon()
list path
Definition: scaleCards.py:51
FWCheckBoxIcon(unsigned int iEdgeLength)
static const TGPicture * checkImage()
void drawInsideBox(Drawable_t iID, GContext_t iContext, int iX, int iY, unsigned int iSize) const