home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / shist.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.5 KB  |  164 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 SHIST_H
  20. #define SHIST_H
  21.  
  22. #include "xp_list.h"
  23. #include "ntypes.h"
  24. #include "hotlist.h"
  25.  
  26.  
  27. /* see shistele.h for the structure definitions. :(
  28.  */
  29.  
  30. /* --------------------------------------------------------------------------
  31.  * Session history module routines
  32.  */
  33.  
  34. struct MWContext_;
  35. struct URL_Struct_;
  36.  
  37. #define HIST_NEW_OBJECT   0
  38. #define HIST_MOVE_FORWARD 1
  39. #define HIST_MOVE_BACK    2
  40.  
  41. /* Max length of the URL when title is unknown */
  42. #define HIST_MAX_URL_LEN    30
  43.  
  44.  
  45. XP_BEGIN_PROTOS
  46.  
  47. /* Front-End Specialized Functions */
  48. extern void             SHIST_InitSession(struct MWContext_ * ctxt);
  49. extern void SHIST_EndSession(MWContext * ctxt);
  50.  
  51. /* copys all the session data from the old context into the
  52.  * new context.  Does not effect data in old_context session history
  53.  *
  54.  * if new_context has not had SHIST_InitSession called for it
  55.  * it will be called to initalize it.
  56.  */
  57. extern void
  58. SHIST_CopySession(MWContext * new_context, MWContext * old_context);
  59.  
  60. /* make a new copy of the given history entry */
  61. extern History_entry *  SHIST_CloneEntry(History_entry * old_entry);
  62.  
  63. /* 
  64.  * someone (like another thread) needs to keep this entry around for
  65.  *   a while, increase the reference count so it doesn't disappear
  66.  *   on us.  Return the held reference to entry.  Tolerate NULL entry.
  67.  */
  68. extern History_entry *  SHIST_HoldEntry(History_entry * entry); 
  69.  
  70. #define SHIST_DropEntry SHIST_FreeHistoryEntry
  71.  
  72.                         /* these update position and buttons! */
  73. extern void             SHIST_AddDocument(struct MWContext_ * ctxt, History_entry * entry);
  74. extern History_entry *  SHIST_GetPrevious(struct MWContext_ * ctxt);
  75. extern History_entry *  SHIST_GetNext(struct MWContext_ * ctxt);
  76.                         /* convenience functions */
  77. extern char* SHIST_StripProtocol ( char* inURL ) ;
  78. extern History_entry *  SHIST_CreateHistoryEntry (struct URL_Struct_ * URL_s, char * title);
  79. extern URL_Struct *     SHIST_CreateURLStructFromHistoryEntry(struct MWContext_ * ctxt, 
  80.                                                               History_entry * entry);
  81. extern URL_Struct *     SHIST_CreateWysiwygURLStruct(struct MWContext_ * ctxt,
  82.                                                      History_entry * entry);
  83. extern BM_Entry*    SHIST_CreateHotlistStructFromHistoryEntry(History_entry * h);
  84.  
  85. extern void SHIST_FreeHistoryEntry (MWContext * ctxt, History_entry * entry);
  86.  
  87.  
  88. /* Standard History Functions */
  89. extern int              SHIST_CanGoBack(MWContext * ctxt);
  90. extern int              SHIST_CanGoForward(MWContext * ctxt);
  91. extern History_entry *  SHIST_GetEntry(History * hist, int entry_number);
  92. extern History_entry *  SHIST_GetCurrent(History * hist);
  93. extern XP_List *        SHIST_GetList(MWContext * ctxt);
  94.  
  95. /* Functions to handle Page Services functionality */
  96. extern int                SHIST_CurrentHandlesPageServices(MWContext * ctxt);
  97. extern char *            SHIST_GetCurrentPageServicesURL(MWContext * ctxt);
  98.  
  99. /* sets the current doc pointer to the index specified in the call
  100.  *
  101.  * entry numbering begins at one.
  102.  */
  103. extern void SHIST_SetCurrent(History * hist, int entry_number);
  104.  
  105. /* set the title of the current document
  106.  *
  107.  * TODO: All FEs should use the XP_WIN version asap.
  108.  */
  109. #if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2)
  110.  extern void SHIST_SetTitleOfCurrentDoc(MWContext * context);
  111. #else
  112.  extern void SHIST_SetTitleOfCurrentDoc(History * hist, char * title);
  113. #endif
  114.  
  115. /* set the layout specific form data neccessary to recreate the user settable
  116.  * entries within a form
  117.  */
  118. PUBLIC void
  119. SHIST_SetCurrentDocFormListData(MWContext * context, void * form_data);
  120.  
  121. /* set the layout-plugin specific embed data neccessary to recreate the
  122.  * last session state within the embedded object.
  123.  */
  124. PUBLIC void
  125. SHIST_SetCurrentDocEmbedListData(MWContext * context, void * embed_data);
  126.  
  127. /* set the layout grid data neccessary to recreate the
  128.  * grid when revisited through history.
  129.  */
  130. PUBLIC void
  131. SHIST_SetCurrentDocGridData(MWContext * context, void * grid_data);
  132.  
  133. /* set the window object for a grid being resized.
  134.  */
  135. PUBLIC void
  136. SHIST_SetCurrentDocWindowData(MWContext * context, void * window_data);
  137.  
  138. /* set the layout applet data neccessary to recreate the
  139.  * applet when revisited through history.
  140.  */
  141. PUBLIC void
  142. SHIST_SetCurrentDocAppletData(MWContext * context, void * applet_data);
  143.  
  144. /* set the position of the current document
  145.  */
  146. extern void SHIST_SetPositionOfCurrentDoc(History * hist, int32 position_tag);
  147.  
  148. /* gets an index associated with the entry
  149.  *
  150.  * entry numbering begins at one.
  151.  *
  152.  * zero is returned if object not found
  153.  */
  154. extern int SHIST_GetIndex(History * hist, History_entry * entry);
  155.  
  156. /* return the n'th object
  157.  */
  158. extern History_entry * SHIST_GetObjectNum(History * hist, int n);
  159.  
  160. XP_END_PROTOS
  161.  
  162.  
  163. #endif /* SHIST_H */
  164.