home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / fehist.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  7.1 KB  |  258 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 __FEHistory_H
  20. #define __FEHistory_H
  21.  
  22. //  Self contained history operations.
  23. class CHistory    {
  24. private:
  25.     HISTORY *m_pHistory;
  26. public:
  27.     CHistory(HISTORY *pUseThis = NULL, BOOL bClone = FALSE);
  28.     ~CHistory();
  29.     void SetHISTORY(HISTORY *pUsurp, BOOL bClone = FALSE);
  30.  
  31. public:
  32.     HISTORY *GetHISTORY();
  33.  
  34.     //  Duping.
  35. public:
  36.     static HISTORY *Clone(HISTORY *pTwin);
  37.     static HST_ENT *Clone(HST_ENT *pTwin);
  38.  
  39.     //  Comparison.
  40. public:
  41.     static BOOL Compare(HISTORY *p1, HISTORY *p2);
  42.     static BOOL Compare(HST_ENT *p1, HST_ENT *p2);
  43.     
  44.     //  Management
  45. public:
  46.     void Add(HST_ENT *pAdd);
  47.     BOOL Remove(HST_ENT *pRemove);
  48.     HST_ENT *Add(URL *pUrl);
  49.     void AddCurrent(URL *pUrl)  {
  50.         SetCurrent(Add(pUrl));
  51.     }
  52.  
  53.     //  State
  54. public:
  55.     void SetCurrent(HST_ENT *pCurrent);
  56.     void SetCurrentIndex(int iIndex);
  57.  
  58.     HST_ENT *GetCurrent();
  59.     HST_ENT *GetNext();
  60.     HST_ENT *GetPrev();
  61.     HST_ENT *GetIndex(int iIndex);
  62.  
  63.     //  Command UI helpers.
  64. public:
  65.     BOOL CanGoBack()    {
  66.         if(GetPrev())   {
  67.             return(TRUE);
  68.         }
  69.         return(FALSE);
  70.     }
  71.     BOOL CanGoForward()    {
  72.         if(GetNext())   {
  73.             return(TRUE);
  74.         }
  75.         return(FALSE);
  76.     }
  77.  
  78.     //  Indexing
  79. public:
  80.     int GetIndex(HST_ENT *pEntry);
  81.     int GetCurrentIndex()   {
  82.         return(GetIndex(GetCurrent()));
  83.     }
  84.     int GetNextIndex()   {
  85.         return(GetIndex(GetNext()));
  86.     }
  87.     int GetPrevIndex()   {
  88.         return(GetIndex(GetPrev()));
  89.     }
  90.  
  91.     //  URLs.
  92. public:
  93.     static void SetUrl(HST_ENT *pHist, URL *pUrl);
  94.     static URL *GetUrl(HST_ENT *pHist);
  95.     URL *GetCurrentUrl()    {
  96.         return(GetUrl(GetCurrent()));
  97.     }
  98.     URL *GetNextUrl()    {
  99.         return(GetUrl(GetNext()));
  100.     }
  101.     URL *GetPrevUrl()    {
  102.         return(GetUrl(GetPrev()));
  103.     }
  104.     URL *GetIndexUrl(int iIndex)    {
  105.         return(GetUrl(GetIndex(iIndex)));
  106.     }
  107.  
  108.     //  Title.
  109. public:
  110.     static int SetTitle(HST_ENT *pHist, const char *pTitle);
  111.     int SetCurrentTitle(const char *pTitle)   {
  112.         return(SetTitle(GetCurrent(), pTitle));
  113.     }
  114.     int SetNextTitle(const char *pTitle)   {
  115.         return(SetTitle(GetNext(), pTitle));
  116.     }
  117.     int SetPrevTitle(const char *pTitle)   {
  118.         return(SetTitle(GetPrev(), pTitle));
  119.     }
  120.     int SetIndexTitle(const char *pTitle, int iIndex)   {
  121.         return(SetTitle(GetIndex(iIndex), pTitle));
  122.     }
  123.     static const char *GetTitle(HST_ENT *pHist);
  124.     const char *GetCurrentTitle()   {
  125.         return(GetTitle(GetCurrent()));
  126.     }
  127.     const char *GetNextTitle()   {
  128.         return(GetTitle(GetNext()));
  129.     }
  130.     const char *GetPrevTitle()   {
  131.         return(GetTitle(GetPrev()));
  132.     }
  133.     const char *GetIndexTitle(int iIndex)   {
  134.         return(GetTitle(GetIndex(iIndex)));
  135.     }
  136.  
  137.     //  Form data.
  138. public:
  139.     static int SetFormData(HST_ENT *pHist, void *pData);
  140.     static void *GetFormData(HST_ENT *pHist);
  141.     void *GetCurrentFormData()  {
  142.         return(GetFormData(GetCurrent()));
  143.     }
  144.     void *GetNextFormData()  {
  145.         return(GetFormData(GetNext()));
  146.     }
  147.     void *GetPrevFormData()  {
  148.         return(GetFormData(GetPrev()));
  149.     }
  150.     void *GetIndexFormData(int iIndex)  {
  151.         return(GetFormData(GetIndex(iIndex)));
  152.     }
  153.  
  154.     //  Embed data.
  155. public:
  156.     static int SetEmbedData(HST_ENT *pHist, void *pData);
  157.     static void *GetEmbedData(HST_ENT *pHist);
  158.     void *GetCurrentEmbedData()  {
  159.         return(GetEmbedData(GetCurrent()));
  160.     }
  161.     void *GetNextEmbedData()  {
  162.         return(GetEmbedData(GetNext()));
  163.     }
  164.     void *GetPrevEmbedData()  {
  165.         return(GetEmbedData(GetPrev()));
  166.     }
  167.     void *GetIndexEmbedData(int iIndex)  {
  168.         return(GetEmbedData(GetIndex(iIndex)));
  169.     }
  170.  
  171.     //  Grid data.
  172. public:
  173.     static int SetGridData(HST_ENT *pHist, void *pData);
  174.     static void *GetGridData(HST_ENT *pHist);
  175.     void *GetCurrentGridData()  {
  176.         return(GetGridData(GetCurrent()));
  177.     }
  178.     void *GetNextGridData()  {
  179.         return(GetGridData(GetNext()));
  180.     }
  181.     void *GetPrevGridData()  {
  182.         return(GetGridData(GetPrev()));
  183.     }
  184.     void *GetIndexGridData(int iIndex)  {
  185.         return(GetGridData(GetIndex(iIndex)));
  186.     }
  187.  
  188.     //  Window data.
  189. public:
  190.     static int SetWindowData(HST_ENT *pHist, void *pData);
  191.     static void *GetWindowData(HST_ENT *pHist);
  192.     void *GetCurrentWindowData()  {
  193.         return(GetWindowData(GetCurrent()));
  194.     }
  195.     void *GetNextWindowData()  {
  196.         return(GetWindowData(GetNext()));
  197.     }
  198.     void *GetPrevWindowData()  {
  199.         return(GetWindowData(GetPrev()));
  200.     }
  201.     void *GetIndexWindowData(int iIndex)  {
  202.         return(GetWindowData(GetIndex(iIndex)));
  203.     }
  204.  
  205.     //  Applet data.
  206. public:
  207.     static int SetAppletData(HST_ENT *pHist, void *pData);
  208.     static void *GetAppletData(HST_ENT *pHist);
  209.     void *GetCurrentAppletData()  {
  210.         return(GetAppletData(GetCurrent()));
  211.     }
  212.     void *GetNextAppletData()  {
  213.         return(GetAppletData(GetNext()));
  214.     }
  215.     void *GetPrevAppletData()  {
  216.         return(GetAppletData(GetPrev()));
  217.     }
  218.     void *GetIndexAppletData(int iIndex)  {
  219.         return(GetAppletData(GetIndex(iIndex)));
  220.     }
  221.  
  222.     //  Document position.
  223. public:
  224.     static void SetPosition(HST_ENT *pHist, long lEleID);
  225.     void SetCurrentPosition(long lEleID)    {
  226.         SetPosition(GetCurrent(), lEleID);
  227.     }
  228.     void SetNextPosition(long lEleID)    {
  229.         SetPosition(GetNext(), lEleID);
  230.     }
  231.     void SetPrevPosition(long lEleID)    {
  232.         SetPosition(GetPrev(), lEleID);
  233.     }
  234.     void SetIndexPosition(long lEleID, int iIndex)    {
  235.         SetPosition(GetIndex(iIndex), lEleID);
  236.     }
  237.     static long GetPosition(HST_ENT *pHist);
  238.     long GetCurrentPosition()   {
  239.         return(GetPosition(GetCurrent()));
  240.     }
  241.     long GetNextPosition()   {
  242.         return(GetPosition(GetNext()));
  243.     }
  244.     long GetPrevPosition()   {
  245.         return(GetPosition(GetPrev()));
  246.     }
  247.     long GetIndexPosition(int iIndex)   {
  248.         return(GetPosition(GetIndex(iIndex)));
  249.     }
  250.  
  251.     //  History entry list manipulation.
  252. public:
  253.     static HST_ENT *GetNext(HST_ENT *pEntry);
  254.     static void SetNext(HST_ENT *pThis, HST_ENT *pNext);
  255. };
  256.  
  257. #endif // __FEHistory_H
  258.