home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / activedocument / dfv / mwclass.h < prev    next >
C/C++ Source or Header  |  1995-02-13  |  3KB  |  105 lines

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. //  File:       mwclass.h
  7. //
  8. //  Contents:   definition of the main window class
  9. //
  10. //  Classes:    CMainWindow
  11. //
  12. //  Functions:  Exists
  13. //
  14. //  History:    6-08-94   stevebl   Created
  15. //
  16. //----------------------------------------------------------------------------
  17.  
  18. #ifndef __MWCLASS_H__
  19. #define __MWCLASS_H__
  20.  
  21. #include <cwindow.h>
  22. #include <commdlg.h>
  23.  
  24. #ifdef __cplusplus
  25.  
  26. int Exists(TCHAR *sz);
  27.  
  28.  
  29. // List Box Element Structure
  30. struct TAG_LISTBOXELEMENT
  31. {
  32. #define LBE_STORAGE     STGTY_STORAGE
  33. #define LBE_STREAM      STGTY_STREAM
  34.     unsigned uType;
  35.     BOOL fOpen;
  36.     void * pInterface;
  37.     union {
  38.         ULONG nChildren;
  39.         HWND hwndView;
  40.     };
  41.     unsigned uIndent;
  42.     LPOLESTR pwcsName;
  43. };
  44. typedef struct TAG_LISTBOXELEMENT LISTBOXELEMENT;
  45.  
  46. //+---------------------------------------------------------------------------
  47. //
  48. //  Class:      CMainWindow
  49. //
  50. //  Purpose:    Code for the main docfile viewer window and the main menu.
  51. //
  52. //  Interface:  CMainWindow          -- constructor
  53. //              InitInstance         -- instantiates the docfile viewer window
  54. //              Toggle               -- toggles a selection
  55. //              Expand               -- expands a selection
  56. //              Collapse             -- collapses a selection
  57. //              ExpandAll            -- expands an entire tree
  58. //              OpenFile             -- trys to load the docfile in _szFileName
  59. //
  60. //  History:    6-27-94   stevebl   Created
  61. //
  62. //  Notes:      only the public interface is listed here
  63. //
  64. //----------------------------------------------------------------------------
  65.  
  66. class CMainWindow: public CHlprWindow
  67. {
  68. public:
  69.     CMainWindow();
  70.     BOOL InitInstance(HINSTANCE, int);
  71.     void Toggle(long lIndex);
  72.     void Expand(long lIndex);
  73.     void Collapse(long lIndex);
  74.     void ExpandAll(long lIndex);
  75.     void OpenFile(void);
  76.     TCHAR _szFileName[MAX_PATH];
  77. protected:
  78.     ~CMainWindow();
  79.     LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  80. private:
  81.     LRESULT DoMenu(WPARAM wParam, LPARAM lParam);
  82.     LISTBOXELEMENT * CreateStreamElement(IStream * pstm);
  83.     LISTBOXELEMENT * CreateStorageElement(IStorage * pstg);
  84.     void DeleteElement(LISTBOXELEMENT * plbe);
  85.     BOOL LoadBitmaps(void);
  86.  
  87.     HWND _hlb;
  88.     HBITMAP _hbmpStorage;
  89.     HBITMAP _hbmpStream;
  90.     COLORREF _crTextHigh;
  91.     COLORREF _crBkHigh;
  92.     COLORREF _crTextNorm;
  93.     COLORREF _crBkNorm;
  94.     WORD _wWidth;
  95.     OPENFILENAME _ofnFile;
  96.     TCHAR _szFileTitle[MAX_PATH];
  97.     TEXTMETRIC _tm;
  98.     UINT _cyBitmap;
  99.     TCHAR _szHelpFile[MAX_PATH];
  100. };
  101.  
  102. #endif // __cplusplus
  103.  
  104. #endif // __MWCLASS_H__
  105.