/SDK/EXES/INSTALL VISUAL 6 SDK/INPUT/6.0_980820/MSDN/VCPP/SMPL/MSDN98/98VSa/1036/SAMPLES/VC98/sdk/com/inole2/chap13/cosmo/cosmo.h

https://github.com/Kochise/dreamcast-docs · C Header · 229 lines · 116 code · 69 blank · 44 comment · 0 complexity · f63be30f323d62978fb4fbc91e5ffc0b MD5 · raw file

  1. /*
  2. * COSMO.H
  3. * Cosmo Chapter 13
  4. *
  5. * Single include file that pulls in everything needed for other
  6. * source files in the Cosmo 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. #ifndef _COSMO_H_
  15. #define _COSMO_H_
  16. #define INC_CLASSLIB
  17. //CHAPTER13MOD
  18. #define CHAPTER13
  19. //End CHAPTER13MOD
  20. #include <inole.h>
  21. #include "resource.h"
  22. //Get the editor window information.
  23. #include "polyline.h"
  24. //COSMO.CPP: Frame object that creates a main window
  25. class CCosmoFrame : public CFrame
  26. {
  27. private:
  28. HBITMAP m_hBmpLines[5]; //Menu item bitmaps
  29. UINT m_uIDCurLine; //Current line selection
  30. BOOL m_fInitialized; //Did OleInitalize work?
  31. LPCLASSFACTORY m_pIClassDataTran; //For locking
  32. protected:
  33. //Overridable for creating a CClient for this frame
  34. virtual PCClient CreateCClient(void);
  35. virtual BOOL RegisterAllClasses(void);
  36. virtual BOOL PreShowInit(void);
  37. virtual UINT CreateToolbar(void);
  38. virtual LRESULT OnCommand(HWND, WPARAM, LPARAM);
  39. virtual void OnDocumentDataChange(PCDocument);
  40. virtual void OnDocumentActivate(PCDocument);
  41. //New for this class
  42. virtual void CreateLineMenu(void);
  43. public:
  44. CCosmoFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  45. virtual ~CCosmoFrame(void);
  46. //Overrides
  47. virtual BOOL Init(PFRAMEINIT);
  48. virtual void UpdateMenus(HMENU, UINT);
  49. virtual void UpdateToolbar(void);
  50. //New for this class
  51. virtual void CheckLineSelection(UINT);
  52. };
  53. typedef CCosmoFrame *PCCosmoFrame;
  54. //CLIENT.CPP
  55. /*
  56. * The only reason we have a derived class here is to override
  57. * CreateCDocument so we can create our own type as well as
  58. * overriding NewDocument to perform one other piece of work once
  59. * the document's been created.
  60. */
  61. class CCosmoClient : public CClient
  62. {
  63. protected:
  64. //Overridable for creating a new CDocument
  65. virtual PCDocument CreateCDocument(void);
  66. public:
  67. CCosmoClient(HINSTANCE, PCFrame);
  68. virtual ~CCosmoClient(void);
  69. virtual PCDocument NewDocument(BOOL);
  70. };
  71. typedef CCosmoClient *PCCosmoClient;
  72. //DOCUMENT.CPP
  73. //Constant ID for the window polyline that lives in a document
  74. #define ID_POLYLINE 10
  75. class CCosmoDoc : public CDocument
  76. {
  77. friend class CPolylineAdviseSink;
  78. //CHAPTER13MOD
  79. //These need access to FQueryPasteFromData, PasteFromData
  80. friend class CDropTarget;
  81. friend class CDropSource;
  82. //End CHAPTER13MOD
  83. protected:
  84. UINT m_uPrevSize; //Last WM_SIZE wParam
  85. LONG m_lVer; //Loaded Polyline ver
  86. PCPolyline m_pPL; //Polyline window here
  87. PCPolylineAdviseSink m_pPLAdv; //Advises from Polyline
  88. //CHAPTER13MOD
  89. class CDropTarget *m_pDropTarget; //Registered target
  90. BOOL m_fDragSource; //Source==target?
  91. //End CHAPTER13MOD
  92. protected:
  93. virtual BOOL FMessageHook(HWND, UINT, WPARAM, LPARAM
  94. , LRESULT *);
  95. virtual BOOL FQueryPasteFromData(LPDATAOBJECT);
  96. virtual BOOL PasteFromData(LPDATAOBJECT);
  97. //CHAPTER13MOD
  98. LPDATAOBJECT TransferObjectCreate(BOOL);
  99. void DropSelectTargetWindow(void);
  100. //End CHAPTER13MOD
  101. public:
  102. CCosmoDoc(HINSTANCE, PCFrame, PCDocumentAdviseSink);
  103. virtual ~CCosmoDoc(void);
  104. virtual BOOL Init(PDOCUMENTINIT);
  105. virtual void Clear(void);
  106. virtual UINT Load(BOOL, LPTSTR);
  107. virtual UINT Save(UINT, LPTSTR);
  108. virtual void Undo(void);
  109. virtual BOOL Clip(HWND, BOOL);
  110. virtual HGLOBAL RenderFormat(UINT);
  111. virtual BOOL FQueryPaste(void);
  112. virtual BOOL Paste(HWND);
  113. virtual COLORREF ColorSet(UINT, COLORREF);
  114. virtual COLORREF ColorGet(UINT);
  115. virtual UINT LineStyleSet(UINT);
  116. virtual UINT LineStyleGet(void);
  117. };
  118. typedef CCosmoDoc *PCCosmoDoc;
  119. //These color indices wrap the polyline definitions
  120. #define DOCCOLOR_BACKGROUND POLYLINECOLOR_BACKGROUND
  121. #define DOCCOLOR_LINE POLYLINECOLOR_LINE
  122. //CHAPTER13MOD
  123. //Drag-drop interfaces we need in the document
  124. class CDropTarget : public IDropTarget
  125. {
  126. protected:
  127. ULONG m_cRef;
  128. PCCosmoDoc m_pDoc;
  129. LPDATAOBJECT m_pIDataObject; //From DragEnter
  130. public:
  131. CDropTarget(PCCosmoDoc);
  132. ~CDropTarget(void);
  133. //IDropTarget interface members
  134. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  135. STDMETHODIMP_(ULONG) AddRef(void);
  136. STDMETHODIMP_(ULONG) Release(void);
  137. STDMETHODIMP DragEnter(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
  138. STDMETHODIMP DragOver(DWORD, POINTL, LPDWORD);
  139. STDMETHODIMP DragLeave(void);
  140. STDMETHODIMP Drop(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
  141. };
  142. typedef CDropTarget *PCDropTarget;
  143. class CDropSource : public IDropSource
  144. {
  145. protected:
  146. ULONG m_cRef;
  147. PCCosmoDoc m_pDoc;
  148. public:
  149. CDropSource(PCCosmoDoc);
  150. ~CDropSource(void);
  151. //IDropSource interface members
  152. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  153. STDMETHODIMP_(ULONG) AddRef(void);
  154. STDMETHODIMP_(ULONG) Release(void);
  155. STDMETHODIMP QueryContinueDrag(BOOL, DWORD);
  156. STDMETHODIMP GiveFeedback(DWORD);
  157. };
  158. typedef CDropSource *PCDropSource;
  159. //End CHAPTER13MOD
  160. #endif //_COSMO_H_