home *** CD-ROM | disk | FTP | other *** search
- #include "MySCAPIDrawingArea.h"
-
- // Contructor - Destructor
-
- MySCAPIDrawingArea::MySCAPIDrawingArea( SCAPIWindow* inWindowP,
- int inOriginx,
- int inOriginy,
- int inWidth,
- int inHeight )
-
- : SCAPIDrawingArea( inWindowP,
- inOriginx,
- inOriginy,
- inWidth,
- inHeight ),
- SCAPITimer(5.0)
- {
- mMousePressed = FALSE;
- }
-
- MySCAPIDrawingArea::~MySCAPIDrawingArea()
- {
-
- }
-
- void MySCAPIDrawingArea::Tick()
- {
- //Beep(0, 0);
- //SysBeep(0);
- }
-
- // Member functions
-
- void MySCAPIDrawingArea::LeftMouseButtonDownEvent(int x, int y)
- {
- /*SetDrawingColor(1.0, 0.0, 0.0);
-
- DrawFilledRectangle( x - 5,
- y - 5,
- 10,
- 10 );*/
-
- Clear();
-
- /*SetDrawingColor(1.0, 0.0, 0.0);
- DrawPoint(x, y);*/
-
- /*SetDrawingColor(1.0, 0.0, 0.0);
-
- DrawFilledOval( x ,
- y,
- 10,
- 20 );*/
- }
-
- void MySCAPIDrawingArea::MiddleMouseButtonDownEvent(int x, int y)
- {
- /*SetDrawingColor(1.0, 1.0, 0.0);
-
- DrawRectangle( x - 5,
- y - 5,
- 10,
- 10 );*/
-
- mMousePressed = TRUE;
- ClearArea( x - 5,
- y - 5,
- 20,
- 10 );
-
- /*SetDrawingColor(0.0, 1.0, 0.0);
- DrawLine(x, y, x + 20, y + 10);*/
-
- /*SetDrawingColor(1.0, 1.0, 0.0);
-
- DrawOval( x,
- y,
- 20,
- 10 );*/
- }
-
- void MySCAPIDrawingArea::RightMouseButtonDownEvent(int x, int y)
- {
- int i, j;
- float theRedIntensity;
- float theGreenIntensity;
- float theBlueIntensity;
-
- for (j = 0; j < 100; j += 5)
- for (i = 0; i < 200; i += 5)
- {
- theRedIntensity = (0.894427191 * i + 0.4472135955 * j) / 223.60679775;
- theGreenIntensity = (100 - j) / 100.0;
- theBlueIntensity = (200 - i) / 200.0;
-
- SetDrawingColor(theRedIntensity, theGreenIntensity, theBlueIntensity);
- DrawFilledRectangle( i,
- j,
- 4,
- 4 );
- }
- }
-
- void MySCAPIDrawingArea::LeftMouseButtonUpEvent(int x, int y)
- {
-
- }
-
- void MySCAPIDrawingArea::MiddleMouseButtonUpEvent(int x, int y)
- {
- mMousePressed = FALSE;
- }
-
- void MySCAPIDrawingArea::RightMouseButtonUpEvent(int x, int y)
- {
-
- }
-
- void MySCAPIDrawingArea::MouseMove(int x, int y)
- {
- if (mMousePressed)
- {
- ClearArea( x - 5,
- y - 5,
- 20,
- 10 );
- }
- }