~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gtk/gtkmm/recentfilter.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
// Generated by gtkmmproc -- DO NOT MODIFY!
 
3
#ifndef _GTKMM_RECENTFILTER_H
 
4
#define _GTKMM_RECENTFILTER_H
 
5
 
 
6
 
 
7
#include <glibmm.h>
 
8
 
 
9
/* Copyright (C) 2006 The gtkmm Development Team
 
10
 *
 
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.
 
15
 *
 
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.
 
20
 *
 
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.
 
24
 */
 
25
 
 
26
#include <glibmm/object.h>
 
27
 
 
28
 
 
29
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
30
typedef struct _GtkRecentFilter GtkRecentFilter;
 
31
typedef struct _GtkRecentFilterClass GtkRecentFilterClass;
 
32
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
33
 
 
34
 
 
35
namespace Gtk
 
36
{ class RecentFilter_Class; } // namespace Gtk
 
37
namespace Gtk
 
38
{
 
39
 
 
40
/** @addtogroup gtkmmEnums gtkmm Enums and Flags */
 
41
 
 
42
/**
 
43
 * @ingroup gtkmmEnums
 
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>
 
52
 */
 
53
enum RecentFilterFlags
 
54
{
 
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
 
61
};
 
62
 
 
63
/** @ingroup gtkmmEnums */
 
64
inline RecentFilterFlags operator|(RecentFilterFlags lhs, RecentFilterFlags rhs)
 
65
  { return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
 
66
 
 
67
/** @ingroup gtkmmEnums */
 
68
inline RecentFilterFlags operator&(RecentFilterFlags lhs, RecentFilterFlags rhs)
 
69
  { return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
 
70
 
 
71
/** @ingroup gtkmmEnums */
 
72
inline RecentFilterFlags operator^(RecentFilterFlags lhs, RecentFilterFlags rhs)
 
73
  { return static_cast<RecentFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
 
74
 
 
75
/** @ingroup gtkmmEnums */
 
76
inline RecentFilterFlags operator~(RecentFilterFlags flags)
 
77
  { return static_cast<RecentFilterFlags>(~static_cast<unsigned>(flags)); }
 
78
 
 
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))); }
 
82
 
 
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))); }
 
86
 
 
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))); }
 
90
 
 
91
} // namespace Gtk
 
92
 
 
93
 
 
94
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
95
namespace Glib
 
96
{
 
97
 
 
98
template <>
 
99
class Value<Gtk::RecentFilterFlags> : public Glib::Value_Flags<Gtk::RecentFilterFlags>
 
100
{
 
101
public:
 
102
  static GType value_type() G_GNUC_CONST;
 
103
};
 
104
 
 
105
} // namespace Glib
 
106
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
107
 
 
108
 
 
109
namespace Gtk
 
110
{
 
111
 
 
112
 
 
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()).
 
118
 *
 
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/ *.
 
124
 *
 
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().
 
128
 *
 
129
 * @newin{2,10}
 
130
 *
 
131
 * @ingroup RecentFiles
 
132
 */
 
133
 
 
134
class RecentFilter : public Glib::Object
 
