home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / template.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.2 KB  |  183 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef TEMPLATE_H
  20. #define TEMPLATE_H
  21.  
  22. class CGenericDocTemplate : public CDocTemplate
  23. {
  24.     DECLARE_DYNAMIC(CGenericDocTemplate)
  25.  
  26. public:
  27.     CGenericDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  28.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  29.  
  30. public:
  31.     HMENU m_hMenuShared;
  32.     HACCEL m_hAccelTable;
  33.  
  34.      ~CGenericDocTemplate();
  35.  
  36. public: 
  37.     BOOL GetDocString(CString& rString, enum DocStringIndex index) const;
  38.     void AddDocument(CDocument *pDoc);
  39.     void RemoveDocument(CDocument *pDoc);
  40.     POSITION GetFirstDocPosition() const;
  41.     CDocument *GetNextDoc(POSITION& rPos) const;
  42.     CDocument* OpenDocumentFile(const char* pszPathName,
  43.                                 BOOL bMakeVisible = TRUE);
  44.     void SetDefaultTitle(CDocument* pDocument);
  45.  
  46. protected:
  47.     CPtrList m_docList;
  48.     UINT m_nUntitledCount;
  49.     BOOL m_bHideTitlebar;
  50.     BOOL m_bDependent;
  51.     BOOL m_bPopupWindow;
  52.     HWND m_hPopupParent;
  53.     BOOL m_bBorder;
  54. };
  55.  
  56.  
  57. //////////////////////////////////////////////////////////////////////////
  58. // Browser template support
  59. class CNetscapeDocTemplate : public CGenericDocTemplate
  60. {
  61.     DECLARE_DYNAMIC(CNetscapeDocTemplate)
  62.  
  63. // Constructors
  64. public:
  65.     CDocument* OpenDocumentFile(const char* pszPathName,
  66.                                 BOOL bMakeVisible = TRUE,
  67.                                 BOOL bHideTitlebar = FALSE,
  68.                                 BOOL bDependent = FALSE,
  69.                                 BOOL bPopupWindow = FALSE,
  70.                                 HWND hPopupParent = NULL)
  71.     {
  72.         m_bHideTitlebar = bHideTitlebar;
  73.         m_bDependent = bDependent;
  74.         m_bPopupWindow = bPopupWindow;
  75.         m_hPopupParent = hPopupParent;
  76.  
  77.         return CGenericDocTemplate::OpenDocumentFile(pszPathName, bMakeVisible);
  78.     }
  79.  
  80.     CNetscapeDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  81.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  82.  
  83. //    Overloaded
  84. public:
  85.     void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  86.                             BOOL bMakeVisible = TRUE);
  87. };
  88.  
  89. //////////////////////////////////////////////////////////////////////////
  90. // Edit template support
  91. class CNetscapeEditTemplate : public CGenericDocTemplate
  92. {
  93.     DECLARE_DYNAMIC(CNetscapeEditTemplate)
  94.  
  95. // Constructors
  96. public:
  97.     CNetscapeEditTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  98.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  99.  
  100. // Overloaded
  101. public:
  102.     void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  103.                             BOOL bMakeVisible = TRUE);
  104. };
  105.  
  106. //////////////////////////////////////////////////////////////////////////
  107. // Compose template support
  108. class CNetscapeComposeTemplate : public CGenericDocTemplate
  109. {
  110.     DECLARE_DYNAMIC(CNetscapeComposeTemplate)
  111.  
  112. protected:
  113.     int win_csid;
  114.  
  115. // Constructors
  116. public:
  117.     CNetscapeComposeTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  118.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  119.  
  120. // Overloaded
  121. public:
  122.     CDocument* OpenDocumentFile(const char* pszPathName,
  123.                                 int csid,
  124.                                 BOOL bMakeVisible = TRUE)
  125.     {
  126.         if( csid == CS_DEFAULT || csid == CS_UNKNOWN)
  127.             win_csid = INTL_DefaultWinCharSetID(0);
  128.         else
  129.             win_csid = csid;
  130.         return CGenericDocTemplate::OpenDocumentFile(pszPathName, bMakeVisible);
  131.     }
  132.     void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  133.         BOOL bMakeVisible = TRUE);
  134. };
  135.  
  136. //////////////////////////////////////////////////////////////////////////
  137. // Text Compose template support
  138. class CNetscapeTextComposeTemplate : public CGenericDocTemplate
  139. {
  140.     DECLARE_DYNAMIC(CNetscapeTextComposeTemplate)
  141.  
  142. protected:
  143.     int win_csid;
  144.  
  145. // Constructors
  146. public:
  147.     CNetscapeTextComposeTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  148.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  149.  
  150. // Overloaded
  151. public:
  152.     CDocument* OpenDocumentFile(const char* pszPathName,
  153.                                 int csid,
  154.                                 BOOL bMakeVisible = TRUE)
  155.     {
  156.         win_csid = csid;
  157.         return CGenericDocTemplate::OpenDocumentFile(pszPathName, bMakeVisible);
  158.     }
  159.     void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  160.         BOOL bMakeVisible = TRUE);
  161. };
  162.  
  163. //////////////////////////////////////////////////////////////////////////
  164. // Addr template support
  165. class CNetscapeAddrTemplate : public CGenericDocTemplate
  166. {
  167.     DECLARE_DYNAMIC(CNetscapeAddrTemplate)
  168.  
  169. protected:
  170.     int win_csid;
  171.  
  172. // Constructors
  173. public:
  174.     CNetscapeAddrTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
  175.         CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  176.  
  177. // Overloaded
  178. public:
  179.     void InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,
  180.         BOOL bMakeVisible = TRUE);
  181. };
  182. #endif     
  183.