home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / talk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.9 KB  |  138 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. // TALK.H : interface of the CTalkSiteMgr and CTalkNav classes
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifdef EDITOR
  23. #ifdef _WIN32
  24.  
  25. #ifndef TALK_H
  26. #define TALK_H
  27.  
  28. // Finds an existing site manager instance by enumerating existing windows
  29. BOOL FE_FindSiteMgr();
  30.  
  31. #define SM_QUERY_WINDOW  1
  32. #define SM_IS_ALIVE      2
  33. #define SM_IS_DEAD       3
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CTalkNav command target
  37.  
  38. class CTalkNav : public CCmdTarget
  39. {
  40.     DECLARE_DYNCREATE(CTalkNav)
  41.  
  42.     CTalkNav();           // protected constructor used by dynamic creation
  43.  
  44. // Attributes
  45. public:
  46.  
  47. // Operations
  48. public:
  49.  
  50. // Overrides
  51.     // ClassWizard generated virtual function overrides
  52.     //{{AFX_VIRTUAL(CTalkNav)
  53.     public:
  54.     virtual void OnFinalRelease();
  55.     //}}AFX_VIRTUAL
  56.  
  57. // Implementation
  58. protected:
  59.     virtual ~CTalkNav();
  60.  
  61.     // Generated message map functions
  62.     //{{AFX_MSG(CTalkNav)
  63.         // NOTE - the ClassWizard will add and remove member functions here.
  64.     //}}AFX_MSG
  65.  
  66.     DECLARE_MESSAGE_MAP()
  67.     DECLARE_OLECREATE(CTalkNav)
  68.  
  69.     // Generated OLE dispatch map functions
  70.     //{{AFX_DISPATCH(CTalkNav)
  71.     afx_msg long BrowseURL(LPCTSTR url);
  72.     afx_msg long EditURL(LPCTSTR url);
  73.     //}}AFX_DISPATCH
  74.     DECLARE_DISPATCH_MAP()
  75.     DECLARE_INTERFACE_MAP()
  76. };
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79. //
  80. //  ITalkSMClient usage:
  81. //
  82. //  Create an global instance of the class during app initialization:
  83. //
  84. //      talkSM = new ITalkSMClient;
  85. //
  86. //  You can query this instance to know whether SM server is registered:
  87. //
  88. //      if (talkSM->IsRegistered()) ...
  89. //
  90. //  During app intitialization, you need to find out whether SM is alive. Do
  91. //  this using "__talkSM_SM_IsAlive__" registered Windows message, with wParam
  92. //  set to 1. A return value of 0x015DEAD0 indicates that SM is alive. If this
  93. //  is the case, do the following:
  94. //
  95. //      talkSM->SetKnownSMState(TRUE);
  96. //
  97. //  While the navigator is running, SM may send a message telling it that it
  98. //  is either being openned or shut down. This will be done using the same
  99. //  registered Windows message "__talkSM_SM_IsAlive__" with wParam set to 2
  100. //  (for openning) or 3 (for shutting down). When this happens, you should
  101. //  call SetKnownSMState with either TRUE or FALSE as appropriate.
  102. //
  103. //  If these rules are followed, then you can just call SavedURL, LoadingURL,
  104. //  and BecomeActive as needed.
  105. //
  106. //
  107. /////////////////////////////////////////////////////////////////////////////
  108. // ITalkSMClient wrapper class
  109.  
  110. class ITalkSMClient : public COleDispatchDriver
  111. {
  112. private:
  113.     BOOL m_registered;
  114.     BOOL m_alive;
  115.     BOOL m_connected;
  116.     BOOL m_retried;
  117.  
  118.     BOOL Connect(void);
  119.     void Disconnect(void);
  120.     BOOL Reconnect(void);
  121.     BOOL IsConnected(void);
  122.  
  123. public:
  124.     ITalkSMClient(void);
  125.     ~ITalkSMClient(void);
  126.  
  127.     inline BOOL IsRegistered(void) {return m_registered;}
  128.     inline void SetKnownSMState(BOOL isAlive) {m_alive = isAlive;}
  129.  
  130.     long SavedURL(LPCTSTR url);
  131.     long LoadingURL(LPCTSTR url);
  132.     long BecomeActive();
  133. };
  134.  
  135. #endif //TALK_H
  136. #endif //_WIN32
  137. #endif //EDITOR
  138.