Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / filefilter.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_FILEFILTER_H
4 #define _GTKMM_FILEFILTER_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* Copyright (C) 2003 The gtkmm Development Team
11  *
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.
16  *
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.
21  *
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.
25  */
26
27 #include <gtkmm/object.h>
28
29
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 */
34
35
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkFileFilter GtkFileFilter;
38 typedef struct _GtkFileFilterClass GtkFileFilterClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40
41
42 namespace Gtk
43 { class FileFilter_Class; } // namespace Gtk
44 namespace Gtk
45 {
46
47 /** @addtogroup gtkmmEnums Enums and Flags */
48
49 /**
50  * @ingroup gtkmmEnums
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>
59  */
60 enum FileFilterFlags
61 {
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
66 };
67
68 /** @ingroup gtkmmEnums */
69 inline FileFilterFlags operator|(FileFilterFlags lhs, FileFilterFlags rhs)
70   { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
71
72 /** @ingroup gtkmmEnums */
73 inline FileFilterFlags operator&(FileFilterFlags lhs, FileFilterFlags rhs)
74   { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
75
76 /** @ingroup gtkmmEnums */
77 inline FileFilterFlags operator^(FileFilterFlags lhs, FileFilterFlags rhs)
78   { return static_cast<FileFilterFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
79
80 /** @ingroup gtkmmEnums */
81 inline FileFilterFlags operator~(FileFilterFlags flags)
82   { return static_cast<FileFilterFlags>(~static_cast<unsigned>(flags)); }
83
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))); }
87
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))); }
91
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))); }
95
96 } // namespace Gtk
97
98
99 #ifndef DOXYGEN_SHOULD_SKIP_THIS
100 namespace Glib
101 {
102
103 template <>
104 class Value<Gtk::FileFilterFlags> : public Glib::Value_Flags<Gtk::FileFilterFlags>
105 {
106 public:
107   static GType value_type() G_GNUC_CONST;
108 };
109
110 } // namespace Glib
111 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
112
113
114 namespace Gtk
115 {
116
117
118 class FileFilter : public Gtk::Object
119 {
120   public:
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 */
127
128   virtual ~FileFilter();
129
130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
131
132 private:
133   friend class FileFilter_Class;
134   static CppClassType filefilter_class_;
135
136   // noncopyable
137   FileFilter(const FileFilter&);
138   FileFilter& operator=(const FileFilter&);
139
140 protected:
141   explicit FileFilter(const Glib::ConstructParams& construct_params);
142   explicit FileFilter(GtkFileFilter* castitem);
143
144 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
145
146 public:
147 #ifndef DOXYGEN_SHOULD_SKIP_THIS
148   static GType get_type()      G_GNUC_CONST;
149   static GType get_base_type() G_GNUC_CONST;
150 #endif
151
152   ///Provides access to the underlying C GtkObject.
153   GtkFileFilter*       gobj()       { return reinterpret_cast<GtkFileFilter*>(gobject_); }
154
155   ///Provides access to the underlying C GtkObject.
156   const GtkFileFilter* gobj() const { return reinterpret_cast<GtkFileFilter*>(gobject_); }
157
158
159 public:
160   //C++ methods used to invoke GTK+ virtual functions:
161
162 protected:
163   //GTK+ Virtual Functions (override these to change behaviour):
164
165   //Default Signal Handlers::
166
167
168 private:
169
170 public:
171  FileFilter();
172
173   
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.
177    * 
178    * Since: 2.4
179    * @param name The human-readable-name for the filter, or <tt>0</tt>
180    * to remove any existing name.
181    */
182   void set_name(const Glib::ustring& name);
183   
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.
188    * 
189    * Since: 2.4.
190    */
191   Glib::ustring get_name() const;
192
193   
194   /** Adds a rule allowing a given mime type to @a filter .
195    * 
196    * Since: 2.4
197    * @param mime_type Name of a MIME type.
198    */
199   void add_mime_type(const Glib::ustring& mime_type);
200   
201   /** Adds a rule allowing a shell style glob to a filter.
202    * 
203    * Since: 2.4
204    * @param pattern A shell style glob.
205    */
206   void add_pattern(const Glib::ustring& pattern);
207   
208   /** Adds a rule allowing image files in the formats supported
209    * by GdkPixbuf.
210    * 
211    * Since: 2.6
212    */
213   void add_pixbuf_formats();
214
215   class Info
216   {
217   public:
218     FileFilterFlags contains;
219     Glib::ustring filename;
220     Glib::ustring uri;
221     Glib::ustring display_name;
222     Glib::ustring mime_type;
223   };
224
225   /// For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info);
226   typedef sigc::slot<bool, const Info&> SlotCustom;
227   
228   void add_custom(FileFilterFlags needed, const SlotCustom& slot);
229   
230
231   /** Gets the fields that need to be filled in for the structure
232    * passed to gtk_file_filter_filter()
233    * 
234    * This function will not typically be used by applications; it
235    * is intended principally for use in the implementation of
236    * Gtk::FileChooser.
237    * @return Bitfield of flags indicating needed fields when
238    * calling gtk_file_filter_filter()
239    * 
240    * Since: 2.4.
241    */
242   FileFilterFlags get_needed() const;
243
244   //TODO: This method is used by FileChooser implementors, so we don't need to wrap it.
245   
246   //_WRAP_METHOD(bool filter(const GtkFileFilterInfo* filter_info), gtk_file_filter_filter)
247
248
249 };
250
251 } // namespace Gtk
252
253
254 namespace Glib
255 {
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.
260    */
261   Gtk::FileFilter* wrap(GtkFileFilter* object, bool take_copy = false);
262 }
263 #endif /* _GTKMM_FILEFILTER_H */
264