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

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

Webmaster