Annotation of libwww/Library/src/HTIcons.html, revision 2.2
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;
33: </PRE>
34:
35: <PRE>
36: extern BOOL HTDirShowBrackets;
37: extern HTIconNode * icon_unknown; /* Unknown file type */
38: extern HTIconNode * icon_blank; /* Blank icon in heading */
39: extern HTIconNode * icon_parent; /* Parent directory icon */
40: extern HTIconNode * icon_dir; /* Directory icon */
41: </PRE>
42:
43: <H2>Public functions</H2>
44:
45: All of these functions take an absolute URL and alternate text to use. <P>
46:
47: <PRE>
48: /* Generates the alt-tag */
49: PUBLIC char * HTIcon_alt_string PARAMS((char * alt,
50: BOOL brackets));
51:
52: /*
53: * General icon binding. Use this icon if content-type or encoding
54: * matches template.
55: */
56: PUBLIC void HTAddIcon PARAMS((char * url,
57: char * alt,
58: char * type_templ));
59:
60: /*
61: * Icon for which no other icon can be used.
62: */
63: PUBLIC void HTAddUnknownIcon PARAMS((char * url,
64: char * alt));
65:
66: /*
67: * Invisible icon for the listing header field to make it aligned
68: * with the rest of the listing (this doesn't have to be blank).
69: */
70: PUBLIC void HTAddBlankIcon PARAMS((char * url,
71: char * alt));
72:
73: /*
74: * Icon to use for parent directory.
75: */
76: PUBLIC void HTAddParentIcon PARAMS((char * url,
77: char * alt));
78:
79: /*
80: * Icon to use for a directory.
81: */
82: PUBLIC void HTAddDirIcon PARAMS((char * url,
83: char * alt));
84:
85: /* HTGetIcon()
86: ** returns the icon corresponding to content_type or content_encoding.
87: */
88: PUBLIC HTIconNode * HTGetIcon PARAMS((mode_t mode,
89: HTFormat content_type,
90: HTFormat content_encoding));
91:
92: </PRE>
93:
94:
95: <H4>A Predifined Set of Icons</H4>
96: The function <CODE>HTStdIconInit(url_prefix)</CODE> can be used to
97: initialize a standard icon set:
98: <UL>
99: <LI> <CODE>blank.xbm</CODE> for the blank icon
100: <LI> <CODE>directory.xbm</CODE> for directory icon
101: <LI> <CODE>back.xbm</CODE> for parent directory
102: <LI> <CODE>unknown.xbm</CODE> for unknown icon
103: <LI> <CODE>binary.xbm</CODE> for binary files
104: <LI> <CODE>text.xbm</CODE> for ascii files
105: <LI> <CODE>image.xbm</CODE> for image files
106: <LI> <CODE>movie.xbm</CODE> for video files
107: <LI> <CODE>sound.xbm</CODE> for audio files
108: <LI> <CODE>tar.xbm</CODE> for tar and gtar files
109: <LI> <CODE>compressed.xbm</CODE> for compressed and gzipped files
110: </UL>
111: <PRE>
112: PUBLIC void HTStdIconInit PARAMS((char * url_prefix));
113: </PRE>
114:
115: <PRE>
116: #endif /* HTICONS */
117: </PRE>
118: end
119: </BODY>
120: </HTML>
121:
Webmaster