2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_FILEFILTER_H
4 #define _GTKMM_FILEFILTER_H
10 /* Copyright (C) 2003 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtkmm/object.h>
30 //TODO: remove this if we wrap this in a C++ type:
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 //typedef struct _GtkFileFilterInfo GtkFileFilterInfo;
33 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkFileFilter GtkFileFilter;
38 typedef struct _GtkFileFilterClass GtkFileFilterClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
43 { class FileFilter_Class; } // namespace Gtk
47 /** @addtogroup gtkmmEnums Enums and Flags */
51 * @par Bitwise operators:
52 * <tt>%FileFilterFlags operator|(FileFilterFlags, FileFilterFlags)</tt><br>
53 * <tt>%FileFilterFlags operator&(FileFilterFlags, FileFilterFlags)</tt><br>
54 * <tt>%FileFilterFlags operator^(FileFilterFlags, FileFilterFlags)</tt><br>
55 * <tt>%FileFilterFlags operator~(FileFilterFlags)</tt><br>
56 * <tt>%FileFilterFlags& operator|=(FileFilterFlags&, FileFilterFlags)</tt><br>
57 * <tt>%FileFilterFlags& operator&=(FileFilterFlags&, FileFilterFlags)</tt><br>
58 * <tt>%FileFilterFlags& operator^=(FileFilterFlags&, FileFilterFlags)</tt><br>
62 FILE_FILTER_FILENAME = 1 << 0,
63 FILE_FILTER_URI = 1 << 1,
64 FILE_FILTER_DISPLAY_NAME = 1 << 2,
65 FILE_FILTER_MIME_TYPE = 1 << 3
68 /** @ingroup gtkmmEnums */
69 inline FileFilterFlags operator|(FileFilterFlags lhs, FileFilterFlags rhs)
70 { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
72 /** @ingroup gtkmmEnums */
73 inline FileFilterFlags operator&(FileFilterFlags lhs, FileFilterFlags rhs)
74 { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
76 /** @ingroup gtkmmEnums */
77 inline FileFilterFlags operator^(FileFilterFlags lhs, FileFilterFlags rhs)
78 { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
80 /** @ingroup gtkmmEnums */
81 inline FileFilterFlags operator~(FileFilterFlags flags)
82 { return static_cast<FileFilterFlags>(~static_cast<unsigned>(flags)); }
84 /** @ingroup gtkmmEnums */
85 inline FileFilterFlags& operator|=(FileFilterFlags& lhs, FileFilterFlags rhs)
86 { return (lhs = static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
88 /** @ingroup gtkmmEnums */
89 inline FileFilterFlags& operator&=(FileFilterFlags& lhs, FileFilterFlags rhs)
90 { return (lhs = static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
92 /** @ingroup gtkmmEnums */
93 inline FileFilterFlags& operator^=(FileFilterFlags& lhs, FileFilterFlags rhs)
94 { return (lhs = static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
99 #ifndef DOXYGEN_SHOULD_SKIP_THIS
104 class Value<Gtk::FileFilterFlags> : public Glib::Value_Flags<Gtk::FileFilterFlags>
107 static GType value_type() G_GNUC_CONST;
111 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
118 class FileFilter : public Gtk::Object
121 #ifndef DOXYGEN_SHOULD_SKIP_THIS
122 typedef FileFilter CppObjectType;
123 typedef FileFilter_Class CppClassType;
124 typedef GtkFileFilter BaseObjectType;
125 typedef GtkFileFilterClass BaseClassType;
126 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
128 virtual ~FileFilter();
130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
133 friend class FileFilter_Class;
134 static CppClassType filefilter_class_;
137 FileFilter(const FileFilter&);
138 FileFilter& operator=(const FileFilter&);
141 explicit FileFilter(const Glib::ConstructParams& construct_params);
142 explicit FileFilter(GtkFileFilter* castitem);
144 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
147 #ifndef DOXYGEN_SHOULD_SKIP_THIS
148 static GType get_type() G_GNUC_CONST;
149 static GType get_base_type() G_GNUC_CONST;
152 ///Provides access to the underlying C GtkObject.
153 GtkFileFilter* gobj() { return reinterpret_cast<GtkFileFilter*>(gobject_); }
155 ///Provides access to the underlying C GtkObject.
156 const GtkFileFilter* gobj() const { return reinterpret_cast<GtkFileFilter*>(gobject_); }
160 //C++ methods used to invoke GTK+ virtual functions:
163 //GTK+ Virtual Functions (override these to change behaviour):
165 //Default Signal Handlers::
174 /** Sets the human-readable name of the filter; this is the string
175 * that will be displayed in the file selector user interface if
176 * there is a selectable list of filters.
179 * @param name The human-readable-name for the filter, or <tt>0</tt>
180 * to remove any existing name.
182 void set_name(const Glib::ustring& name);
184 /** Gets the human-readable name for the filter. See gtk_file_filter_set_name().
185 * @return The human-readable name of the filter,
186 * or <tt>0</tt>. This value is owned by GTK+ and must not
187 * be modified or freed.
191 Glib::ustring get_name() const;
194 /** Adds a rule allowing a given mime type to @a filter .
197 * @param mime_type Name of a MIME type.
199 void add_mime_type(const Glib::ustring& mime_type);
201 /** Adds a rule allowing a shell style glob to a filter.
204 * @param pattern A shell style glob.
206 void add_pattern(const Glib::ustring& pattern);
208 /** Adds a rule allowing image files in the formats supported
213 void add_pixbuf_formats();
218 FileFilterFlags contains;
219 Glib::ustring filename;
221 Glib::ustring display_name;
222 Glib::ustring mime_type;
225 /// For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info);
226 typedef sigc::slot<bool, const Info&> SlotCustom;
228 void add_custom(FileFilterFlags needed, const SlotCustom& slot);
231 /** Gets the fields that need to be filled in for the structure
232 * passed to gtk_file_filter_filter()
234 * This function will not typically be used by applications; it
235 * is intended principally for use in the implementation of
237 * @return Bitfield of flags indicating needed fields when
238 * calling gtk_file_filter_filter()
242 FileFilterFlags get_needed() const;
244 //TODO: This method is used by FileChooser implementors, so we don't need to wrap it.
246 //_WRAP_METHOD(bool filter(const GtkFileFilterInfo* filter_info), gtk_file_filter_filter)
256 /** @relates Gtk::FileFilter
257 * @param object The C instance
258 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
259 * @result A C++ instance that wraps this C instance.
261 Gtk::FileFilter* wrap(GtkFileFilter* object, bool take_copy = false);
263 #endif /* _GTKMM_FILEFILTER_H */