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