home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK3 / MFC / SAMPLES / FILEVIEW / FILEVIEW.H$ / fileview
Encoding:
Text File  |  1992-03-05  |  2.8 KB  |  108 lines

  1. // fileview.h : Declares the class interfaces for the application.
  2. //          Fileview is a program which can display the contents of
  3. //          a text-only file regardless of its size.
  4. //
  5. // This is a part of the Microsoft Foundation Classes C++ library.
  6. // Copyright (C) 1992 Microsoft Corporation
  7. // All rights reserved.
  8. //
  9. // This source code is only intended as a supplement to the
  10. // Microsoft Foundation Classes Reference and Microsoft
  11. // QuickHelp documentation provided with the library.
  12. // See these sources for detailed information regarding the
  13. // Microsoft Foundation Classes product.
  14.  
  15. #ifndef __FILEVIEW_H__
  16. #define __FILEVIEW_H__
  17.  
  18. #include <afxwin.h>
  19. #include "resource.h"
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // Derived class to handle large line files
  23. class CLineFile : public CStdioFile
  24. {
  25.     DECLARE_DYNAMIC(CLineFile)
  26. public:
  27. // Constructors
  28.                     CLineFile();
  29.                     CLineFile(const char* pszFileName, UINT nOpenFlags);
  30.  
  31. // Overridables
  32.  
  33.     virtual LONG    NextLine(char FAR* lpsz, UINT nMax);
  34.     virtual LONG    BackLines(char FAR* lpsz, UINT nMax, UINT nLines);
  35.     virtual LONG    LineNear(char FAR* lpsz, UINT nMax, LONG  lOffset);
  36.     virtual LONG    SetBegin(LONG lnewBegin);
  37.             LONG    GetBegin() { return m_lBeginLine; };
  38.  
  39.  
  40. // Implementation
  41.     virtual         ~CLineFile();
  42.  
  43. private:
  44.     LONG    m_lBeginLine;   // 0 for beginning of file
  45.                             // -1 for don't know
  46.                             // offset of beginning of a line
  47. };
  48.  
  49.  
  50. // CMainWindow:
  51. // See fileview.cpp for the code to the member functions and the
  52. // message map.
  53. //
  54.  
  55. class CMainWindow : public CFrameWnd
  56. {
  57. public:
  58.     CMainWindow();
  59.     ~CMainWindow();
  60.  
  61.     afx_msg int  OnCreate(LPCREATESTRUCT lpcs);
  62.     afx_msg void OnPaint();
  63.     afx_msg void OnAbout();
  64.     afx_msg void OnOpen();
  65.     afx_msg void OnExit();
  66.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  67.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  68.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  69.  
  70.     DECLARE_MESSAGE_MAP()
  71.  
  72. private:
  73.     CLineFile*  m_pMyFile;
  74.     short       m_nVScrollPos;
  75.     short       m_nHScrollPos;
  76.  
  77.  
  78.     LONG        m_lTopLine;
  79.     LONG        m_lFileSize;
  80.  
  81.     UINT        m_nCxChar;
  82.     UINT        m_nCyChar;
  83.     UINT        m_nLinesPainted;
  84.  
  85. protected:
  86.     BOOL    FileDlg(BOOL bOpen, int nMaxFile, LPSTR szFile,
  87.                     int nMaxFileTitle, LPSTR szFileTitle);
  88.  
  89. };
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92.  
  93. // CTheApp:
  94. // See fileview.cpp for the code to the InitInstance member function.
  95. //
  96.  
  97. class CTheApp : public CWinApp
  98. {
  99. public:
  100.     BOOL InitInstance();
  101. };
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104.  
  105. #define SCROLLMAX 1000
  106.  
  107. #endif // __FILEVIEW_H__
  108.