CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCheckedTextTableCellRenderer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TableWidget
4 // Class : FWCheckedTextTableCellRenderer
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Feb 3 14:29:51 EST 2009
11 //
12 
13 // system include files
14 #include "TVirtualX.h"
15 
16 // user include files
18 
19 
20 //
21 // constants, enums and typedefs
22 //
23 
24 //
25 // static data member definitions
26 //
27 
28 //
29 // constructors and destructor
30 //
32 FWTextTableCellRenderer(iContext),
33 m_isChecked(false) {}
34 
35 // FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const FWCheckedTextTableCellRenderer& rhs)
36 // {
37 // // do actual copying here;
38 // }
39 
41 {
42 }
43 
44 //
45 // assignment operators
46 //
47 // const FWCheckedTextTableCellRenderer& FWCheckedTextTableCellRenderer::operator=(const FWCheckedTextTableCellRenderer& rhs)
48 // {
49 // //An exception safe implementation is
50 // FWCheckedTextTableCellRenderer temp(rhs);
51 // swap(rhs);
52 //
53 // return *this;
54 // }
55 
56 //
57 // member functions
58 //
60  m_isChecked = iChecked;
61 }
62 
63 void
64 FWCheckedTextTableCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
65 {
66  const UInt_t h = height();
67 
68  //draw the check box
69  GContext_t c = graphicsContext()->GetGC();
70  gVirtualX->DrawLine(iID,c,iX,iY,iX,iY+h);
71  gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX,iY+h);
72  gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX+h,iY);
73  gVirtualX->DrawLine(iID,c,iX+h,iY,iX,iY);
74 
75  if(m_isChecked) {
76  gVirtualX->DrawLine(iID,c,iX,iY+h/2,iX+h/2,iY+h);
77  gVirtualX->DrawLine(iID,c,iX+h,iY,iX+h/2,iY+h);
78  }
79  FWTextTableCellRenderer::draw(iID,iX+kGap+h,iY,iWidth-kGap-h,iHeight);
80 }
81 
82 void
83 FWCheckedTextTableCellRenderer::buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY)
84 {
85  const int h = height();
86 
87  bool wasClicked = iClickEvent->fType==kButtonRelease &&
88  iRelClickX >=0 &&
89  iRelClickX <=h &&
90  iRelClickY >=0 &&
91  iRelClickY <=h;
92  if(wasClicked) {
93  //std::cout <<"clicked"<<std::endl;
95  }
96 }
97 
98 void
100 {
101  Emit("checkBoxClicked()");
102 }
103 
104 //
105 // const member functions
106 //
108 {
109  return m_isChecked;
110 }
111 
113 {
114  UInt_t h = height();
116 }
117 
118 
119 //
120 // static member functions
121 //
123 
FWCheckedTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()))
virtual UInt_t height() const
returns the minimum height 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)
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
virtual void buttonEvent(Event_t *iClickEvent, int iRelClickX, int iRelClickY)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const TGGC * graphicsContext() const
volatile std::atomic< bool > shutdown_flag false
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)