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.

103 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 "isdbg.h"
  25. #include "simlist.h"
  26. #include "simarray.h"
  27. #include "gphelper.h"
  28. class CImageScreenSaver
  29. {
  30. private:
  31. CFindImageFiles m_FindImageFiles;
  32. CImagePainter *m_pPainter;
  33. HINSTANCE m_hInstance;
  34. RECT m_rcClient;
  35. CMyDocsScreenSaverData m_MyDocsScreenSaverData;
  36. CSimpleDynamicArray<RECT> m_ScreenList;
  37. CSimpleDynamicArray<RECT> m_VisibleAreaList;
  38. CGdiPlusHelper m_GdiPlusHelper;
  39. private:
  40. // No implementation
  41. CImageScreenSaver(void);
  42. CImageScreenSaver( const CImageScreenSaver & );
  43. CImageScreenSaver &operator=( const CImageScreenSaver & );
  44. private:
  45. static BOOL CALLBACK MonitorEnumProc( HMONITOR hMonitor, HDC hdcMonitor, LPRECT prcMonitor, LPARAM lParam );
  46. public:
  47. CImageScreenSaver( HINSTANCE hInstance, const CSimpleString &strRegistryKey );
  48. ~CImageScreenSaver(void);
  49. bool IsValid(void) const;
  50. HANDLE Initialize( HWND hwndNotify, UINT nNotifyMessage, HANDLE hEventCancel );
  51. bool TimerTick( CSimpleDC &ClientDC );
  52. void Paint( CSimpleDC &PaintDC );
  53. int ChangeTimerInterval(void) const;
  54. int PaintTimerInterval(void) const;
  55. bool ReplaceImage( bool bForward, bool bNoTransition );
  56. bool AllowKeyboardControl(void);
  57. int Count(void) const
  58. {
  59. return m_FindImageFiles.Count();
  60. }
  61. void ResetFileQueue(void)
  62. {
  63. m_FindImageFiles.Reset();
  64. m_FindImageFiles.Shuffle();
  65. }
  66. bool FoundFile( LPCTSTR pszFilename )
  67. {
  68. return m_FindImageFiles.FoundFile( pszFilename );
  69. }
  70. void SetScreenRect( HWND hWnd )
  71. {
  72. WIA_PUSHFUNCTION(TEXT("CImageScreenSaver::SetScreenRect"));
  73. GetClientRect( hWnd, &m_rcClient );
  74. WIA_TRACE((TEXT("m_rcClient = (%d,%d), (%d,%d)"), m_rcClient.left, m_rcClient.top, m_rcClient.right, m_rcClient.bottom ));
  75. m_VisibleAreaList.Destroy();
  76. for (int i=0;i<m_ScreenList.Size();i++)
  77. {
  78. 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 ));
  79. RECT rcScreenInClientCoords = m_ScreenList[i];
  80. WiaUiUtil::ScreenToClient( hWnd, &rcScreenInClientCoords );
  81. RECT rcIntersection;
  82. if (IntersectRect( &rcIntersection, &m_rcClient, &rcScreenInClientCoords ))
  83. {
  84. m_VisibleAreaList.Append(rcIntersection);
  85. WIA_TRACE((TEXT("Adding Visible Area = (%d,%d), (%d,%d)"), rcIntersection.left, rcIntersection.top, rcIntersection.right, rcIntersection.bottom ));
  86. }
  87. }
  88. }
  89. void ReadConfigData(void)
  90. {
  91. m_MyDocsScreenSaverData.Read();
  92. }
  93. CBitmapImage *CreateImage( LPCTSTR pszFilename );
  94. CImagePainter *GetRandomImagePainter( CBitmapImage *pBitmapImage, CSimpleDC &dc, const RECT &rcAreaToUse, const RECT &rcClient );
  95. };
  96. #endif // __IMAGESCR_H_INCLUDED