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.

102 lines
3.5 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998, 1999, 2000
  4. *
  5. * TITLE: IMAGESCR.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 1/13/1999
  12. *
  13. * DESCRIPTION: My Pictures Slideshow screen saver class
  14. *
  15. *******************************************************************************/
  16. #ifndef __IMAGESCR_H_INCLUDED
  17. #define __IMAGESCR_H_INCLUDED
  18. #include <windows.h>
  19. #include <atlbase.h>
  20. #include "findimgs.h"
  21. #include "painters.h"
  22. #include "ssdata.h"
  23. #include "waitcurs.h"
  24. #include "simlist.h"
  25. #include "simarray.h"
  26. #include "gphelper.h"
  27. class CImageScreenSaver
  28. {
  29. private:
  30. CFindImageFiles m_FindImageFiles;
  31. CImagePainter *m_pPainter;
  32. HINSTANCE m_hInstance;
  33. RECT m_rcClient;
  34. CMyDocsScreenSaverData m_MyDocsScreenSaverData;
  35. CSimpleDynamicArray<RECT> m_ScreenList;
  36. CSimpleDynamicArray<RECT> m_VisibleAreaList;
  37. CGdiPlusHelper m_GdiPlusHelper;
  38. private:
  39. // No implementation
  40. CImageScreenSaver(void);
  41. CImageScreenSaver( const CImageScreenSaver & );
  42. CImageScreenSaver &operator=( const CImageScreenSaver & );
  43. private:
  44. static BOOL CALLBACK MonitorEnumProc( HMONITOR hMonitor, HDC hdcMonitor, LPRECT prcMonitor, LPARAM lParam );
  45. public:
  46. CImageScreenSaver( HINSTANCE hInstance, const CSimpleString &strRegistryKey );
  47. ~CImageScreenSaver(void);
  48. bool IsValid(void) const;
  49. HANDLE Initialize( HWND hwndNotify, UINT nNotifyMessage, HANDLE hEventCancel );
  50. bool TimerTick( CSimpleDC &ClientDC );
  51. void Paint( CSimpleDC &PaintDC );
  52. int ChangeTimerInterval(void) const;
  53. int PaintTimerInterval(void) const;
  54. bool ReplaceImage( bool bForward, bool bNoTransition );
  55. bool AllowKeyboardControl(void);
  56. int Count(void) const
  57. {
  58. return m_FindImageFiles.Count();
  59. }
  60. void ResetFileQueue(void)
  61. {
  62. m_FindImageFiles.Reset();
  63. m_FindImageFiles.Shuffle();
  64. }
  65. bool FoundFile( LPCTSTR pszFilename )
  66. {
  67. return m_FindImageFiles.FoundFile( pszFilename );
  68. }
  69. void SetScreenRect( HWND hWnd )
  70. {
  71. WIA_PUSHFUNCTION(TEXT("CImageScreenSaver::SetScreenRect"));
  72. GetClientRect( hWnd, &m_rcClient );
  73. WIA_TRACE((TEXT("m_rcClient = (%d,%d), (%d,%d)"), m_rcClient.left, m_rcClient.top, m_rcClient.right, m_rcClient.bottom ));
  74. m_VisibleAreaList.Destroy();
  75. for (int i=0;i<m_ScreenList.Size();i++)
  76. {
  77. WIA_TRACE((TEXT("m_ScreenList[%d] = (%d,%d), (%d,%d)"), i, m_ScreenList[i].left, m_ScreenList[i].top, m_ScreenList[i].right, m_ScreenList[i].bottom ));
  78. RECT rcScreenInClientCoords = m_ScreenList[i];
  79. WiaUiUtil::ScreenToClient( hWnd, &rcScreenInClientCoords );
  80. RECT rcIntersection;
  81. if (IntersectRect( &rcIntersection, &m_rcClient, &rcScreenInClientCoords ))
  82. {
  83. m_VisibleAreaList.Append(rcIntersection);
  84. WIA_TRACE((TEXT("Adding Visible Area = (%d,%d), (%d,%d)"), rcIntersection.left, rcIntersection.top, rcIntersection.right, rcIntersection.bottom ));
  85. }
  86. }
  87. }
  88. void ReadConfigData(void)
  89. {
  90. m_MyDocsScreenSaverData.Read();
  91. }
  92. CBitmapImage *CreateImage( LPCTSTR pszFilename );
  93. CImagePainter *GetRandomImagePainter( CBitmapImage *pBitmapImage, CSimpleDC &dc, const RECT &rcAreaToUse, const RECT &rcClient );
  94. };
  95. #endif // __IMAGESCR_H_INCLUDED