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