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.

57 lines
1.3 KiB

  1. #include "precomp.h"
  2. #include "findimgs.h"
  3. #include "ssutil.h"
  4. CFindImageFiles::CFindImageFiles(void)
  5. :m_nCurrentFile(0)
  6. {
  7. }
  8. CFindImageFiles::~CFindImageFiles(void)
  9. {
  10. }
  11. bool CFindImageFiles::NextFile( CSimpleString &strFilename )
  12. {
  13. bool bResult = false;
  14. strFilename = TEXT("");
  15. if (m_ImageFiles.Size())
  16. {
  17. if (m_nCurrentFile >= m_ImageFiles.Size())
  18. {
  19. m_nCurrentFile = 0;
  20. }
  21. strFilename = m_ImageFiles[m_nCurrentFile];
  22. m_nCurrentFile++;
  23. bResult = (strFilename.Length() != 0);
  24. }
  25. return(bResult);
  26. }
  27. bool CFindImageFiles::PreviousFile( CSimpleString &strFilename )
  28. {
  29. bool bResult = false;
  30. strFilename = TEXT("");
  31. if (m_ImageFiles.Size()==1)
  32. {
  33. m_nCurrentFile = 0;
  34. strFilename = m_ImageFiles[0];
  35. bResult = (strFilename.Length() != 0);
  36. }
  37. else if (m_ImageFiles.Size()>=2)
  38. {
  39. m_nCurrentFile--;
  40. if (m_nCurrentFile < 0)
  41. {
  42. m_nCurrentFile = m_ImageFiles.Size()-1;
  43. }
  44. int nPrevFile = m_nCurrentFile-1;
  45. if (nPrevFile < 0)
  46. {
  47. nPrevFile = m_ImageFiles.Size()-1;
  48. }
  49. strFilename = m_ImageFiles[nPrevFile];
  50. bResult = (strFilename.Length() != 0);
  51. }
  52. return(bResult);
  53. }