home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WRECT.INL < prev    next >
Text File  |  1996-06-06  |  3KB  |  87 lines

  1. //
  2. // wrect.inl -- Inline definitions for WRect
  3. //
  4.  
  5. #ifdef WCMINLINE
  6.  
  7. WCMINLINE WRect::WRect( const RECT & o ) 
  8. /***************************************/
  9.     x = o.left;
  10.     y = o.top;
  11.     w = o.right - o.left;
  12.     h = o.bottom - o.top;
  13. }
  14.  
  15. WCMINLINE WRect::WRect( const RECTL & o ) 
  16. /****************************************/
  17.     x = (WInt)o.left;
  18.     y = (WInt)o.top;
  19.     w = (WInt)o.right - (WInt)o.left;
  20.     h = (WInt)o.bottom - (WInt)o.top; 
  21. }
  22.  
  23. WCMINLINE WBool WRect::Contains( const WPoint & point ) const
  24. /***********************************************************/
  25.     return( ( point.x >= x && point.x <= x + w &&
  26.               point.y >= y && point.y <= y + h ) ); 
  27. }
  28.  
  29. WCMINLINE WBool WRect::Inflate( const WSize & s ) 
  30. /***********************************************/
  31.     w += s.w; h += s.h; 
  32.     return TRUE;
  33. }
  34.  
  35. WCMINLINE RECTL WRect::GetRECTL() const 
  36. /**************************************/
  37.     RECTL r; r.left = x; r.top = y;
  38.     r.right = x + w; r.bottom = y + h; return r; 
  39. }
  40.  
  41. WCMINLINE void WRect::SetRECTL( const RECTL & r ) 
  42. /*************************************************/
  43.     x = (WInt)r.left; y = (WInt)r.top;
  44.     w = (WInt)r.right - (WInt)r.left;
  45.     h = (WInt)r.bottom - (WInt)r.top;
  46. }
  47.  
  48. WCMINLINE void WRect::Create( const RECT & o )
  49. /*********************************************/
  50. { x = o.left; y = o.top; w = o.right - o.left;
  51.   h = o.bottom - o.top; }
  52.  
  53. WCMINLINE void WRect::Create( const RECTL & o )
  54. /**********************************************/
  55. { x = (WInt)o.left; y = (WInt)o.top; w = (WInt)o.right - (WInt)o.left;
  56.   h = (WInt)o.bottom - (WInt)o.top; }
  57.  
  58. WCMINLINE void WRect::Translate( const WPoint & pt ) 
  59. /**************************************************/
  60. { x += pt.x; y += pt.y; }
  61.  
  62. WCMINLINE int WRect::operator==( const WRect & o ) const
  63. /******************************************************/
  64. { return ( x == o.x && y == o.y && w == o.w && h == o.h ); }
  65.  
  66. WCMINLINE int WRect::operator!=( const WRect & o ) const
  67. /******************************************************/
  68. { return ( x != o.x || y != o.y || w != o.w || h != o.h ); }
  69.  
  70. WCMINLINE WRect & WRect::operator=( const RECT & o )
  71. /**************************************************/
  72. { x = o.left; y = o.top; w = o.right - o.left;
  73.   h = o.bottom - o.top; return *this; }
  74.   
  75. WCMINLINE WRect & WRect::operator=( const RECTL & o )
  76. /***************************************************/
  77. { x = (WInt)o.left; y = (WInt)o.top; w = (WInt)o.right - (WInt)o.left;
  78.   h = (WInt)o.bottom - (WInt)o.top; return *this; }
  79.   
  80. #endif
  81.