home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xhyper10.zip / XHyper_v1.0 / src / HyperView.h < prev    next >
C/C++ Source or Header  |  1992-12-08  |  4KB  |  125 lines

  1. /*
  2.  * Copyright (c) 1992 U.S. Geological Survey (USGS)
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided that
  6.  * the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of USGS not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  USGS makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * USGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  15.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL USGS
  16.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  18.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  19.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20.  *
  21.  */
  22.  
  23. /*
  24.  * HyperViewer
  25.  */
  26. #ifndef HyperViewer_h
  27. #define HyperViewer_h
  28.  
  29. #include <InterViews/window.h>
  30. #include <InterViews/handler.h>
  31. #include <stdio.h>
  32.  
  33. class Button;
  34. class Item;
  35. class Application;
  36. class Font;
  37. class Color;
  38. class Hypertext_Stack;
  39. class ItemView;
  40. class TextItem;
  41. class TextItem_List;
  42. class TextView;
  43. class TabularItem;
  44. class TOC_List;
  45. class PSFigItem;
  46. class RefItem;
  47. class PageButton;
  48. class PagenumberItem;
  49. class CounterItem;
  50. class LabelItem;
  51. class FloatItem;
  52.  
  53. //
  54. //  *** Table of Contents item
  55. //
  56. class TOCItem
  57.    {
  58.    public:
  59.       float     _section;       // section number
  60.       char*     _filename;      // file containing section
  61.       char*     _tag;           // hypertext tag
  62.       int       _offset;        // character offset into document
  63.    };
  64.  
  65.  
  66. //
  67. //  *** List of currently loaded TextViews
  68. //
  69. class TextItem
  70.    {
  71.    public:
  72.       TextView*      _view;    //  View of MML file
  73.    };
  74.  
  75. //
  76. //  *** Stack entry of previous hypertext sources
  77. //
  78. class HyperSource
  79.    {
  80.    public:
  81.       int    _item;         // index of text item 
  82.       int    _page;         // character offsets
  83.    };
  84.  
  85. class HyperViewer : public ApplicationWindow, public Handler {
  86. public:
  87.     HyperViewer (const char*);        // constructor
  88.     virtual void  event (Event&);    // catches mouse/keyboard events
  89.     virtual void  command(const char*); // handles specific user requests
  90.     virtual void  page_to(int);        // changes the viewed page
  91.     virtual void  updateTOC(FILE*, int);// update offet in TOC list 
  92.     virtual void  nextview();         // view next file in TOC
  93.     virtual void  prevview();         // view prev file in TOC
  94.     virtual void  pop();         // pop to hypertext source 
  95.     virtual       ~HyperViewer ();    // destructor
  96.     virtual void   hypertext(int);    // hypertext to given section
  97.     int          TOC(char*);        // find TOC index for given tag
  98.     TOC_List*     _toc;                 // Table of contents items
  99.  
  100. protected:
  101.  
  102.     virtual void      jump_to(int);     // jump to hypertext offset
  103.     virtual void      readTOC(FILE*);   // read the Table of Contents
  104.     char*             _home;        // home directory of document
  105.     int              _current_page;    // currently viewed page
  106.     int              _page_count;    // total number of pages in doc
  107.     int               _item;            // current TextView
  108.  
  109.  
  110.     class Patch*      _top;        // top level patch
  111.     class Patch*      _body_patch;    // helpview patch
  112.     class Patch*      _footer_patch;    // items below viewed page
  113.     class Patch*      _page_patch;    // patch of text view
  114.     TextItem_List*    _textlist;    // text view
  115.     Hypertext_Stack*  _hyperstack;    // stack of hypertext sources
  116.     Button*           _prev_page;    // previous page button
  117.     Button*           _next_page;    // next page button
  118.     Button*           _pop;        // pop to prehypertext location
  119.     Button*           _print;        // print page button
  120.     Button*           _quit;        // exit helpview
  121. };
  122.  
  123. #endif
  124.  
  125.