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

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.22      frystyk     3: <!-- Changed by: Henrik Frystyk Nielsen, 23-Jun-1996 -->
2.23      frystyk     4:   <TITLE>W3C Sample Code Library libwww Icon Management</TITLE>
2.1       frystyk     5: </HEAD>
                      6: <BODY>
2.22      frystyk     7: <H1>
                      8:   Icon Management
                      9: </H1>
2.8       frystyk    10: <PRE>
                     11: /*
2.12      frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.8       frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
2.22      frystyk    16: <P>
                     17: Icons for directory listsings etc. are bound to MIME
                     18: <CODE>content-types</CODE> and <CODE>content-encodings</CODE> as described
                     19: in the <A HREF="HTFormat.html">format manager</A>. These functions bind icon
                     20: URLs to given <CODE>content-type</CODE> or encoding templates. Templates
                     21: containing a slash are taken to be <CODE>content-type</CODE> templates, other
                     22: are <CODE>content-encoding</CODE> templates.
                     23: <P>
                     24: This module is implemented by <A HREF="HTIcons.c">HTIcons.c</A>, and it is
2.24      frystyk    25: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.22      frystyk    26: Library</A>.
2.1       frystyk    27: <PRE>
                     28: #ifndef HTICONS_H
                     29: #define HTICONS_H
2.9       roeber     30: 
2.22      frystyk    31: #include "WWWLib.h"
2.26    ! vbancrof   32: 
        !            33: #ifdef __cplusplus
        !            34: extern "C" { 
        !            35: #endif 
2.1       frystyk    36: </PRE>
                     37: <PRE>
2.22      frystyk    38: typedef struct _HTIconNode HTIconNode;
2.15      frystyk    39: </PRE>
2.22      frystyk    40: <H2>
                     41:   Add new Icons
                     42: </H2>
                     43: <P>
                     44: All of these functions take an absolute URL and alternate text to use. Add
                     45: an icon the list
                     46: <H3>
                     47:   Generic Icons
                     48: </H3>
                     49: <PRE>extern BOOL HTIcon_add (const char * url, const char * prefix,
                     50:                                char * alt, char * type_templ);
                     51: </PRE>
                     52: <H3>
                     53:   Specific Icons
                     54: </H3>
                     55: <P>
                     56: We also have a special set of icons used to represent well-known things in
                     57: direcctory listings.
                     58: <H4>
                     59:   Unknown Icon
                     60: </H4>
                     61: <P>
                     62: Add a unknown icon representing files that we can't figure out what is and
                     63: hence can`'t come up with a better icon.
                     64: <PRE>extern BOOL HTIcon_addUnknown (const char * url, const char * prefix,
                     65:                                char * alt);
                     66: </PRE>
                     67: <H4>
                     68:   Empty Icon
                     69: </H4>
                     70: <P>
                     71: In order to aligned HTML pages for directory listings in preformatted mode,
                     72: we need an empty (or blank) icon of the same size as the other icons.
                     73: <PRE>extern BOOL HTIcon_addBlank (const char * url, const char * prefix,
                     74:                                char * alt);
                     75: </PRE>
                     76: <H4>
                     77:   Parent Icon
                     78: </H4>
                     79: <P>
                     80: Add an icon representing a level up in a directory listing - the parent
                     81: directory.
                     82: <PRE>extern BOOL HTIcon_addParent (const char * url, const char * prefix,
                     83:                                char * alt);
                     84: </PRE>
                     85: <H4>
                     86:   Directory Icon
                     87: </H4>
                     88: <P>
                     89: This icon represents a directory or a folder
                     90: <PRE>extern BOOL HTIcon_addDir (const char * url, const char * prefix,
                     91:                                char * alt);
                     92: </PRE>
                     93: <H2>
                     94:   Find an Icon
                     95: </H2>
                     96: <P>
                     97: This is a simplified file mode enumeration that can is used in directory
                     98: listings.
2.15      frystyk    99: <PRE>
                    100: typedef  enum _HTFileMode {
                    101:     HT_IS_FILE,                                /* Normal file */
                    102:     HT_IS_DIR,                         /* Directory */
                    103:     HT_IS_BLANK,                       /* Blank Icon */
                    104:     HT_IS_PARENT                       /* Parent Directory */
                    105: } HTFileMode;
