home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / srcos2 / vbrush.cpp < prev    next >
C/C++ Source or Header  |  1999-01-11  |  3KB  |  104 lines

  1. //===============================================================
  2. // vbrush.cxx: vBrush class for drawing - Windows
  3. //
  4. // Copyright (C) 1995,1996,1997,1998  Bruce E. Wampler
  5. //
  6. // This file is part of the V C++ GUI Framework, and is covered
  7. // under the terms of the GNU Library General Public License,
  8. // Version 2. This library has NO WARRANTY. See the source file
  9. // vapp.cxx for more complete information about license terms.
  10. //===============================================================
  11. #include <v/vOS2.h>           // for OS/2 stuff
  12. #include <v/vapp.h>
  13. #include <v/vbrush.h>
  14. //=======================>>> vBrush::vBrush <<<===========================
  15.   vBrush::vBrush(unsigned int r, unsigned int g, unsigned int b,
  16.               int style, int fillMode)
  17.   {
  18.       brushColor._r = r, brushColor._g = g; brushColor._b = b;
  19.       brushColor._pixel = SETRGB(r,g,b);
  20.       brushStyle = style;
  21.       brushFillMode = fillMode;
  22.   }
  23. //=======================>>> vBrush::~vBrush <<<===========================
  24.   vBrush::~vBrush()
  25.   {
  26.   }
  27. //=====================>>> vBrush::vBrush <<<===========================
  28.   vBrush::vBrush(const vBrush& p)
  29.   {
  30.     brushColor = p.brushColor;
  31.     brushFillMode = p.brushFillMode;
  32.     brushStyle = p.brushStyle;
  33.   }
  34. //=====================>>> vBrush::operator= <<<===========================
  35.   vBrush& vBrush::operator =(const vBrush& p)
  36.   {
  37.     if (this == &p)     // assigning to self
  38.       {
  39.     return *this;
  40.       }
  41.     brushColor = p.brushColor;
  42.     brushFillMode = p.brushFillMode;
  43.     brushStyle = p.brushStyle;
  44.     return *this;               // allow r to l multiple assignment
  45.   }
  46. //=====================>>> vBrush::SetStyle <<<===========================
  47.   void vBrush::SetStyle(int style)
  48.   {
  49.     brushStyle = style;
  50.   }
  51. //=====================>>> vBrush::SetFillMode <<<===========================
  52.   void vBrush::SetFillMode(int fm)
  53.   {
  54.     brushFillMode = fm;
  55.   }
  56. //=====================>>> vBrush::SetColor <<<===========================
  57.   void vBrush::SetColor(vColor c)
  58.   {
  59.     brushColor = c;
  60.   }
  61. //=====================>>> vBrush::SetColor <<<===========================
  62.   void vBrush::SetColor(unsigned int r, unsigned int g, unsigned int b)
  63.   {
  64.     brushColor.Set(r,g,b);
  65.   }
  66. //=====================>>> vBrush::GetHBRUSH <<<===========================
  67. // returns pointer to AREABUNDLE set with vBrush attributes
  68.   PAREABUNDLE vBrush::GetHBRUSH() VCONST
  69.   {
  70.     _abBrush.lColor = brushColor._pixel;
  71.     _abBrush.usMixMode = FM_OVERPAINT;
  72.     switch (brushStyle)
  73.       {
  74.         case vSolid:
  75.         _abBrush.usSymbol = PATSYM_SOLID;
  76.         break;
  77.         case vTransparent:
  78.         _abBrush.usSymbol = PATSYM_NOSHADE;
  79.         break;
  80.         case vHorizontalHatch:
  81.         _abBrush.usSymbol = PATSYM_HORIZ;
  82.         break;
  83.         case vVerticleHatch:
  84.         _abBrush.usSymbol = PATSYM_VERT;
  85.         break;
  86.         case vLeftDiagonalHatch:
  87.         _abBrush.usSymbol = PATSYM_DIAG3;
  88.         break;
  89.         case vRightDiagonalHatch:
  90.         _abBrush.usSymbol = PATSYM_DIAG1;
  91.         break;
  92.         case vCrossHatch:
  93.         _abBrush.usSymbol = PATSYM_HATCH;
  94.         break;
  95.         case vDiagonalCrossHatch:
  96.         _abBrush.usSymbol = PATSYM_DIAGHATCH;
  97.         break;
  98.         default:
  99.         _abBrush.usSymbol = PATSYM_SOLID;
  100.         break;
  101.       }
  102.       return &_abBrush;                   // return pointer to areabundle
  103.   }
  104.