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

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

Webmaster