1/*
2 * tkFileFilter.h --
3 *
4 *	Declarations for the file filter processing routines needed by the
5 *	file selection dialogs.
6 *
7 * Copyright (c) 1996 Sun Microsystems, Inc.
8 *
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id$
13 *
14 */
15
16#ifndef _TK_FILE_FILTER
17#define _TK_FILE_FILTER
18
19#define OSType long
20
21#ifdef BUILD_tk
22# undef TCL_STORAGE_CLASS
23# define TCL_STORAGE_CLASS DLLEXPORT
24#endif
25
26typedef struct GlobPattern {
27    struct GlobPattern *next;	/* Chains to the next glob pattern in a glob
28				 * pattern list */
29    char *pattern;		/* String value of the pattern, such as
30				 * "*.txt" or "*.*" */
31} GlobPattern;
32
33typedef struct MacFileType {
34    struct MacFileType *next;	/* Chains to the next mac file type in a mac
35				 * file type list */
36    OSType type;		/* Mac file type, such as 'TEXT' or 'GIFF' */
37} MacFileType;
38
39typedef struct FileFilterClause {
40    struct FileFilterClause *next;
41				/* Chains to the next clause in a clause
42				 * list */
43    GlobPattern *patterns;	/* Head of glob pattern type list */
44    GlobPattern *patternsTail;	/* Tail of glob pattern type list */
45    MacFileType *macTypes;	/* Head of mac file type list */
46    MacFileType *macTypesTail;	/* Tail of mac file type list */
47} FileFilterClause;
48
49typedef struct FileFilter {
50    struct FileFilter *next;	/* Chains to the next filter in a filter
51				 * list */
52    char *name;			/* Name of the file filter, such as "Text
53				 * Documents" */
54    FileFilterClause *clauses;	/* Head of the clauses list */
55    FileFilterClause *clausesTail;
56				/* Tail of the clauses list */
57} FileFilter;
58
59/*
60 *----------------------------------------------------------------------
61 *
62 * FileFilterList --
63 *
64 *	The routine TkGetFileFilters() translates the string value of the
65 *	-filefilters option into a FileFilterList structure, which consists of
66 *	a list of file filters.
67 *
68 *	Each file filter consists of one or more clauses. Each clause has one
69 *	or more glob patterns and/or one or more Mac file types
70 *
71 *----------------------------------------------------------------------
72 */
73
74typedef struct FileFilterList {
75    FileFilter *filters;	/* Head of the filter list */
76    FileFilter *filtersTail;	/* Tail of the filter list */
77    int numFilters;		/* number of filters in the list */
78} FileFilterList;
79
80MODULE_SCOPE void	TkFreeFileFilters(FileFilterList *flistPtr);
81MODULE_SCOPE void	TkInitFileFilters(FileFilterList *flistPtr);
82MODULE_SCOPE int	TkGetFileFilters(Tcl_Interp *interp,
83    			    FileFilterList *flistPtr, Tcl_Obj *valuePtr,
84			    int isWindows);
85
86# undef TCL_STORAGE_CLASS
87# define TCL_STORAGE_CLASS DLLIMPORT
88#endif
89