File indexing completed on 2024-04-06 12:11:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "TVirtualX.h"
0015
0016
0017 #include "Fireworks/TableWidget/interface/FWCheckedTextTableCellRenderer.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const TGGC* iContext)
0031 : FWTextTableCellRenderer(iContext), m_isChecked(false) {}
0032
0033
0034
0035
0036
0037
0038 FWCheckedTextTableCellRenderer::~FWCheckedTextTableCellRenderer() {}
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 void FWCheckedTextTableCellRenderer::setChecked(bool iChecked) { m_isChecked = iChecked; }
0056
0057 void FWCheckedTextTableCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) {
0058 const UInt_t h = height();
0059
0060
0061 GContext_t c = graphicsContext()->GetGC();
0062 gVirtualX->DrawLine(iID, c, iX, iY, iX, iY + h);
0063 gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX, iY + h);
0064 gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX + h, iY);
0065 gVirtualX->DrawLine(iID, c, iX + h, iY, iX, iY);
0066
0067 if (m_isChecked) {
0068 gVirtualX->DrawLine(iID, c, iX, iY + h / 2, iX + h / 2, iY + h);
0069 gVirtualX->DrawLine(iID, c, iX + h, iY, iX + h / 2, iY + h);
0070 }
0071 FWTextTableCellRenderer::draw(iID, iX + kGap + h, iY, iWidth - kGap - h, iHeight);
0072 }
0073
0074 void FWCheckedTextTableCellRenderer::buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY) {
0075 const int h = height();
0076
0077 bool wasClicked =
0078 iClickEvent->fType == kButtonRelease && iRelClickX >= 0 && iRelClickX <= h && iRelClickY >= 0 && iRelClickY <= h;
0079 if (wasClicked) {
0080
0081 checkBoxClicked();
0082 }
0083 }
0084
0085 void FWCheckedTextTableCellRenderer::checkBoxClicked() { Emit("checkBoxClicked()"); }
0086
0087
0088
0089
0090 bool FWCheckedTextTableCellRenderer::isChecked() const { return m_isChecked; }
0091
0092 UInt_t FWCheckedTextTableCellRenderer::width() const {
0093 UInt_t h = height();
0094 return FWTextTableCellRenderer::width() + kGap + h;
0095 }
0096
0097
0098
0099
0100 ClassImp(FWCheckedTextTableCellRenderer);