File:  [Public] / libwww / Library / src / HTIcons.html
Revision 2.22: download - view: text, annotated - select for diffs
Fri Jun 28 16:31:09 1996 UTC (27 years, 11 months ago) by frystyk
Branches: MAIN
CVS tags: Release-5-0a, Release-5-0, Release-4-1b5, Release-4-1b4, Release-4-1b3, PIPELINE1, HEAD
version 4.1b2

<HTML>
<HEAD>
<!-- Changed by: Henrik Frystyk Nielsen, 23-Jun-1996 -->
  <TITLE>W3C Reference Library libwww Icon Management</TITLE>
</HEAD>
<BODY>
<H1>
  Icon Management
</H1>
<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
Icons for directory listsings etc. are bound to MIME
<CODE>content-types</CODE> and <CODE>content-encodings</CODE> as described
in the <A HREF="HTFormat.html">format manager</A>. These functions bind icon
URLs to given <CODE>content-type</CODE> or encoding templates. Templates
containing a slash are taken to be <CODE>content-type</CODE> templates, other
are <CODE>content-encoding</CODE> templates.
<P>
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 "WWWLib.h"
</PRE>
<PRE>
typedef struct _HTIconNode HTIconNode;
</PRE>
<H2>
  Add new Icons
</H2>
<P>
All of these functions take an absolute URL and alternate text to use. Add
an icon the list
<H3>
  Generic Icons
</H3>
<PRE>extern BOOL HTIcon_add (const char * url, const char * prefix,
				char * alt, char * type_templ);
</PRE>
<H3>
  Specific Icons
</H3>
<P>
We also have a special set of icons used to represent well-known things in
direcctory listings.
<H4>
  Unknown Icon
</H4>
<P>
Add a unknown icon representing files that we can't figure out what is and
hence can`'t come up with a better icon.
<PRE>extern BOOL HTIcon_addUnknown (const char * url, const char * prefix,
				char * alt);
</PRE>
<H4>
  Empty Icon
</H4>
<P>
In order to aligned HTML pages for directory listings in preformatted mode,
we need an empty (or blank) icon of the same size as the other icons.
<PRE>extern BOOL HTIcon_addBlank (const char * url, const char * prefix,
				char * alt);
</PRE>
<H4>
  Parent Icon
</H4>
<P>
Add an icon representing a level up in a directory listing - the parent
directory.
<PRE>extern BOOL HTIcon_addParent (const char * url, const char * prefix,
				char * alt);
</PRE>
<H4>
  Directory Icon
</H4>
<P>
This icon represents a directory or a folder
<PRE>extern BOOL HTIcon_addDir (const char * url, const char * prefix,
				char * alt);
</PRE>
<H2>
  Find an Icon
</H2>
<P>
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;


extern HTIconNode * HTIcon_find (HTFileMode	mode,
				 HTFormat	content_type,
				 HTEncoding	content_encoding);
</PRE>
<H2>
  Icon URL
</H2>
<P>
When you want to add the icon reference into a directory listing, you can
get the URL of the icon by using this method. Don't free or modify the string
returned!
<PRE>extern char * HTIcon_url (HTIconNode * node);
</PRE>
<H2>
  Alternative text
</H2>
<P>
Get the alternative text (if any) for text based clients or if you don't
want to download the image right away. The string returned must be freed
by the caller.
<PRE>extern char * HTIcon_alternative (HTIconNode * node, BOOL brackets);
</PRE>
<H2>
  A Standard Set of Icons
</H2>
<P>
The <A HREF="WWWFile.html">WWWFile</A> interface does not define a default
set of icons but the Library distribution files comes with a <I>standard</I>
set of icons that can be used if desired. The Icons can be found in
<CODE>$(datadir)/www-icons</CODE>.The set covers the types described below
and they can be set up using the <A HREF="HTInit.html#icons">HTIconInit()
initialization</A> function in the <A HREF="WWWInit.html">WWWInit startup
interface</A>
<P>
<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>
#endif /* HTICONS */
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTIcons.html,v 2.22 1996/06/28 16:31:09 frystyk Exp $
</ADDRESS>
</BODY></HTML>

Webmaster