Source code of Windows XP (NT5)
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.

120 lines
4.0 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: sswindow.hxx
  3. *
  4. *
  5. *
  6. * Copyright (c) 1996 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #ifndef __sswindow_hxx__
  10. #define __sswindow_hxx__
  11. #include "sscommon.h"
  12. // SSW flags
  13. #define SS_HRC_PROXY_BIT (1 << 0)
  14. /**************************************************************************\
  15. * SSW
  16. *
  17. \**************************************************************************/
  18. // GL config struct
  19. typedef struct {
  20. int pfFlags; // pixel format flags
  21. HGLRC hrc;
  22. STRETCH_INFO *pStretch;
  23. } SS_GL_CONFIG;
  24. class SSW {
  25. public:
  26. int wFlags; // various window flags
  27. HWND hwnd; // NULL indicates logical sub-window
  28. BOOL bOwnWindow; // TRUE if we created the window, otherwise system
  29. // window
  30. int iSubWindow; // Reference count for sub-window children
  31. BOOL bValidateBg;
  32. SSW *psswParent;
  33. SSW *psswSibling;
  34. SSW *psswChildren;
  35. HDC hdc;
  36. HGLRC hrc; // Can be for this window or a bitmap in pStretch
  37. ISIZE size;
  38. IPOINT2D pos; // pos'n relative to parent's origin
  39. BOOL bDoubleBuf;
  40. SSINITPROC InitFunc;
  41. SSUPDATEPROC UpdateFunc;
  42. SSRESHAPEPROC ReshapeFunc;
  43. SSREPAINTPROC RepaintFunc;
  44. SSFLOATERBOUNCEPROC FloaterBounceFunc;
  45. SSFINISHPROC FinishFunc;
  46. SSCHILDSIZEPROC ChildSizeFunc;
  47. MOTION *pMotion; // if this window moves
  48. STRETCH_INFO *pStretch;
  49. void *DataPtr;
  50. WNDPROC wndProc;
  51. SS_GL_CONFIG *pGLc; // GL configuration
  52. SSW( SSW *psswParent, ISIZE *pSize, IPOINT2D *pPos, BOOL bMotion,
  53. SSCHILDSIZEPROC ChildSizeFuncArg );
  54. SSW( SSW *psswParentArg, HWND hwndArg );
  55. ~SSW();
  56. BOOL CreateSSWindow( HINSTANCE hMainInstance, UINT uStyle, UINT uExStyle,
  57. LPCTSTR pszWindowTitle, WNDPROC wndProcArg,
  58. LPCTSTR pszClassName, HWND hwndParentOverride );
  59. void Reset(); // Set to default init state
  60. void SetInitFunc(SSINITPROC);
  61. void SetReshapeFunc(SSRESHAPEPROC);
  62. void SetRepaintFunc(SSREPAINTPROC);
  63. void SetUpdateFunc(SSUPDATEPROC);
  64. void SetFinishFunc(SSFINISHPROC);
  65. void SetFloaterBounceFunc(SSFLOATERBOUNCEPROC);
  66. void SetCallbackData( void *pData ) { DataPtr = pData; };
  67. BOOL ConfigureForGL( SS_GL_CONFIG *pGLcArg );
  68. BOOL ConfigureForGL();
  69. BOOL ConfigureForGdi();
  70. void MakeCurrent();
  71. void InitGL(); // Initialize GL
  72. HGLRC GetHRC() { return hrc; };
  73. void GdiClear();
  74. void Start(); // Start drawing
  75. void Resize( int width, int height ); // called on WM_RESIZE
  76. void Repaint( BOOL bCheckUpdateRect ); // called on WM_REPAINT
  77. void Reshape(); // Call back to ss to reshape its GL draw area
  78. void UpdateWindow();
  79. void GetChildInfo();
  80. BOOL SetAspectRatio( float fAspect );
  81. void RandomWindowPos();
  82. void GetSize( ISIZE *pSize ) { *pSize = size; };
  83. private:
  84. GLRECT lastRect; // for optimizing HW sub-window clears
  85. void AddChild( SSW *psswChild );
  86. BOOL RemoveChild( SSW *psswChild );
  87. HGLRC hrcSetupGL();// pixelformat, createcontext, etc.
  88. BOOL NeedStretchedWindow();
  89. void SwapSSBuffers();
  90. void SwapStretchBuffers();
  91. void ResizeStretch();
  92. BOOL bValidateChildPos();
  93. void ValidateChildSize();
  94. void ResetMotion();
  95. void SetSSWindowPos( int flags );
  96. void SetSSWindowPos();
  97. void MoveSSWindow( BOOL bRedrawBg );
  98. //mf: can't have function ptrs to member functions!
  99. // void (*UpdateDoubleBufWinFunc)();
  100. void UpdateDoubleBufWin(); // normal double buffer update
  101. void UpdateDoubleBufSubWin(); // sub-win case
  102. BOOL CalcNextWindowPos();
  103. void GetSSWindowRect( LPRECT lpRect );
  104. int GLPosY(); // Convert window pos.y from gdi to GL
  105. };
  106. typedef SSW* PSSW;
  107. #endif // __sswindow_hxx__