HTIcons.h
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:4k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /*                                                                            Icon Management
  2.                                      ICON MANAGEMENT
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    This module is implemented by HTIcons.c, and it is a part of the W3C Reference Library.
  11.    
  12.  */
  13. #ifndef HTICONS_H
  14. #define HTICONS_H
  15. #include "HTFormat.h"
  16. /*
  17. Icons
  18.    Icons are bound to MIME content-types and encoding.  These functions bind icon URLs to
  19.    given content-type or encoding templates.  Templates containing a slash are taken to be
  20.    content-type templates, other are encoding templates.
  21.    
  22.    
  23.    
  24. Controlling globals
  25.   SHOW BRACKETS AROUND ALTERNATIVE TEXT
  26.   
  27.    By default alternative text is bracketed by square brackets (the ALT tag to IMG
  28.    element).  Setting the global HTDirShowBrackets to false will turn this feature off.
  29.    
  30.  */
  31. typedef struct _HTIconNode {
  32.     char *      icon_url;
  33.     char *      icon_alt;
  34.     char *      type_templ;
  35. } HTIconNode;
  36. /*
  37.  * The list element definition to bind a CGI to a filetyp for special
  38.  * presentation like looking in an archiv (AddHref /cgi-bin/unarch? .zip .tar)
  39.  */
  40. typedef struct _HTHrefNode {
  41.     char *      href_url;
  42.     char *      type_templ;
  43. } HTHrefNode;
  44. /*
  45. File Mode
  46.    This is a simplified file mode enumeration that can is used in directory listings.
  47.    
  48.  */
  49. typedef  enum _HTFileMode {
  50.     HT_IS_FILE,                         /* Normal file */
  51.     HT_IS_DIR,                          /* Directory */
  52.     HT_IS_BLANK,                        /* Blank Icon */
  53.     HT_IS_PARENT                        /* Parent Directory */
  54. } HTFileMode;
  55. /*
  56. Public functions
  57.    All of these functions take an absolute URL and alternate text to use.
  58.    
  59.  */
  60. /* Generates the alt-tag */
  61. extern char * HTIcon_alt_string (char * alt,
  62.                                         BOOL   brackets);
  63. /*
  64.  * General icon binding.  Use this icon if content-type or encoding
  65.  * matches template.
  66.  */
  67. extern void HTAddIcon (char *   url,
  68.                               char *    alt,
  69.                               char *    type_templ);
  70. /*
  71.  * Called from HTConfig.c to build the list of all the AddHref's
  72.  */
  73. extern void HTAddHref (char *    url,
  74.                               char *    type_templ);
  75. /*
  76.  * Icon for which no other icon can be used.
  77.  */
  78. extern void HTAddUnknownIcon (char * url,
  79.                                      char * alt);
  80. /*
  81.  * Invisible icon for the listing header field to make it aligned
  82.  * with the rest of the listing (this doesn't have to be blank).
  83.  */
  84. extern void HTAddBlankIcon (char * url,
  85.                                    char * alt);
  86. /*
  87.  * Icon to use for parent directory.
  88.  */
  89. extern void HTAddParentIcon (char * url,
  90.                                     char * alt);
  91. /*
  92.  * Icon to use for a directory.
  93.  */
  94. extern void HTAddDirIcon (char * url,
  95.                                  char * alt);
  96. /*                                                               HTGetIcon()
  97. ** returns the icon corresponding to content_type or content_encoding.
  98. */
  99. extern HTIconNode * HTGetIcon (HTFileMode       mode,
  100.                                       HTFormat          content_type,
  101.                                       HTEncoding        content_encoding);
  102. /*
  103.  * returns the HrefNode to get the URL for presentation of a file (indexing)
  104.  */
  105. extern HTHrefNode * HTGetHref ( char *  filename);
  106. /*
  107.     A Predifined Set of Icons
  108.     
  109.    The function HTStdIconInit(url_prefix) can be used to initialize a standard icon set:
  110.    
  111.        blank.xbm for the blank icon
  112.       
  113.        directory.xbm for directory icon
  114.       
  115.        back.xbm for parent directory
  116.       
  117.        unknown.xbm for unknown icon
  118.       
  119.        binary.xbm for binary files
  120.       
  121.        text.xbm for ascii files
  122.       
  123.        image.xbm for image files
  124.       
  125.        movie.xbm for video files
  126.       
  127.        sound.xbm for audio files
  128.       
  129.        tar.xbm for tar and gtar files
  130.       
  131.        compressed.xbm for compressed and gzipped files
  132.       
  133.  */
  134. extern void HTStdIconInit (CONST char * url_prefix);
  135. /*
  136.  */
  137. #endif /* HTICONS */
  138. /*
  139.    end */