135
{
 
136
  
 
137
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
138
 
 
139
public:
 
140
  typedef RecentFilter CppObjectType;
 
141
  typedef RecentFilter_Class CppClassType;
 
142
  typedef GtkRecentFilter BaseObjectType;
 
143
  typedef GtkRecentFilterClass BaseClassType;
 
144
 
 
145
private:  friend class RecentFilter_Class;
 
146
  static CppClassType recentfilter_class_;
 
147
 
 
148
private:
 
149
  // noncopyable
 
150
  RecentFilter(const RecentFilter&);
 
151
  RecentFilter& operator=(const RecentFilter&);
 
152
 
 
153
protected:
 
154
  explicit RecentFilter(const Glib::ConstructParams& construct_params);
 
155
  explicit RecentFilter(GtkRecentFilter* castitem);
 
156
 
 
157
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
158
 
 
159
public:
 
160
  virtual ~RecentFilter();
 
161
 
 
162
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
163
  static GType get_type()      G_GNUC_CONST;
 
164
 
 
165
 
 
166
  static GType get_base_type() G_GNUC_CONST;
 
167
#endif
 
168
 
 
169
  ///Provides access to the underlying C GObject.
 
170
  GtkRecentFilter*       gobj()       { return reinterpret_cast<GtkRecentFilter*>(gobject_); }
 
171
 
 
172
  ///Provides access to the underlying C GObject.
 
173
  const GtkRecentFilter* gobj() const { return reinterpret_cast<GtkRecentFilter*>(gobject_); }
 
174
 
 
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();
 
177
 
 
178
private:
 
179
 
 
180
  
 
181
protected:
 
182
  RecentFilter();
 
183
 
 
184
public:
 
185
  
 
186
  static Glib::RefPtr<RecentFilter> create();
 
187
 
 
188
 
 
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.
 
192
   * 
 
193
   * @newin{2,10}
 
194
   * @param name Then human readable name of @a filter.
 
195
   */
 
196
  void set_name(const Glib::ustring& name);
 
197
  
 
198
  /** Gets the human-readable name for the filter.
 
199
   * See set_name().
 
200
   * 
 
201
   * @newin{2,10}
 
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.
 
204
   */
 
205
  Glib::ustring get_name() const;
 
206
 
 
207
  
 
208
  /** Adds a rule that allows resources based on their registered MIME type.
 
209
   * 
 
210
   * @newin{2,10}
 
211
   * @param mime_type A MIME type.
 
212
   */
 
213
  void add_mime_type(const Glib::ustring& mime_type);
 
214
  
 
215
  /** Adds a rule that allows resources based on a pattern matching their
 
216
   * display name.
 
217
   * 
 
218
   * @newin{2,10}
 
219
   * @param pattern A file pattern.
 
220
   */
 
221
  void add_pattern(const Glib::ustring& pattern);
 
222
  
 
223
  /** Adds a rule allowing image files in the formats supported
 
224
   * by GdkPixbuf.
 
225
   * 
 
226
   * @newin{2,10}
 
227
   */
 
228
  void add_pixbuf_formats();
 
229
  
 
230
  /** Adds a rule that allows resources based on the name of the application
 
231
   * that has registered them.
 
232
   * 
 
233
   * @newin{2,10}
 
234
   * @param application An application name.
 
235
   */
 
236
  void add_application(const Glib::ustring& application);
 
237
  
 
238
  /** Adds a rule that allows resources based on the name of the group
 
239
   * to which they belong
 
240
   * 
 
241
   * @newin{2,10}
 
242
   * @param group A group name.
 
243
   */
 
244
  void add_group(const Glib::ustring& group);
 
245
  
 
246
  /** Adds a rule that allows resources based on their age - that is, the number
 
247
   * of days elapsed since they were last modified.
 
248
   * 
 
249
   * @newin{2,10}
 
250
   * @param days Number of days.
 
251
   */
 
252
  void add_age(int days);
 
253
 
 
254
  /** A RecentFilter::Info class is used to pass information
 
255
   * about the tested file to filter().
 
256
   *
 
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
 
264
   */
 
265
  class Info
 
266
  {
 
267
  public:
 
268
    Info();
 
269
 
 
270
    ///This bitmask tells us which of the other variables contain useful information.
 
271
    RecentFilterFlags contains;
 
272
 
 
273
    Glib::ustring uri;
 
274
    Glib::ustring display_name;
 
275
    Glib::ustring mime_type;
 
276
    std::list<Glib::ustring> applications;
 
277
    std::list<Glib::ustring> groups;
 
278
    int age;
 
279
  };
 
280
 
 
281
  /// For instance, bool on_custom(const Gtk::RecentFilter::Info& filter_info);
 
282
  typedef sigc::slot<bool, const Info&> SlotCustom;
 
283
 
 
284
  void add_custom(RecentFilterFlags needed, const SlotCustom& slot);
 
285
  
 
286
 
 
287
  /** Gets the fields that need to be filled in for the structure
 
288
   * passed to filter()
 
289
   * 
 
290
   * This function will not typically be used by applications; it
 
291
   * is intended principally for use in the implementation of
 
292
   * Gtk::RecentChooser.
 
293
   * 
 
294
   * @newin{2,10}
 
295
   * @return Bitfield of flags indicating needed fields when
 
296
   * calling filter().
 
297
   */
 
298
  RecentFilterFlags get_needed() const;
 
299
 
 
300
  // Method is used by class RecentChooser implementors.
 
301
  
 
302
  //_WRAP_METHOD(bool filter(const GtkRecentFilterInfo* filter_info), gtk_recent_filter_filter)
 
303
 
 
304
 
 
305
public:
 
306
 
 
307
public:
 
308
  //C++ methods used to invoke GTK+ virtual functions:
 
309
 
 
310
protected:
 
311
  //GTK+ Virtual Functions (override these to change behaviour):
 
312
 
 
313
  //Default Signal Handlers::
 
314
 
 
315
 
 
316
};
 
317
 
 
318
} // namespace Gtk
 
319
 
 
320
 
 
321
namespace Glib
 
322
{
 
323
  /** A Glib::wrap() method for this object.
 
324
   * 
 
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.
 
328
   *
 
329
   * @relates Gtk::RecentFilter
 
330
   */
 
331
  Glib::RefPtr<Gtk::RecentFilter> wrap(GtkRecentFilter* object, bool take_copy = false);
 
332
}
 
333
 
 
334
 
 
335
#endif /* _GTKMM_RECENTFILTER_H */
 
336