2.1       frystyk   106: 
2.3       luotonen  107: 
2.22      frystyk   108: extern HTIconNode * HTIcon_find (HTFileMode    mode,
                    109:                                 HTFormat       content_type,
                    110:                                 HTEncoding     content_encoding);
                    111: </PRE>
                    112: <H2>
                    113:   Icon URL
                    114: </H2>
                    115: <P>
                    116: When you want to add the icon reference into a directory listing, you can
                    117: get the URL of the icon by using this method. Don't free or modify the string
                    118: returned!
                    119: <PRE>extern char * HTIcon_url (HTIconNode * node);
                    120: </PRE>
                    121: <H2>
                    122:   Alternative text
                    123: </H2>
                    124: <P>
                    125: Get the alternative text (if any) for text based clients or if you don't
                    126: want to download the image right away. The string returned must be freed
                    127: by the caller.
                    128: <PRE>extern char * HTIcon_alternative (HTIconNode * node, BOOL brackets);
                    129: </PRE>
                    130: <H2>
2.25      kahan     131:   Delete all icons
                    132: </H2>
                    133: <P>
                    134: Cleans up all memory used by icons. Should be called by
                    135: HTLibTerminate() (but it isn't).
                    136: <PRE>extern void HTIcon_deleteAll (void);
                    137: </PRE>
                    138: <H2>
2.22      frystyk   139:   A Standard Set of Icons
                    140: </H2>
                    141: <P>
                    142: The <A HREF="WWWFile.html">WWWFile</A> interface does not define a default
                    143: set of icons but the Library distribution files comes with a <I>standard</I>
                    144: set of icons that can be used if desired. The Icons can be found in
                    145: <CODE>$(datadir)/www-icons</CODE>.The set covers the types described below
                    146: and they can be set up using the <A HREF="HTInit.html#icons">HTIconInit()
                    147: initialization</A> function in the <A HREF="WWWInit.html">WWWInit startup
                    148: interface</A>
                    149: <P>
2.1       frystyk   150: <UL>
2.22      frystyk   151:   <LI>
                    152:     <CODE>blank.xbm</CODE> for the blank icon
                    153:   <LI>
                    154:     <CODE>directory.xbm</CODE> for directory icon
                    155:   <LI>
                    156:     <CODE>back.xbm</CODE> for parent directory
                    157:   <LI>
                    158:     <CODE>unknown.xbm</CODE> for unknown icon
                    159:   <LI>
                    160:     <CODE>binary.xbm</CODE> for binary files
                    161:   <LI>
                    162:     <CODE>text.xbm</CODE> for ascii files
                    163:   <LI>
                    164:     <CODE>image.xbm</CODE> for image files
                    165:   <LI>
                    166:     <CODE>movie.xbm</CODE> for video files
                    167:   <LI>
                    168:     <CODE>sound.xbm</CODE> for audio files
                    169:   <LI>
                    170:     <CODE>tar.xbm</CODE> for tar and gtar files
                    171:   <LI>
                    172:     <CODE>compressed.xbm</CODE> for compressed and gzipped files
2.1       frystyk   173: </UL>
                    174: <PRE>
2.26    ! vbancrof  175: #ifdef __cplusplus
        !           176: }
        !           177: #endif
        !           178: 
2.1       frystyk   179: #endif /* HTICONS */
                    180: </PRE>
2.22      frystyk   181: <P>
                    182:   <HR>
2.21      frystyk   183: <ADDRESS>
2.26    ! vbancrof  184:   @(#) $Id: HTIcons.html,v 2.25 2000/01/04 20:25:32 kahan Exp $
2.21      frystyk   185: </ADDRESS>
2.22      frystyk   186: </BODY></HTML>

Webmaster