Page principale | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations | Pages associées

MyRect.h

Aller à la documentation de ce fichier.
00001 #if !defined(AFX_MYRECT_H__C61C6B64_4171_4BA7_971C_CC9255370B75__INCLUDED_)
00002 #define AFX_MYRECT_H__C61C6B64_4171_4BA7_971C_CC9255370B75__INCLUDED_
00003 
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 
00008 // ***************************************************************************************
00009 
00010 class CMySize
00011 {
00012         public:
00013                 int dx;
00014                 int dy;
00015 
00016                 CMySize()
00017                 {
00018                         Reset();
00019                 }
00020 
00021                 CMySize(int xdx,int xdy)
00022                 {
00023                         Set(xdx,xdy);
00024                 }
00025 
00026                 void Reset()
00027                 {
00028                         dx = dy = 0;
00029                 }
00030 
00031                 void operator=(CMySize *s)
00032                 {
00033                         dx = s->dx;
00034                         dy = s->dy;
00035                 }
00036 
00037                 void operator=(CMySize &s)
00038                 {
00039                         operator=(&s);
00040                 }
00041         
00042                 void Set(int xdx,int xdy)
00043                 {
00044                         dx = xdx;
00045                         dy = xdy;
00046                 }
00047 };
00048 
00049 // ***************************************************************************************
00050 
00051 class CMyRect  
00052 {
00053         public:
00054                 RECT r;
00055                 
00056                 CMyRect()
00057                 {
00058                         Reset();
00059                 }
00060 
00061                 void Reset()
00062                 {
00063                         r.top = r.bottom = r.left = r.right = 0;
00064                 }
00065                 operator RECT() const
00066                 {
00067                         return r;
00068                 }
00069 
00070                 void operator=(CMyRect *n)
00071                 {
00072                         r.top = n->r.top;
00073                         r.bottom = n->r.bottom;
00074                         r.left = n->r.left;
00075                         r.right = n->r.right;
00076                 }
00077 
00078                 void operator=(CMyRect &r)
00079                 {
00080                         operator=(&r);
00081                 }
00082         
00083                 void Set(int left,int right,int top,int bottom)
00084                 {
00085                         r.top =top;
00086                         r.bottom = bottom;
00087                         r.right = right;
00088                         r.left = left;
00089                 }
00090 
00091                 void SetPos(int left,int top)
00092                 {
00093                         r.left = left;
00094                         r.top = top;
00095                 }
00096 
00097                 void SetDelta(int dx,int dy)
00098                 {
00099                         r.right=r.left+dx;
00100                         r.bottom = r.top+dy;
00101                 }
00102 
00103                 void Translate(int dx,int dy)
00104                 {
00105                         r.right+=dx;
00106                         r.left+=dx;
00107                         r.top+=dy;
00108                         r.bottom+=dy;
00109                 }
00110                 
00111                 int DeltaX()
00112                 {
00113                         return r.right-r.left;
00114                 }
00115 
00116                 int DeltaY()
00117                 {
00118                         return r.bottom-r.top;
00119                 }
00120 
00121                 BOOL IsInside(POINT *p)
00122                 {
00123                         return IsInside(p->x,p->y);
00124                 }
00125 
00126                 BOOL IsInside(int x,int y)
00127                 {
00128                         return x>=r.left && x<=r.right && y>=r.top && y<=r.bottom ? TRUE: FALSE;
00129                 }
00130 };
00131 
00132 // ***************************************************************************************
00133 
00134 #endif // !defined(AFX_MYRECT_H__C61C6B64_4171_4BA7_971C_CC9255370B75__INCLUDED_)

Généré le Thu Apr 8 18:58:42 2004 pour SFC par doxygen 1.3.6