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 //
FWTextTableCellRenderer::draw
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
Definition: FWTextTableCellRenderer.cc:66
FWCheckedTextTableCellRenderer
Definition: FWCheckedTextTableCellRenderer.h:29
FWCheckedTextTableCellRenderer::draw
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
Definition: FWCheckedTextTableCellRenderer.cc:57
funct::false
false
Definition: Factorize.h:29
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
FWTextTableCellRenderer::graphicsContext
const TGGC * graphicsContext() const
Definition: FWTextTableCellRenderer.h:45
FWTextTableCellRenderer
Definition: FWTextTableCellRenderer.h:32
FWCheckedTextTableCellRenderer::checkBoxClicked
void checkBoxClicked()
Definition: FWCheckedTextTableCellRenderer.cc:85
FWCheckedTextTableCellRenderer::kGap
static const UInt_t kGap
Definition: FWCheckedTextTableCellRenderer.h:58
FWCheckedTextTableCellRenderer::isChecked
bool isChecked() const
Definition: FWCheckedTextTableCellRenderer.cc:90
FWTextTableCellRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWTextTableCellRenderer.cc:113
FWTextTableCellRenderer::height
UInt_t height() const override
returns the minimum height of the cell to which the renderer is representing
Definition: FWTextTableCellRenderer.cc:119
ClassImp
ClassImp(FWCheckedTextTableCellRenderer)
h
FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer
FWCheckedTextTableCellRenderer(const TGGC *iContext=&(getDefaultGC()))
Definition: FWCheckedTextTableCellRenderer.cc:30
FWCheckedTextTableCellRenderer::buttonEvent
void buttonEvent(Event_t *iClickEvent, int iRelClickX, int iRelClickY) override
Definition: FWCheckedTextTableCellRenderer.cc:74
FWCheckedTextTableCellRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWCheckedTextTableCellRenderer.cc:92
FWCheckedTextTableCellRenderer.h
FWCheckedTextTableCellRenderer::setChecked
void setChecked(bool)
Definition: FWCheckedTextTableCellRenderer.cc:55
FWCheckedTextTableCellRenderer::m_isChecked
bool m_isChecked
Definition: FWCheckedTextTableCellRenderer.h:59
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
FWCheckedTextTableCellRenderer::~FWCheckedTextTableCellRenderer
~FWCheckedTextTableCellRenderer() override
Definition: FWCheckedTextTableCellRenderer.cc:38