R__dummyintdefault100_c

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
// -*- C++ -*-
//
// Package:     TableWidget
// Class  :     FWCheckedTextTableCellRenderer
//
// Implementation:
//     <Notes on implementation>
//
// Original Author:  Chris Jones
//         Created:  Tue Feb  3 14:29:51 EST 2009
//

// system include files
#include "TVirtualX.h"

// user include files
#include "Fireworks/TableWidget/interface/FWCheckedTextTableCellRenderer.h"

//
// constants, enums and typedefs
//

//
// static data member definitions
//

//
// constructors and destructor
//
FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const TGGC* iContext)
    : FWTextTableCellRenderer(iContext), m_isChecked(false) {}

// FWCheckedTextTableCellRenderer::FWCheckedTextTableCellRenderer(const FWCheckedTextTableCellRenderer& rhs)
// {
//    // do actual copying here;
// }

FWCheckedTextTableCellRenderer::~FWCheckedTextTableCellRenderer() {}

//
// assignment operators
//
// const FWCheckedTextTableCellRenderer& FWCheckedTextTableCellRenderer::operator=(const FWCheckedTextTableCellRenderer& rhs)
// {
//   //An exception safe implementation is
//   FWCheckedTextTableCellRenderer temp(rhs);
//   swap(rhs);
//
//   return *this;
// }

//
// member functions
//
void FWCheckedTextTableCellRenderer::setChecked(bool iChecked) { m_isChecked = iChecked; }

void FWCheckedTextTableCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) {
  const UInt_t h = height();

  //draw the check box
  GContext_t c = graphicsContext()->GetGC();
  gVirtualX->DrawLine(iID, c, iX, iY, iX, iY + h);
  gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX, iY + h);
  gVirtualX->DrawLine(iID, c, iX + h, iY + h, iX + h, iY);
  gVirtualX->DrawLine(iID, c, iX + h, iY, iX, iY);

  if (m_isChecked) {
    gVirtualX->DrawLine(iID, c, iX, iY + h / 2, iX + h / 2, iY + h);
    gVirtualX->DrawLine(iID, c, iX + h, iY, iX + h / 2, iY + h);
  }
  FWTextTableCellRenderer::draw(iID, iX + kGap + h, iY, iWidth - kGap - h, iHeight);
}

void FWCheckedTextTableCellRenderer::buttonEvent(Event_t* iClickEvent, int iRelClickX, int iRelClickY) {
  const int h = height();

  bool wasClicked =
      iClickEvent->fType == kButtonRelease && iRelClickX >= 0 && iRelClickX <= h && iRelClickY >= 0 && iRelClickY <= h;
  if (wasClicked) {
    //std::cout <<"clicked"<<std::endl;
    checkBoxClicked();
  }
}

void FWCheckedTextTableCellRenderer::checkBoxClicked() { Emit("checkBoxClicked()"); }

//
// const member functions
//
bool FWCheckedTextTableCellRenderer::isChecked() const { return m_isChecked; }

UInt_t FWCheckedTextTableCellRenderer::width() const {
  UInt_t h = height();
  return FWTextTableCellRenderer::width() + kGap + h;
}

//
// static member functions
//
ClassImp(FWCheckedTextTableCellRenderer);