1
/* $Id: filefilter.hg,v 1.8 2004/11/12 11:51:42 murrayc Exp $ */
3
/* Copyright (C) 2003 The gtkmm Development Team
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free
17
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#include <glibmm/object.h>
23
_PINCLUDE(glibmm/private/object_p.h)
28
_WRAP_ENUM(FileFilterFlags, GtkFileFilterFlags)
30
/** A filter for selecting a file subset.
32
* A Gtk::FileFilter can be used to restrict the files being shown in a Gtk::FileChooser.
33
* Files can be filtered based on their name (with add_pattern()),
34
* on their mime type (with add_mime_type()), or by a custom filter
35
* function (with add_custom()).
37
* Filtering by mime types handles aliasing and subclassing of mime types;
38
* e.g. a filter for text/plain also matches a file with mime type application/rtf,
39
* since application/rtf is a subclass of text/plain. Note that Gtk::FileFilter
40
* allows wildcards for the subtype of a mime type, so you can e.g. filter for image/ *.
42
* Normally, filters are used by adding them to a Gtk::FileChooser. See Gtk::FileChooser::add_filter().
43
* But it is also possible to manually use a filter on a file with filter().
45
class FileFilter : public Glib::Object
47
_CLASS_GOBJECT(FileFilter, GtkFileFilter, GTK_FILE_FILTER, Glib::Object, GObject)
48
_DERIVES_INITIALLY_UNOWNED()
55
_WRAP_METHOD(void set_name(const Glib::ustring& name), gtk_file_filter_set_name)
56
_WRAP_METHOD(Glib::ustring get_name() const, gtk_file_filter_get_name)
58
_WRAP_METHOD(void add_mime_type(const Glib::ustring& mime_type), gtk_file_filter_add_mime_type)
59
_WRAP_METHOD(void add_pattern(const Glib::ustring& pattern), gtk_file_filter_add_pattern)
60
_WRAP_METHOD(void add_pixbuf_formats(), gtk_file_filter_add_pixbuf_formats)
65
FileFilterFlags contains;
66
Glib::ustring filename;
68
Glib::ustring display_name;
69
Glib::ustring mime_type;
72
/// For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info);
73
typedef sigc::slot<bool, const Info&> SlotCustom;
75
void add_custom(FileFilterFlags needed, const SlotCustom& slot);
76
_IGNORE(gtk_file_filter_add_custom)
78
_WRAP_METHOD(FileFilterFlags get_needed() const, gtk_file_filter_get_needed)
80
//TODO: This method is only used by FileChooser implementors, so we don't need to wrap it.
81
_IGNORE(gtk_file_filter_filter)
82
//_WRAP_METHOD(bool filter(const GtkFileFilterInfo* filter_info), gtk_file_filter_filter)