home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / metkit / setup.exe / EXAMPLES / CATFISH / CATFISH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-08  |  4.0 KB  |  146 lines

  1. //    Copyright (C) 1996, 1997 Meta Four Software.  All rights reserved.
  2. //
  3. //    Main CatFish application sample code
  4. //
  5. //! rev="$Id: catfish.h,v 1.4 1997/05/27 00:06:08 jcw Rel $"
  6.  
  7. #ifndef __AFXWIN_H__
  8.     #error include 'stdafx.h' before including this file for PCH
  9. #endif
  10.  
  11. #include "resource.h"       // main symbols
  12. #include "finddlg.h"
  13.  
  14. #define FILE_TYPE   ".cf4"
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18.     extern CString GetCatalogDate(CString& catName);
  19.     
  20. /////////////////////////////////////////////////////////////////////////////
  21. // The main application class
  22.  
  23. class CTheApp : public CWinApp
  24. {
  25. public:
  26.     CTheApp ();
  27.     
  28.     virtual BOOL InitInstance();
  29.     virtual BOOL ProcessMessageFilter(int code, LPMSG lpMsg);
  30. };
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // The main dialog window class
  34.  
  35. class CMainDlgWindow : public CDialog
  36. {
  37. private:
  38.         // a small font used for several dialog box items
  39.     CFont m_font;
  40.       
  41.         // these are set during listbox owner-draw
  42.     DRAWITEMSTRUCT* m_item;
  43.     CDC* m_dc;
  44.     
  45.         // set to the current catalog
  46.     c4_Storage* m_storage;
  47.     c4_View m_currCat;
  48.     CString m_currCatName;
  49.     
  50.         // the directory currently shown in the tree list
  51.     int m_treeDir;
  52.     
  53.         // the directory currently shown in the file list
  54.     int m_fileDir;
  55.     c4_View m_fileView;
  56.     c4_View m_fileSort;
  57.  
  58.         // cumulative totals, one entry for each directory in the catalog
  59.     CWordArray m_dirCounts;
  60.     CWordArray m_fileCounts;
  61.     CWordArray m_lastDates;
  62.     CDWordArray m_kiloTotals;
  63.     
  64.         // the find dialog is a member so it can remember the current settings
  65.     CFindDialog m_findDlg;
  66.     
  67.         // sort order of the file list
  68.     c4_Property* m_sortProp;
  69.     bool m_sortReverse;
  70.     
  71.         // true if the application should start with a find window
  72.     bool m_startFind; 
  73.  
  74.     void ConstructTitle();
  75.  
  76.     void SetCatalog(const char* catName);
  77.     void SetTreeDir(int dirNum);           
  78.     void SetFileDir(int dirNum);           
  79.     
  80.     void DrawItemText(const CString& text, int off =0);
  81.     void OnDrawCatItem(int n);
  82.     void OnDrawDirItem(int n);
  83.     void OnDrawFileItem(int n);
  84.  
  85.     void AdjustDisplay(CCmdUI&, int, c4_Property&, int, const char*);
  86.     void SortFileList(c4_Property& prop_, bool toggle_ =false);
  87.  
  88.     void DoSetup(bool now);
  89.  
  90. public:
  91.     CMainDlgWindow ();
  92.     ~CMainDlgWindow ();
  93.     
  94.     int Execute(bool find);
  95.  
  96.     //{{AFX_DATA(CMainDlgWindow)
  97.     enum { IDD = IDD_MAIN_DIALOG };
  98.     CButton m_findBtn;
  99.     CStatic m_pathFrame;
  100.     CListBox    m_treeList;
  101.     CListBox    m_fileList;
  102.     CListBox    m_catList;
  103.     CStatic m_msgText;
  104.     CStatic m_infoText;
  105.     CStatic m_treePath;
  106.     //}}AFX_DATA
  107.  
  108.     //{{AFX_VIRTUAL(CMainDlgWindow)
  109.     virtual void DoDataExchange(CDataExchange* pDX);
  110.     //}}AFX_VIRTUAL
  111.  
  112.     virtual void OnCancel();
  113.  
  114. protected:
  115.     //{{AFX_MSG(CMainDlgWindow)
  116.     virtual BOOL OnInitDialog();
  117.     afx_msg void OnClose();
  118.     afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
  119.     afx_msg void OnSelchangeCatList();
  120.     afx_msg void OnSelchangeTreeList();
  121.     afx_msg void OnDblclkTreeList();
  122.     afx_msg void OnSelchangeFileList();
  123.     afx_msg void OnFindBtn();
  124.     afx_msg void OnSetupBtn();
  125.     afx_msg void OnDblclkFileList();
  126.     afx_msg void OnFindNext();
  127.     afx_msg void OnFindPrev();
  128.     afx_msg void OnSortByName();
  129.     afx_msg void OnSortBySize();
  130.     afx_msg void OnSortByDate();
  131.     afx_msg void OnSortReverse();
  132.     afx_msg void OnDestroy();
  133.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  134.     afx_msg void OnAppAbout();
  135.     afx_msg void OnFileExport();
  136.     afx_msg void OnFileRefresh();
  137.     afx_msg void OnFileExit();
  138.     //}}AFX_MSG
  139.     afx_msg void OnHelp();
  140.     DECLARE_MESSAGE_MAP()
  141.     
  142.     friend class CFindState;
  143. };
  144.  
  145. /////////////////////////////////////////////////////////////////////////////
  146.