Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

VScreen Class Reference

An abstract class for 'screens'. More...

#include <VScreen.h>

Inherited by BitmapScreen.

List of all members.

Public Methods

int getScreenX () const
int getScreenY () const
virtual bool PointOnScreen (const int, const int)
virtual void paint (HDC)=0
 Pure Virual function, hence abstract.

void invalidate (HWND, bool=false)
HRGN getRgn () const
RECT getRgnRect () const
int getHeight () const
int getWidth () const
void moveScreen (const int, const int)
 VScreen (const int, const int, const int, const int)

Private Attributes

int height
 signed height of the screen.

int width
 width of the screen.

int pointX
 x co-ordinate of top left corner.

int pointY
 y co-ordinate of top left corner.

HRGN screenRgn
 The screens region.

RECT screenRect
 The screens region as a RECT.


Detailed Description

A virtual screen is a rectangular area in a window. The actual screen area inside this region doesn't have to be rectangular. A virtual screen can draw itself and has it's own co-ordinate system.

Definition at line 21 of file VScreen.h.


Constructor & Destructor Documentation

VScreen::VScreen const int    tlX,
const int    tlY,
const int    w,
const int    h
 

Note:
passing a negative height moves the origin to the bottom left as apposed to the top left if the height is positive.
Parameters:
tlX  : top left x co-ordinate of the (rectangular) screen
tlY  : top left y co-ordinate
w  : width of the screen
h  : signed height of the screen

Definition at line 21 of file VScreen.cpp.

References height, moveScreen(), pointX, pointY, and width.

00022 {
00023     pointX = 0;
00024     pointY = 0;
00025     width = abs(w); // ensure positive width
00026     height = h;
00027     moveScreen(tlX, tlY);
00028 }


Member Function Documentation

int VScreen::getHeight   const
 

Returns the (signed) height of the VScreen

Definition at line 116 of file VScreen.cpp.

References height.

Referenced by BitmapScreen::DoneWriting().

00117 {
00118     return height;
00119 }

HRGN VScreen::getRgn   const
 

Gets the region (see MS Platform SDK)

Definition at line 84 of file VScreen.cpp.

References screenRgn.

00085 {
00086     return screenRgn;
00087 }

RECT VScreen::getRgnRect   const
 

Gets the regions Rectangle (see MS Platform SDK)

Definition at line 76 of file VScreen.cpp.

References screenRect.

Referenced by BitmapScreen::paint().

00077 {
00078     return screenRect;
00079 }

int VScreen::getScreenX   const
 

Returns the x co-ordinate of the last point on the screen

Definition at line 100 of file VScreen.cpp.

References pointX.

Referenced by registerMouse().

00101 {
00102     return pointX;
00103 }

int VScreen::getScreenY   const
 

Returns the y co-ordinate of the last point on the screen

Definition at line 108 of file VScreen.cpp.

References pointY.

Referenced by registerMouse().

00109 {
00110     return pointY;
00111 }

int VScreen::getWidth   const
 

Returns the width of the VScreen

Definition at line 124 of file VScreen.cpp.

References width.

Referenced by BitmapScreen::DoneWriting().

00125 {
00126     return width;
00127 }

void VScreen::invalidate HWND    hWnd,
bool    Erase = false
 

Invalidates the entire region (marks for painting) and sends a WM_PAINT message

Definition at line 92 of file VScreen.cpp.

References screenRgn.

Referenced by UpdateHandler::update().

00093 {
00094     InvalidateRgn(hWnd, screenRgn, Erase);
00095 }

void VScreen::moveScreen const int    tlX,
const int    tlY
 

Move the screen top left corner to the specified x, y co-ordinate

Definition at line 37 of file VScreen.cpp.

References height, screenRect, and screenRgn.

Referenced by VScreen().

00038 {
00039     screenRgn = CreateRectRgn(
00040         tlX, tlY, 
00041         this->width + tlX, 
00042         abs(height) + tlY);
00043 
00044     GetRgnBox(screenRgn, &screenRect);
00045 }

bool VScreen::PointOnScreen const int    x,
const int    y
[virtual]
 

This function takes a window co-ordinate and tests if it is in the screen region. The internal point is set to a VScreen co-ordinate iff it is.

Parameters:
x  : window x co-ordinate
y  : window y co-ordinate
Returns:
bool : true iff point is on 'screen'

Definition at line 57 of file VScreen.cpp.

References height, pointX, pointY, screenRect, and screenRgn.

Referenced by Cls_OnLButtonDown(), and Cls_OnLButtonUp().

00058 {
00059     if ( PtInRegion(screenRgn, x, y) ){
00060         pointX = x - screenRect.left;
00061 
00062         if( height < 0 )
00063             pointY = -y + screenRect.top - (height + 1);
00064         else
00065             pointY = y - screenRect.top;
00066 
00067         return true;
00068     } else {
00069         return false;
00070     }
00071 }


The documentation for this class was generated from the following files:
Generated on Mon Mar 25 06:30:00 2002 for Window Dressing by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001