home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / wins / fileitem.cpp < prev    next >
C/C++ Source or Header  |  1998-04-08  |  2KB  |  127 lines

  1. // FileItem.cpp: implementation of the CFileItem class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4.  
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include "FileItem.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14.  
  15. //////////////////////////////////////////////////////////////////////
  16. // Construction/Destruction
  17. //////////////////////////////////////////////////////////////////////
  18.  
  19. CFileItem::CFileItem()
  20. {
  21.  
  22. }
  23.  
  24. CFileItem::CFileItem(LPCTSTR szDir, LPCTSTR szFile, CRect& rectWnd, BOOL fInDebugger)
  25. {
  26.     m_strDir = szDir;
  27.     m_strFile = szFile;
  28.     m_timeLast = CTime::GetCurrentTime();
  29.     m_rectWndDbg.SetRectEmpty();
  30.     m_rectWnd.SetRectEmpty();
  31.     m_fOpenedInDebug = FALSE;
  32.  
  33.     if (fInDebugger)
  34.         m_rectWndDbg = rectWnd;
  35.     else
  36.         m_rectWnd = rectWnd;
  37.  
  38.     m_fInDebugger = fInDebugger;
  39.     m_fNotInDebugger = !fInDebugger; // gets set at refresh...
  40.  
  41. }
  42.  
  43.  
  44. CFileItem::~CFileItem()
  45. {
  46.  
  47. }
  48.  
  49.  
  50. BOOL CFileItem::IsDir(LPCTSTR szDir)
  51. {
  52.     if (m_strDir.CompareNoCase(szDir) == 0)
  53.         return(TRUE);
  54.     return(FALSE);
  55. }
  56.  
  57. void CFileItem::SetDir(LPCTSTR szDir)
  58. {
  59.     m_strDir = szDir;
  60.     m_strDir.MakeLower();
  61.     m_timeLast = CTime::GetCurrentTime();
  62. }
  63.  
  64. CString& CFileItem::GetFile()
  65. {
  66.     return(m_strFile);
  67. }
  68.  
  69. CTime& CFileItem::GetTime()
  70. {
  71.     return(m_timeLast);
  72. }
  73.  
  74. void CFileItem::SetFile(LPCTSTR szFile)
  75. {
  76.     m_strFile = szFile;
  77.     m_strFile.MakeLower();
  78.     m_timeLast = CTime::GetCurrentTime();
  79. }
  80.  
  81. BOOL CFileItem::IsFile(LPCTSTR szFile)
  82. {
  83.     if (m_strFile.CompareNoCase(szFile) == 0)
  84.         return(TRUE);
  85.     return(FALSE);
  86. }
  87.  
  88. CString& CFileItem::GetDir()
  89. {
  90.     return(m_strDir);
  91. }
  92.  
  93. void CFileItem::Touch(CRect& rectWnd, BOOL fInDebugger, BOOL fTouchTime)
  94. {
  95.     if (fTouchTime)
  96.     {
  97.         m_timeLast = CTime::GetCurrentTime();
  98.     }
  99.     if (fInDebugger)
  100.     {
  101.         m_rectWndDbg = rectWnd;
  102.         if (m_rectWnd.IsRectEmpty())
  103.         {
  104.             m_fOpenedInDebug = TRUE;
  105.         }
  106.     }
  107.     else
  108.     {
  109.         m_rectWnd = rectWnd;
  110.     }
  111. }
  112.  
  113. CRect& CFileItem::GetDbgRect()
  114. {
  115.     return(m_rectWndDbg);
  116. }
  117.  
  118. CRect& CFileItem::GetRect()
  119. {
  120.     return(m_rectWnd);
  121. }
  122.  
  123. BOOL CFileItem::FOpenedInDebug()
  124. {
  125.     return(m_fOpenedInDebug);
  126. }
  127.