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 // $Id: FWCheckedTextTableCellRenderer.cc,v 1.3 2009/03/23 19:08:16 amraktad Exp $
12 //
13 
14 // system include files
15 #include "TVirtualX.h"
16 
17 // user include files
19 
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
33 FWTextTableCellRenderer(iContext),
34 m_isChecked(false) {}
35 
36 // FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const FWCheckedTextTableCellRenderer& rhs)
37 // {
38 // // do actual copying here;
39 // }
40 
42 {
43 }
44 
45 //
46 // assignment operators
47 //
48 // const FWCheckedTextTableCellRenderer& FWCheckedTextTableCellRenderer::operator=(const FWCheckedTextTableCellRenderer& rhs)
49 // {
50 // //An exception safe implementation is
51 // FWCheckedTextTableCellRenderer temp(rhs);
52 // swap(rhs);
53 //
54 // return *this;
55 // }
56 
57 //
58 // member functions
59 //
61  m_isChecked = iChecked;
62 }
63 
64 void
65 FWCheckedTextTableCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
66 {
67  const UInt_t h = height();
68 
69  //draw the check box
70  GContext_t c = graphicsContext()->GetGC();
71  gVirtualX->DrawLine(iID,c,iX,iY,iX,iY+h);
72  gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX,iY+h);
73  gVirtualX->DrawLine(iID,c,iX+h,iY+h,iX+h,iY);
74  gVirtualX->DrawLine(iID,c,iX+h,iY,iX,iY);
75 
76  if(m_isChecked) {
77  gVirtualX->DrawLine(iID,c,iX,iY+h/2,iX+h/2,iY+h);
78  gVirtualX->DrawLine(iID,c,iX+h,iY,iX+h/2,iY+h);
79  }
80  FWTextTableCellRenderer::draw(iID,iX+kGap+h,iY,iWidth-kGap-h,iHeight);
81 }
82 
83 void
84 FWCheckedTextTableCellRenderer::buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY)
85 {
86  const int h = height();
87 
88  bool wasClicked = iClickEvent->fType==kButtonRelease &&
89  iRelClickX >=0 &&
90  iRelClickX <=h &&
91  iRelClickY >=0 &&
92  iRelClickY <=h;
93  if(wasClicked) {
94  //std::cout <<"clicked"<<std::endl;
96  }
97 }
98 
99 void
101 {
102  Emit("checkBoxClicked()");
103 }
104 
105 //
106 // const member functions
107 //
109 {
110  return m_isChecked;
111 }
112 
114 {
115  UInt_t h = height();
117 }
118 
119 
120 //
121 // static member functions
122 //
124 
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)
const TGGC * graphicsContext() const
unsigned int UInt_t
Definition: FUTypes.h:12
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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)