Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
4.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltmisc.hxx
  7. Misc. BLT classes
  8. FILE HISTORY:
  9. rustanl 21-Nov-1990 created
  10. rustanl 12-Mar-1991 added CURSOR and AUTO_CURSOR classes
  11. beng 14-May-1991 Hack for standalone compilation;
  12. delete TABSTOP objects;
  13. split off atom, cursor, dc files;
  14. add XYPOINT, XYDIMENSION
  15. rustanl 06-Aug-1991 Added SOLID_BRUSH
  16. beng 30-Sep-1991 PROC_INSTANCE removed elsewhere
  17. */
  18. #ifndef _BLT_HXX_
  19. #error "Don't include this file directly; instead, include it through blt.hxx"
  20. #endif // _BLT_HXX_
  21. #ifndef _BLTMISC_HXX_
  22. #define _BLTMISC_HXX_
  23. #include "base.hxx"
  24. DLL_CLASS XYRECT;
  25. /*************************************************************************
  26. NAME: XYPOINT (xy)
  27. SYNOPSIS: Encapsulation of a (x, y) point
  28. This class replaces the Windows POINT structure.
  29. INTERFACE: QueryX() - access member fcns
  30. QueryY()
  31. SetX()
  32. SetY()
  33. ScreenToClient() - take a screen point and convert
  34. it to window-client coords
  35. ClientToScreen() - take a point in a window and convert
  36. it to screen coords
  37. InRect() - return whether point is within rect
  38. HISTORY:
  39. beng 15-May-1991 Created
  40. beng 22-Aug-1991 Made coordinates signed
  41. beng 09-Oct-1991 Win32 conversion
  42. **************************************************************************/
  43. DLL_CLASS XYPOINT
  44. {
  45. private:
  46. INT _x;
  47. INT _y;
  48. public:
  49. XYPOINT( INT x, INT y ) : _x(x), _y(y) {}
  50. #if defined(WIN32)
  51. XYPOINT( const POINT & pt ) : _x((INT)pt.x), _y((INT)pt.y) {}
  52. #else
  53. XYPOINT( POINT pt ) : _x(pt.x), _y(pt.y) {}
  54. #endif
  55. XYPOINT( LPARAM lGivenByWmMove )
  56. {
  57. #if defined(WIN32)
  58. POINT pt;
  59. pt.x = (SHORT)LOWORD( lGivenByWmMove );
  60. pt.y = (SHORT)HIWORD( lGivenByWmMove );
  61. #else
  62. POINT pt = *(POINT*)(&lGivenByWmMove);
  63. #endif
  64. _x = (INT)pt.x;
  65. _y = (INT)pt.y;
  66. }
  67. VOID SetX( INT x ) { _x = x; }
  68. VOID SetY( INT y ) { _y = y; }
  69. INT QueryX() const { return _x; }
  70. INT QueryY() const { return _y; }
  71. POINT QueryPoint() const
  72. { POINT pt; pt.x = _x; pt.y = _y; return pt; }
  73. VOID ScreenToClient( HWND hwnd );
  74. VOID ClientToScreen( HWND hwnd );
  75. BOOL InRect( const XYRECT & ) const;
  76. };
  77. /*************************************************************************
  78. NAME: XYDIMENSION (dxy)
  79. SYNOPSIS: Encapsulation of (dx, dy) pair
  80. INTERFACE: XYDIMENSION() - constructor
  81. QueryHeight() - access functions
  82. QueryWidth()
  83. SetHeight()
  84. SetWidth()
  85. CAVEATS:
  86. NOTES:
  87. This class replaces digging directly through the value
  88. returned by GetTextExtent.
  89. HISTORY:
  90. beng 15-May-1991 Created
  91. beng 09-Oct-1991 Win32 conversion
  92. **************************************************************************/
  93. DLL_CLASS XYDIMENSION
  94. {
  95. private:
  96. UINT _dx;
  97. UINT _dy;
  98. public:
  99. XYDIMENSION( UINT dx, UINT dy ) : _dx(dx), _dy(dy) {}
  100. #if defined(WIN32)
  101. XYDIMENSION( const SIZE & size ) : _dx((UINT)size.cx),
  102. _dy((UINT)size.cy) {}
  103. #else
  104. // From GetTextExtent
  105. XYDIMENSION( ULONG ulRaw ) : _dx(LOWORD(ulRaw)), _dy(HIWORD(ulRaw)) {}
  106. #endif
  107. VOID SetWidth( UINT dWidth ) { _dx = dWidth; }
  108. VOID SetHeight( UINT dHeight ) { _dy = dHeight; }
  109. UINT QueryWidth() const { return _dx; }
  110. UINT QueryHeight() const { return _dy; }
  111. };
  112. /*************************************************************************
  113. NAME: SOLID_BRUSH
  114. SYNOPSIS: Solid brush used when painting windows
  115. INTERFACE: SOLID_BRUSH() - constructor
  116. ~SOLID_BRUSH() - destructor
  117. QueryHandle() - returns the handle of the solid brush
  118. PARENT: BASE
  119. HISTORY:
  120. rustanl 22-Jul-1991 Created
  121. **************************************************************************/
  122. DLL_CLASS SOLID_BRUSH : public BASE
  123. {
  124. private:
  125. HBRUSH _hbrush;
  126. public:
  127. SOLID_BRUSH( INT iSolidBrush );
  128. ~SOLID_BRUSH();
  129. HBRUSH QueryHandle() const
  130. { return _hbrush; }
  131. };
  132. #endif // _BLTMISC_HXX_ - end of file