2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _GTKMM_RECENTFILTER_H
4
#define _GTKMM_RECENTFILTER_H
9
/* Copyright (C) 2006 The gtkmm Development Team
11
* This library is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Lesser General Public
13
* License as published by the Free Software Foundation; either
14
* version 2.1 of the License, or (at your option) any later version.
16
* This library is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* Lesser General Public License for more details.
21
* You should have received a copy of the GNU Lesser General Public
22
* License along with this library; if not, write to the Free
23
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
#include <glibmm/object.h>
29
#ifndef DOXYGEN_SHOULD_SKIP_THIS
30
typedef struct _GtkRecentFilter GtkRecentFilter;
31
typedef struct _GtkRecentFilterClass GtkRecentFilterClass;
32
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
{ class RecentFilter_Class; } // namespace Gtk
40
/** @addtogroup gtkmmEnums gtkmm Enums and Flags */
44
* @par Bitwise operators:
45
* <tt>%RecentFilterFlags operator|(RecentFilterFlags, RecentFilterFlags)</tt><br>
46
* <tt>%RecentFilterFlags operator&(RecentFilterFlags, RecentFilterFlags)</tt><br>
47
* <tt>%RecentFilterFlags operator^(RecentFilterFlags, RecentFilterFlags)</tt><br>
48
* <tt>%RecentFilterFlags operator~(RecentFilterFlags)</tt><br>
49
* <tt>%RecentFilterFlags& operator|=(RecentFilterFlags&, RecentFilterFlags)</tt><br>
50
* <tt>%RecentFilterFlags& operator&=(RecentFilterFlags&, RecentFilterFlags)</tt><br>
51
* <tt>%RecentFilterFlags& operator^=(RecentFilterFlags&, RecentFilterFlags)</tt><br>
53
enum RecentFilterFlags
55
RECENT_FILTER_URI = 1 << 0,
56
RECENT_FILTER_DISPLAY_NAME = 1 << 1,
57
RECENT_FILTER_MIME_TYPE = 1 << 2,
58
RECENT_FILTER_APPLICATION = 1 << 3,
59
RECENT_FILTER_GROUP = 1 << 4,
60
RECENT_FILTER_AGE = 1 << 5
63
/** @ingroup gtkmmEnums */
64
inline RecentFilterFlags operator|(RecentFilterFlags lhs, RecentFilterFlags rhs)
65
{ return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
67
/** @ingroup gtkmmEnums */
68
inline RecentFilterFlags operator&(RecentFilterFlags lhs, RecentFilterFlags rhs)
69
{ return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
71
/** @ingroup gtkmmEnums */
72
inline RecentFilterFlags operator^(RecentFilterFlags lhs, RecentFilterFlags rhs)
73
{ return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
75
/** @ingroup gtkmmEnums */
76
inline RecentFilterFlags operator~(RecentFilterFlags flags)
77
{ return static_cast<RecentFilterFlags>(~static_cast<unsigned>(flags)); }
79
/** @ingroup gtkmmEnums */
80
inline RecentFilterFlags& operator|=(RecentFilterFlags& lhs, RecentFilterFlags rhs)
81
{ return (lhs = static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
83
/** @ingroup gtkmmEnums */
84
inline RecentFilterFlags& operator&=(RecentFilterFlags& lhs, RecentFilterFlags rhs)
85
{ return (lhs = static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
87
/** @ingroup gtkmmEnums */
88
inline RecentFilterFlags& operator^=(RecentFilterFlags& lhs, RecentFilterFlags rhs)
89
{ return (lhs = static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
94
#ifndef DOXYGEN_SHOULD_SKIP_THIS
99
class Value<Gtk::RecentFilterFlags> : public Glib::Value_Flags<Gtk::RecentFilterFlags>
102
static GType value_type() G_GNUC_CONST;
106
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
113
/** RecentFilter can be used to restrict the files being shown
114
* in a RecentChooser. Files can be filtered based on their name
115
* (with add_pattern()), on their mime type (with add_mime_type()),
116
* on the application that has registered them (with add_application()),
117
* or by a custom filter function (with add_custom()).
119
* Filtering by mime type handles aliasing and subclassing of mime
120
* types; e.g. a filter for text/plain also matches a file with mime
121
* type application/rtf, since application/rtf is a subclass of text/plain.
122
* Note that RecentFilter allows wildcards for the subtype of a
123
* mime type, so you can e.g. filter for image/ *.
125
* Normally, filters are used by adding them to a RecentChooser,
126
* see RecentChooser::add_filter(), but it is also possible to
127
* manually use a filter on a file with filter().
131
* @ingroup RecentFiles
134
class RecentFilter : public Glib::Object
137
#ifndef DOXYGEN_SHOULD_SKIP_THIS
140
typedef RecentFilter CppObjectType;
141
typedef RecentFilter_Class CppClassType;
142
typedef GtkRecentFilter BaseObjectType;
143
typedef GtkRecentFilterClass BaseClassType;
145
private: friend class RecentFilter_Class;
146
static CppClassType recentfilter_class_;
150
RecentFilter(const RecentFilter&);
151
RecentFilter& operator=(const RecentFilter&);
154
explicit RecentFilter(const Glib::ConstructParams& construct_params);
155
explicit RecentFilter(GtkRecentFilter* castitem);
157
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
160
virtual ~RecentFilter();
162
#ifndef DOXYGEN_SHOULD_SKIP_THIS
163
static GType get_type() G_GNUC_CONST;
166
static GType get_base_type() G_GNUC_CONST;
169
///Provides access to the underlying C GObject.
170
GtkRecentFilter* gobj() { return reinterpret_cast<GtkRecentFilter*>(gobject_); }
172
///Provides access to the underlying C GObject.
173
const GtkRecentFilter* gobj() const { return reinterpret_cast<GtkRecentFilter*>(gobject_); }
175
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
176
GtkRecentFilter* gobj_copy();
186
static Glib::RefPtr<RecentFilter> create();
189
/** Sets the human-readable name of the filter; this is the string
190
* that will be displayed in the recently used resources selector
191
* user interface if there is a selectable list of filters.
194
* @param name Then human readable name of @a filter.
196
void set_name(const Glib::ustring& name);
198
/** Gets the human-readable name for the filter.
202
* @return The name of the filter, or <tt>0</tt>. The returned string
203
* is owned by the filter object and should not be freed.
205
Glib::ustring get_name() const;
208
/** Adds a rule that allows resources based on their registered MIME type.
211
* @param mime_type A MIME type.
213
void add_mime_type(const Glib::ustring& mime_type);
215
/** Adds a rule that allows resources based on a pattern matching their
219
* @param pattern A file pattern.
221
void add_pattern(const Glib::ustring& pattern);
223
/** Adds a rule allowing image files in the formats supported
228
void add_pixbuf_formats();
230
/** Adds a rule that allows resources based on the name of the application
231
* that has registered them.
234
* @param application An application name.
236
void add_application(const Glib::ustring& application);
238
/** Adds a rule that allows resources based on the name of the group
239
* to which they belong
242
* @param group A group name.
244
void add_group(const Glib::ustring& group);
246
/** Adds a rule that allows resources based on their age - that is, the number
247
* of days elapsed since they were last modified.
250
* @param days Number of days.
252
void add_age(int days);
254
/** A RecentFilter::Info class is used to pass information
255
* about the tested file to filter().
257
* - contains: Flags indicating which of the following fields need are filled
258
* - uri: the URI of the file being tested
259
* - display_name: the string that will be used to display the file in the recent chooser
260
* - mime_type: the mime type of the file
261
* - applications: the list of applications that have registered the file
262
* - groups: the groups to which the file belongs to
263
* - age: the number of days elapsed since the file has been registered
270
///This bitmask tells us which of the other variables contain useful information.
271
RecentFilterFlags contains;
274
Glib::ustring display_name;
275
Glib::ustring mime_type;
276
std::list<Glib::ustring> applications;
277
std::list<Glib::ustring> groups;
281
/// For instance, bool on_custom(const Gtk::RecentFilter::Info& filter_info);
282
typedef sigc::slot<bool, const Info&> SlotCustom;
284
void add_custom(RecentFilterFlags needed, const SlotCustom& slot);
287
/** Gets the fields that need to be filled in for the structure
290
* This function will not typically be used by applications; it
291
* is intended principally for use in the implementation of
292
* Gtk::RecentChooser.
295
* @return Bitfield of flags indicating needed fields when
298
RecentFilterFlags get_needed() const;
300
// Method is used by class RecentChooser implementors.
302
//_WRAP_METHOD(bool filter(const GtkRecentFilterInfo* filter_info), gtk_recent_filter_filter)
308
//C++ methods used to invoke GTK+ virtual functions:
311
//GTK+ Virtual Functions (override these to change behaviour):
313
//Default Signal Handlers::
323
/** A Glib::wrap() method for this object.
325
* @param object The C instance.
326
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
327
* @result A C++ instance that wraps this C instance.
329
* @relates Gtk::RecentFilter
331
Glib::RefPtr<Gtk::RecentFilter> wrap(GtkRecentFilter* object, bool take_copy = false);
335
#endif /* _GTKMM_RECENTFILTER_H */