Logo Search packages:      
Sourcecode: facturalux version File versions  Download package

mreportobject.cpp

/***************************************************************************
              mreportobject.cpp  -  Kugar report object baseclass
              -------------------
    begin     : Wed Aug 11 1999
    copyright : (C) 1999 by Mutiny Bay Software
    email     : info@mutinybaysoftware.com
 ***************************************************************************/

#include "mreportobject.h"

/** Constructor */
00012 MReportObject::MReportObject ():QObject ()
{
  // Set the object's default geometry
  xpos = 0;
  ypos = 0;
  width = 40;
  height = 23;

  // Set the object's default colors
  backgroundColor.setRgb (255, 255, 255);
  foregroundColor.setRgb (0, 0, 0);

  // Set the object's default border attributes
  borderColor.setRgb (0, 0, 0);
  borderWidth = 1;
  borderStyle = MReportObject::SolidLine;
}

/** Copy constructor */
00031 MReportObject::MReportObject (const MReportObject & mReportObject)
{                                               /*: QObject((QObject &) mReportObject) */
  copy (&mReportObject);
}

/** Assignment operator */
00037 MReportObject MReportObject::operator= (const MReportObject & mReportObject)
{
  if (&mReportObject == this)
      return *this;

  // Copy the derived class's data
  copy (&mReportObject);

  // Copy the base class's data
  //((QObject &) *this) = mReportObject;

  return *this;
}

/** Destructor */
00052 MReportObject::~MReportObject ()
{
}

/** Draws the object to the specified painter & x/y offsets */
void
00058 MReportObject::draw (QPainter * p, int xoffset, int yoffset)
{
  drawBase (p, xoffset, yoffset);
}

/** Draws the base object to the specified painter & x/y offsets */
void
00065 MReportObject::drawBase (QPainter * p, int xoffset, int yoffset)
{
  QBrush bgBrush (backgroundColor);
  QPen borderPen (borderColor, borderWidth, (QPen::PenStyle) borderStyle);

  // Set the offsets
  int xcalc = xpos + xoffset;
  int ycalc = ypos + yoffset;

  // Set background in specified color
  p->setBrush (bgBrush);
  p->setPen (borderPen);
  p->drawRect (xcalc, ycalc, width, height);

  // Set border
  if (borderStyle != 0)
      {
        p->setPen (borderPen);
        p->drawRect (xcalc, ycalc, width, height);
      }
  else
      {
        p->setPen (QPen (QColor (255, 255, 255), 1, QPen::SolidLine));
        p->drawRect (xcalc, ycalc, width, height);
      }
}

/** Set the object's position and size */
void
00094 MReportObject::setGeometry (int x, int y, int w, int h)
{
  xpos = x;
  ypos = y;
  width = w;
  height = h;
}

/** Set the object's position */
void
00104 MReportObject::move (int x, int y)
{
  xpos = x;
  ypos = y;
}

/** Gets the object's x position */
int
00112 MReportObject::getX ()
{
  return xpos;
}

/** Gets the object's y position */
int
00119 MReportObject::getY ()
{
  return ypos;
}

/** Sets the object's background color */
void
00126 MReportObject::setBackgroundColor (int r, int g, int b)
{
  backgroundColor.setRgb (r, g, b);
}

/** Sets the object's foreground color */
void
00133 MReportObject::setForegroundColor (int r, int g, int b)
{
  foregroundColor.setRgb (r, g, b);
}

/** Sets the object's border color */
void
00140 MReportObject::setBorderColor (int r, int g, int b)
{
  borderColor.setRgb (r, g, b);
}

/** Sets the object's border width */
void
00147 MReportObject::setBorderWidth (int width)
{
  borderWidth = width;
}

/** Sets the object's border style */
void
00154 MReportObject::setBorderStyle (int style)
{
  borderStyle = style;
}

/** Copies member data from one object to another.
    Used by the copy constructor and assignment operator */
void
00162 MReportObject::copy (const MReportObject * mReportObject)
{
  // Copy the object's geometry
  xpos = mReportObject->xpos;
  ypos = mReportObject->ypos;
  width = mReportObject->width;
  height = mReportObject->height;

  // Copy the colors
  backgroundColor = mReportObject->backgroundColor;
  foregroundColor = mReportObject->foregroundColor;

  // Copy the border attributes
  borderColor = mReportObject->borderColor;
  borderWidth = mReportObject->borderWidth;
  borderStyle = mReportObject->borderStyle;
}

Generated by  Doxygen 1.6.0   Back to index