Annotation of libwww/Library/src/HTIcons.html, revision 2.16

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

Webmaster