OSDN Git Service

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