windows-nt/Source/XPSP1/NT/shell/ext/sshow/findimgs.cpp
2020-09-26 16:20:57 +08:00

58 lines
1.3 KiB
C++

#include "precomp.h"
#include "findimgs.h"
#include "ssutil.h"
CFindImageFiles::CFindImageFiles(void)
:m_nCurrentFile(0)
{
}
CFindImageFiles::~CFindImageFiles(void)
{
}
bool CFindImageFiles::NextFile( CSimpleString &strFilename )
{
bool bResult = false;
strFilename = TEXT("");
if (m_ImageFiles.Size())
{
if (m_nCurrentFile >= m_ImageFiles.Size())
{
m_nCurrentFile = 0;
}
strFilename = m_ImageFiles[m_nCurrentFile];
m_nCurrentFile++;
bResult = (strFilename.Length() != 0);
}
return(bResult);
}
bool CFindImageFiles::PreviousFile( CSimpleString &strFilename )
{
bool bResult = false;
strFilename = TEXT("");
if (m_ImageFiles.Size()==1)
{
m_nCurrentFile = 0;
strFilename = m_ImageFiles[0];
bResult = (strFilename.Length() != 0);
}
else if (m_ImageFiles.Size()>=2)
{
m_nCurrentFile--;
if (m_nCurrentFile < 0)
{
m_nCurrentFile = m_ImageFiles.Size()-1;
}
int nPrevFile = m_nCurrentFile-1;
if (nPrevFile < 0)
{
nPrevFile = m_ImageFiles.Size()-1;
}
strFilename = m_ImageFiles[nPrevFile];
bResult = (strFilename.Length() != 0);
}
return(bResult);
}