CMS 3D CMS Logo

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 // constants, enums and typedefs
21 //
22 
23 //
24 // static data member definitions
25 //
26 
27 //
28 // constructors and destructor
29 //
31  : FWTextTableCellRenderer(iContext), m_isChecked(false) {}
32 
33 // FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const FWCheckedTextTableCellRenderer& rhs)
34 // {
35 // // do actual copying here;
36 // }
37 
39 
40 //
41 // assignment operators
42 //
43 // const FWCheckedTextTableCellRenderer& FWCheckedTextTableCellRenderer::operator=(const FWCheckedTextTableCellRenderer& rhs)
44 // {
45 // //An exception safe implementation is
46 // FWCheckedTextTableCellRenderer temp(rhs);
47 // swap(rhs);
48 //
49 // return *this;
50 // }
51 
52 //
53 // member functions
54 //
55 void FWCheckedTextTableCellRenderer::setChecked(bool iChecked) { m_isChecked = iChecked; }
56 
57 void FWCheckedTextTableCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) {
58  const UInt_t h = height();
59 
60  //draw the check box
61  GContext_t c = graphicsContext()->GetGC();
62  gVirtualX->DrawLine(iID, c, iX, iY, iX, iY + h);
63  gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX, iY + h);
64  gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX + h, iY);
65  gVirtualX->DrawLine(iID, c, iX + h, iY, iX, iY);
66 
67  if (m_isChecked) {
68  gVirtualX->DrawLine(iID, c, iX, iY + h / 2, iX + h / 2, iY + h);
69  gVirtualX->DrawLine(iID, c, iX + h, iY, iX + h / 2, iY + h);
70  }
71  FWTextTableCellRenderer::draw(iID, iX + kGap + h, iY, iWidth - kGap - h, iHeight);
72 }
73 
74 void FWCheckedTextTableCellRenderer::buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY) {
75  const int h = height();
76 
77  bool wasClicked =
78  iClickEvent->fType == kButtonRelease && iRelClickX >= 0 && iRelClickX <= h && iRelClickY >= 0 && iRelClickY <= h;
79  if (wasClicked) {
80  //std::cout <<"clicked"<<std::endl;
82  }
83 }
84 
85 void FWCheckedTextTableCellRenderer::checkBoxClicked() { Emit("checkBoxClicked()"); }
86 
87 //
88 // const member functions
89 //
91 
93  UInt_t h = height();
95 }
96 
97 //
98 // static member functions
99 //
FWCheckedTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()))
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
UInt_t height() const override
returns the minimum height of the cell to which the renderer is representing
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
const TGGC * graphicsContext() const
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
ClassImp(FWCheckedTextTableCellRenderer)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
void buttonEvent(Event_t *iClickEvent, int iRelClickX, int iRelClickY) override