home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / contrib / pstest.tar / testcnv.cpp < prev    next >
C/C++ Source or Header  |  1996-08-28  |  3KB  |  120 lines

  1. //=======================================================================
  2. //@V@:Note: This file generated by vgen V1.00 (14:12:12 23 Aug 1996).
  3. //    testcnv.cpp:    Source for testCanvasPane class
  4. //=======================================================================
  5.  
  6. #include "testcnv.h"
  7. #include <v/vfont.h>
  8. #include <v/vdc.h>
  9. #include <v/vcolor.h>
  10. #include <v/vbrush.h>
  11.  
  12. //===================>>> testCanvasPane::testCanvasPane <<<====================
  13.   testCanvasPane::testCanvasPane()
  14.   {
  15.   }
  16.  
  17. //===================>>> testCanvasPane::~testCanvasPane <<<====================
  18.   testCanvasPane::~testCanvasPane()
  19.   {
  20.   }
  21.  
  22. //======================>>> testCanvasPane::HPage <<<========================
  23.   void testCanvasPane::HPage(int shown, int top)
  24.   {
  25.     vCanvasPane::HPage(shown, top);
  26.   }
  27.  
  28. //======================>>> testCanvasPane::VPage <<<========================
  29.   void testCanvasPane::VPage(int shown, int top)
  30.   {
  31.     vCanvasPane::VPage(shown, top);
  32.   }
  33.  
  34. //=======================>>> testCanvasPane::HScroll <<<======================
  35.   void testCanvasPane::HScroll(int step)
  36.   {
  37.     vCanvasPane::HScroll(step);
  38.   }
  39.  
  40. //======================>>> testCanvasPane::VScroll <<<======================
  41.   void testCanvasPane::VScroll(int step)
  42.   {
  43.     vCanvasPane::VScroll(step);
  44.   }
  45.  
  46. //======================>>> testCanvasPane::MouseDown <<<======================
  47.   void testCanvasPane::MouseDown(int X, int Y, int button)
  48.   {
  49.     vCanvasPane::MouseDown(X,Y,button);
  50.   }
  51.  
  52. //========================>>> testCanvasPane::MouseUp <<<======================
  53.   void testCanvasPane::MouseUp(int X, int Y, int button)
  54.   {
  55.     vCanvasPane::MouseUp(X,Y,button);
  56.   }
  57.  
  58. //======================>>> testCanvasPane::MouseMove <<<======================
  59.   void testCanvasPane::MouseMove(int x, int y, int button)
  60.   {
  61.     vCanvasPane::MouseMove(x,y,button);
  62.   }
  63.  
  64. //=========================>>> testCanvasPane::Redraw <<<======================
  65.   void testCanvasPane::Redraw(int x, int y, int w, int h)
  66.   {
  67.     draw (GetDC());
  68.   }
  69.  
  70. //======================>>> testCanvasPane::Resize <<<======================
  71.   void testCanvasPane::Resize(int w, int h)
  72.   {
  73.     vCanvasPane::Resize(w,h);
  74.   }
  75.  
  76.  
  77.   void testCanvasPane::draw(vDC* dc)
  78.   {
  79.     vBrush brush;
  80.     vPen pen;
  81.     int x = 0;
  82.     int y = 0;
  83.     int w = GetWidth();
  84.     int h = GetHeight();
  85.     
  86.     dc->SetPen(pen);
  87.  
  88.     brush.SetColor (vStdColors[vC_Red]);
  89.     dc->SetBrush (brush);
  90.     dc->DrawRectangle(x, y, w/2, h/2);
  91.  
  92.     brush.SetColor (vStdColors[vC_Blue]);
  93.     dc->SetBrush (brush);
  94.     dc->DrawRectangle(x+w/2, y, w/2, h/2);
  95.  
  96.     brush.SetColor (vStdColors[vC_Green]);
  97.     dc->SetBrush (brush);
  98.     dc->DrawRectangle(x, y+h/2, w/2, h/2);
  99.  
  100.     brush.SetColor (vStdColors[vC_Yellow]);
  101.     dc->SetBrush (brush);
  102.     dc->DrawRectangle(x+w/2, y+h/2, w/2, h/2);
  103.  
  104.     vFont font (vfSansSerif, 24, vfNormal, vfBold, 0);
  105.     dc->SetFont (font);
  106.  
  107.     int ascend, descend, height;
  108.     height = dc->TextHeight (ascend, descend);
  109.     int width = dc->TextWidth ("Hello");
  110.  
  111.     dc->DrawAttrText (x+w/2-width/2, y+h/2+height/2, "Hello",
  112.                       ChReverse);
  113.  
  114.     pen.SetStyle(vTransparent);
  115.     dc->SetPen(pen);
  116.     
  117.     dc->DrawAttrText (x+w/2-width/2, y+h/2+height/2+height, "World",
  118.                       ChNormal);
  119.   }
  120.