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.

204 lines
6.3 KiB

  1. /**INC+**********************************************************************/
  2. /* Header: op.h */
  3. /* */
  4. /* Purpose: Output Painter Class */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997-1999 */
  7. /* */
  8. /****************************************************************************/
  9. #ifndef _H_OP
  10. #define _H_OP
  11. extern "C" {
  12. #include <adcgdata.h>
  13. }
  14. #include <adcgdata.h>
  15. #define DIM_WINDOW_STEPS 16
  16. #define DIM_WINDOW_TICK 150
  17. #define DIM_WINDOW_TIMERID 1
  18. //Disconnected icon timer ID sets blink rate
  19. #define DIM_DISCONICON_TICK 500
  20. #include "objs.h"
  21. #include "cd.h"
  22. #include "or.h"
  23. /**STRUCT+*******************************************************************/
  24. /* Structure: OP_GLOBAL_DATA */
  25. /* */
  26. /* Description: */
  27. /****************************************************************************/
  28. typedef struct tagOP_GLOBAL_DATA
  29. {
  30. DCINT32 palettePDUsBeingProcessed; /* Must be 4-byte aligned */
  31. HWND hwndOutputWindow;
  32. DCBOOL paletteRealizationSupported;
  33. DCUINT32 lastPaintTime;
  34. } OP_GLOBAL_DATA, DCPTR POP_GLOBAL_DATA;
  35. /**STRUCT-*******************************************************************/
  36. /****************************************************************************/
  37. /* */
  38. /* CONSTANTS */
  39. /* */
  40. /****************************************************************************/
  41. #define OP_CLASS_NAME _T("OPWindowClass")
  42. /****************************************************************************/
  43. /* Maximum delay in processing of outstanding WM_PAINT messages. If this */
  44. /* limit is reached we force the window to be painted. */
  45. /****************************************************************************/
  46. #define OP_WORST_CASE_WM_PAINT_PERIOD 1000
  47. class CUT;
  48. class CUH;
  49. class CUI;
  50. #ifdef OS_WINCE
  51. class CIH;
  52. #endif
  53. class COP
  54. {
  55. public:
  56. COP(CObjs* objs);
  57. ~COP();
  58. public:
  59. //
  60. // API functions
  61. //
  62. DCVOID DCAPI OP_Init(DCVOID);
  63. DCVOID DCAPI OP_Term(DCVOID);
  64. HWND DCAPI OP_GetOutputWindowHandle(DCVOID);
  65. DCVOID DCAPI OP_PaletteChanged(HWND hwnd, HWND hwndTrigger);
  66. DCUINT DCAPI OP_QueryNewPalette(HWND hwnd);
  67. DCVOID DCAPI OP_MaybeForcePaint(DCVOID);
  68. DCVOID DCAPI OP_IncrementPalettePDUCount(DCVOID);
  69. DCVOID DCAPI OP_Enable(DCVOID);
  70. DCVOID DCAPI OP_Disable(BOOL fUseDisabledBitmap);
  71. #ifdef SMART_SIZING
  72. BOOL OP_CopyShadowToDC(HDC hdc, LONG srcLeft, LONG srcTop,
  73. LONG srcWidth, LONG srcHeight,
  74. BOOL fUseUpdateClipping = FALSE);
  75. void OP_AddUpdateRegion(DCINT left, DCINT top, DCINT right, DCINT bottom);
  76. DCVOID DCAPI OP_MainWindowSizeChange(ULONG_PTR msg);
  77. EXPOSE_CD_SIMPLE_NOTIFICATION_FN(COP,OP_MainWindowSizeChange);
  78. /****************************************************************************/
  79. /* Name: OP_ClearUpdateRegion */
  80. /* */
  81. /* Purpose: Clears the update region */
  82. /****************************************************************************/
  83. _inline void DCAPI OP_ClearUpdateRegion()
  84. {
  85. DC_BEGIN_FN("OP_ClearUpdateRegion");
  86. #ifdef USE_GDIPLUS
  87. _rgnUpdate.MakeEmpty();
  88. #else // USE_GDIPLUS
  89. SetRectRgn(_hrgnUpdate, 0, 0, 0, 0);
  90. #endif // USE_GDIPLUS
  91. DC_END_FN();
  92. }
  93. #endif // SMART_SIZING
  94. #ifdef OS_WINCE
  95. DCVOID DCAPI OP_DoPaint(DCUINT hwnd);
  96. EXPOSE_CD_SIMPLE_NOTIFICATION_FN(COP,OP_DoPaint);
  97. #endif
  98. DCVOID DCAPI OP_DimWindow(ULONG_PTR fDim);
  99. EXPOSE_CD_SIMPLE_NOTIFICATION_FN(COP,OP_DimWindow);
  100. public:
  101. OP_GLOBAL_DATA _OP;
  102. private:
  103. //
  104. // Internal functions
  105. //
  106. static LRESULT CALLBACK OPStaticWndProc( HWND hwnd,
  107. UINT message,
  108. WPARAM wParam,
  109. LPARAM lParam );
  110. LRESULT CALLBACK OPWndProc( HWND hwnd,
  111. UINT message,
  112. WPARAM wParam,
  113. LPARAM lParam );
  114. #ifdef OS_WINCE
  115. static BOOL CALLBACK StaticEnumTopLevelWindowsProc(HWND hwnd,
  116. LPARAM lParam );
  117. BOOL EnumTopLevelWindowsProc(HWND hwnd);
  118. #endif
  119. DCUINT DCINTERNAL OPRealizePaletteInWindow(HWND hwnd);
  120. BOOL OPStartDimmingWindow();
  121. BOOL OPStopDimmingWindow();
  122. //
  123. // Grilled window and dimmed window effects for the
  124. // disconnected state
  125. //
  126. //
  127. VOID GrillWindow(HDC hdc, DCSIZE& size);
  128. HBRUSH CreateDitheredBrush();
  129. VOID DimWindow(HDC hdc);
  130. VOID DimBits24(PBYTE pSrc, int cLen, int Amount);
  131. VOID DimBits16(PBYTE pSrc, int cLen, int Amount);
  132. VOID DimBits15(PBYTE pSrc, int cLen, int Amount);
  133. private:
  134. CUT* _pUt;
  135. CUH* _pUh;
  136. CCD* _pCd;
  137. COR* _pOr;
  138. CUI* _pUi;
  139. COD* _pOd;
  140. #ifdef OS_WINCE
  141. CIH* _pIh;
  142. #endif
  143. private:
  144. CObjs* _pClientObjects;
  145. #ifdef SMART_SIZING
  146. DCSIZE _scaleSize;
  147. #ifdef USE_GDIPLUS
  148. Gdiplus::Region _rgnUpdate;
  149. Gdiplus::Region _rgnUpdateRect;
  150. #else // USE_GDIPLUS
  151. //
  152. // GDI scaled update region
  153. //
  154. HRGN _hrgnUpdate;
  155. HRGN _hrgnUpdateRect;
  156. #endif // USE_GDIPLUS
  157. #endif // SMART_SIZING
  158. //
  159. // Grayed window (for OPDisabled) support
  160. //
  161. BOOL _fDimWindow;
  162. BOOL _iDimWindowStepsLeft;
  163. INT _nDimWindowTimerID;
  164. };
  165. #endif // _H_OP