home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap01 / patron / patron.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  3KB  |  133 lines

  1. /*
  2.  * PATRON.H
  3.  * Patron Chapter 1
  4.  *
  5.  * Single include file that pulls in everything needed for other
  6.  * source files in the application.
  7.  *
  8.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Microsoft
  11.  * Internet  :  kraigb@microsoft.com
  12.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  13.  */
  14.  
  15.  
  16. #ifndef _PATRON_H_
  17. #define _PATRON_H_
  18.  
  19. #define INC_CLASSLIB
  20. #define CHAPTER1
  21. #include <inole.h>
  22. #include "resource.h"
  23.  
  24. //Get editor window information
  25. #include "pages.h"
  26.  
  27.  
  28. /*
  29.  * UINT value such that adding one produces zero.  Portable to Win32.
  30.  * This is used to represent a non-existent zero-based UINT value
  31.  */
  32. #define NOVALUE                     ((UINT)-1)
  33.  
  34.  
  35. //PATRON.CPP:  Frame object that creates a main window
  36.  
  37. class CPatronFrame : public CFrame
  38.     {
  39.     protected:
  40.         //Overridable for creating a CPatronClient
  41.         virtual PCClient    CreateCClient(void);
  42.  
  43.         virtual BOOL        RegisterAllClasses(void);
  44.         virtual UINT        CreateToolbar(void);
  45.         virtual LRESULT     OnCommand(HWND, WPARAM, LPARAM);
  46.  
  47.     public:
  48.         CPatronFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  49.         virtual ~CPatronFrame(void);
  50.  
  51.         //Overrides
  52.         virtual void        UpdateMenus(HMENU, UINT);
  53.         virtual void        UpdateToolbar(void);
  54.  
  55.     };
  56.  
  57.  
  58. typedef CPatronFrame *PCPatronFrame;
  59.  
  60.  
  61.  
  62.  
  63.  
  64. //CLIENT.CPP
  65.  
  66. /*
  67.  * The only reason we have a derived class here is to override
  68.  * CreateCDocument so we can create our own type as well as
  69.  * overriding NewDocument to perform one other piece of work once
  70.  * the document's been created.
  71.  */
  72.  
  73. class CPatronClient : public CClient
  74.     {
  75.     protected:
  76.         //Overridable for creating a new CDocument
  77.         virtual PCDocument CreateCDocument(void);
  78.  
  79.     public:
  80.         CPatronClient(HINSTANCE, PCFrame);
  81.         virtual ~CPatronClient(void);
  82.     };
  83.  
  84.  
  85. typedef CPatronClient *PCPatronClient;
  86.  
  87.  
  88.  
  89.  
  90. //DOCUMENT.CPP
  91.  
  92. //Constant ID for the pages window that lives in a document window
  93. #define ID_PAGES            723
  94.  
  95.  
  96. class CPatronDoc : public CDocument
  97.     {
  98.     protected:
  99.         LONG            m_lVer;         //Loaded data version
  100.         PCPages         m_pPG;          //Pages window in us
  101.  
  102.     protected:
  103.         virtual BOOL    FMessageHook(HWND, UINT, WPARAM, LPARAM
  104.             , LRESULT *);
  105.  
  106.     public:
  107.         CPatronDoc(HINSTANCE, PCFrame, PCDocumentAdviseSink);
  108.         virtual ~CPatronDoc(void);
  109.  
  110.         virtual BOOL    Init(PDOCUMENTINIT);
  111.         virtual void    Clear(void);
  112.  
  113.         virtual UINT    Load(BOOL, LPTSTR);
  114.  
  115.         virtual BOOL    Print(HWND);
  116.         virtual UINT    PrinterSetup(HWND, BOOL);
  117.  
  118.         virtual UINT    NewPage(void);
  119.         virtual UINT    DeletePage(void);
  120.         virtual UINT    NextPage(void);
  121.         virtual UINT    PreviousPage(void);
  122.         virtual UINT    FirstPage(void);
  123.         virtual UINT    LastPage(void);
  124.     };
  125.  
  126. typedef CPatronDoc *PCPatronDoc;
  127.  
  128. //Hook for Print Dialog to hide Setup... button
  129. UINT CALLBACK PrintDlgHook(HWND, UINT, WPARAM, LPARAM);
  130.  
  131.  
  132. #endif //_PATRON_H_
  133.