File:  [Public] / libwww / Library / src / HTIcons.html
Revision 2.15: download - view: text, annotated - select for diffs
Wed Oct 4 21:36:26 1995 UTC (28 years, 8 months ago) by frystyk
Branches: MAIN
CVS tags: v4/0pre5, v4/0pre4, v4/0pre3, HEAD
next alpha version

<HTML>
<HEAD>
<TITLE>Icon Management</TITLE>
<!-- Changed by: Henrik Frystyk Nielsen, 30-Sep-1995 -->
</HEAD>
<BODY>
<H1>Icon Management</H1>

<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>

This module is implemented by <A HREF="HTIcons.c">HTIcons.c</A>, and
it is a part of the <A
HREF="http://www.w3.org/pub/WWW/Library/">
W3C Reference Library</A>.

<PRE>
#ifndef HTICONS_H
#define HTICONS_H

#include "HTFormat.h"
</PRE>

<H2>Icons</H2>

Icons are bound to MIME content-types and encoding.  These functions
bind icon URLs to given content-type or encoding templates.  Templates
containing a slash are taken to be content-type templates, other are
encoding templates. <P>
 
<H2>Controlling globals</H2>

<H3>Show brackets around alternative text</H3>
By default alternative text is bracketed by square brackets (the
<CODE>ALT</CODE> tag to <CODE>IMG</CODE> element).  Setting the global
<CODE>HTDirShowBrackets</CODE> to false will turn this feature off.

<PRE>
typedef struct _HTIconNode {
    char *	icon_url;
    char *	icon_alt;
    char *	type_templ;
} HTIconNode;

/*
 * The list element definition to bind a CGI to a filetyp for special
 * presentation like looking in an archiv (AddHref /cgi-bin/unarch? .zip .tar)
 */
typedef struct _HTHrefNode {
    char *      href_url;
    char *      type_templ;
} HTHrefNode;
</PRE>

<H2>File Mode</H2>

This is a simplified file mode enumeration that can is used in
directory listings.

<PRE>
typedef  enum _HTFileMode {
    HT_IS_FILE,				/* Normal file */
    HT_IS_DIR,				/* Directory */
    HT_IS_BLANK,			/* Blank Icon */
    HT_IS_PARENT			/* Parent Directory */
} HTFileMode;
</PRE>

<PRE>
extern BOOL HTDirShowBrackets;
</PRE>

<H2>Public functions</H2>

All of these functions take an absolute URL and alternate text to use. <P>

<PRE>
/* Generates the alt-tag */
extern char * HTIcon_alt_string PARAMS((char * alt,
				        BOOL   brackets));

/*
 * General icon binding.  Use this icon if content-type or encoding
 * matches template.
 */
extern void HTAddIcon PARAMS((char *	url,
			      char *	alt,
			      char *	type_templ));


/*
 * Called from HTConfig.c to build the list of all the AddHref's
 */
extern void HTAddHref PARAMS((char *    url,
                              char *    type_templ));


/*
 * Icon for which no other icon can be used.
 */
extern void HTAddUnknownIcon PARAMS((char * url,
				     char * alt));

/*
 * Invisible icon for the listing header field to make it aligned
 * with the rest of the listing (this doesn't have to be blank).
 */
extern void HTAddBlankIcon PARAMS((char * url,
				   char * alt));

/*
 * Icon to use for parent directory.
 */
extern void HTAddParentIcon PARAMS((char * url,
				    char * alt));

/*
 * Icon to use for a directory.
 */
extern void HTAddDirIcon PARAMS((char * url,
			         char * alt));

/*								 HTGetIcon()
** returns the icon corresponding to content_type or content_encoding.
*/
extern HTIconNode * HTGetIcon PARAMS((HTFileMode	mode,
				      HTFormat		content_type,
				      HTEncoding	content_encoding));

/*
 * returns the HrefNode to get the URL for presentation of a file (indexing)
 */
extern HTHrefNode * HTGetHref PARAMS(( char *  filename));


</PRE>


<H4>A Predifined Set of Icons</H4>
The function <CODE>HTStdIconInit(url_prefix)</CODE> can be used to
initialize a standard icon set:
<UL>
<LI> <CODE>blank.xbm</CODE> for the blank icon
<LI> <CODE>directory.xbm</CODE> for directory icon
<LI> <CODE>back.xbm</CODE> for parent directory
<LI> <CODE>unknown.xbm</CODE> for unknown icon
<LI> <CODE>binary.xbm</CODE> for binary files
<LI> <CODE>text.xbm</CODE> for ascii files
<LI> <CODE>image.xbm</CODE> for image files
<LI> <CODE>movie.xbm</CODE> for video files
<LI> <CODE>sound.xbm</CODE> for audio files
<LI> <CODE>tar.xbm</CODE> for tar and gtar files
<LI> <CODE>compressed.xbm</CODE> for compressed and gzipped files
</UL>
<PRE>
extern void HTStdIconInit PARAMS((CONST char * url_prefix));
</PRE>

<PRE>
#endif /* HTICONS */
</PRE>
end
</BODY>
</HTML>


Webmaster