327c819b510f3740ea1e1f6c1b573fa48be87695
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / recentchooser.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_RECENTCHOOSER_H
4 #define _GTKMM_RECENTCHOOSER_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 Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 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  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library 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 <gtk/gtkrecentchooser.h>
27 #include <glibmm/interface.h>
28 #include <gtkmm/recentinfo.h>
29 #include <gtkmm/recentfilter.h>
30 #include <gtkmm/recentmanager.h>
31
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkRecentChooser GtkRecentChooser;
35 typedef struct _GtkRecentChooserClass GtkRecentChooserClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37
38
39 namespace Gtk
40 { class RecentChooser_Class; } // namespace Gtk
41 namespace Gtk
42 {
43
44 /** @addtogroup gtkmmEnums Enums and Flags */
45
46 /**
47  * @ingroup gtkmmEnums
48  */
49 enum RecentSortType
50 {
51   RECENT_SORT_NONE,
52   RECENT_SORT_MRU,
53   RECENT_SORT_LRU,
54   RECENT_SORT_CUSTOM
55 };
56
57 } // namespace Gtk
58
59
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 namespace Glib
62 {
63
64 template <>
65 class Value<Gtk::RecentSortType> : public Glib::Value_Enum<Gtk::RecentSortType>
66 {
67 public:
68   static GType value_type() G_GNUC_CONST;
69 };
70
71 } // namespace Glib
72 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
73
74
75 namespace Gtk
76 {
77
78
79 /** Exception class for Gtk::RecentChooser errors.
80  */
81 class RecentChooserError : public Glib::Error
82 {
83 public:
84   enum Code
85   {
86     NOT_FOUND,
87     INVALID_URI
88   };
89
90   RecentChooserError(Code error_code, const Glib::ustring& error_message);
91   explicit RecentChooserError(GError* gobject);
92   Code code() const;
93
94 #ifndef DOXYGEN_SHOULD_SKIP_THIS
95 private:
96
97 #ifdef GLIBMM_EXCEPTIONS_ENABLED
98   static void throw_func(GError* gobject);
99 #else
100   //When not using exceptions, we just pass the Exception object around without throwing it:
101   static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
102 #endif //GLIBMM_EXCEPTIONS_ENABLED
103
104   friend void wrap_init(); // uses throw_func()
105 #endif
106 };
107
108 } // namespace Gtk
109
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
111 namespace Glib
112 {
113
114 template <>
115 class Value<Gtk::RecentChooserError::Code> : public Glib::Value_Enum<Gtk::RecentChooserError::Code>
116 {
117 public:
118   static GType value_type() G_GNUC_CONST;
119 };
120
121 } // namespace Glib
122 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
123
124
125 namespace Gtk
126 {
127
128
129 /** RecentChooser is an interface that can be implemented by widgets
130  * displaying the list of recently used files.  In GTK+, the main objects
131  * that implement this interface are RecentChooserWidget, RecentChooserDialog
132  * and RecentChooserMenu.
133  *
134  * @newin2p10
135  *
136  * @ingroup RecentFiles
137  */
138
139 class RecentChooser : public Glib::Interface
140 {
141   
142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143
144 public:
145   typedef RecentChooser CppObjectType;
146   typedef RecentChooser_Class CppClassType;
147   typedef GtkRecentChooser BaseObjectType;
148   typedef GtkRecentChooserIface BaseClassType;
149
150 private:
151   friend class RecentChooser_Class;
152   static CppClassType recentchooser_class_;
153
154   // noncopyable
155   RecentChooser(const RecentChooser&);
156   RecentChooser& operator=(const RecentChooser&);
157
158 protected:
159   RecentChooser(); // you must derive from this class
160   explicit RecentChooser(GtkRecentChooser* castitem);
161
162 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
163
164 public:
165   virtual ~RecentChooser();
166
167   static void add_interface(GType gtype_implementer);
168
169 #ifndef DOXYGEN_SHOULD_SKIP_THIS
170   static GType get_type()      G_GNUC_CONST;
171   static GType get_base_type() G_GNUC_CONST;
172 #endif
173
174   ///Provides access to the underlying C GObject.
175   GtkRecentChooser*       gobj()       { return reinterpret_cast<GtkRecentChooser*>(gobject_); }
176
177   ///Provides access to the underlying C GObject.  
178   const GtkRecentChooser* gobj() const { return reinterpret_cast<GtkRecentChooser*>(gobject_); }
179
180 private:
181
182 public:
183
184   
185   void set_show_private(bool show_private = true);
186   
187   bool get_show_private() const;
188   
189   void set_show_not_found(bool show_not_found = true);
190   
191   bool get_show_not_found() const;
192   
193   void set_select_multiple(bool select_multiple = true);
194   
195   bool get_select_multiple() const;
196   
197   void set_limit(int limit);
198   void unset_limit();
199   
200   int get_limit() const;
201   
202   void set_local_only(bool local_only = true);
203   
204   bool get_local_only() const;
205   
206   void set_show_tips(bool show_tips = true);
207   
208   bool get_show_tips() const;
209
210   // TODO: These methods are declared in gtkrecentchooser.h but throw errors when
211   // using them on RecentChooserWidget or RecentChooserDialog.
212   // RecentChooserMenu reimplements them.
213   // In an email titled "GtkRecentChooser API glitch", Emmanuele Bassi said that these would be 
214   // deprecated in GTK+ 2.12. murrayc.
215   //_WRAP_METHOD(void set_show_numbers(bool show_numbers = true), gtk_recent_chooser_set_show_numbers)
216   //_WRAP_METHOD(bool get_show_numbers() const, gtk_recent_chooser_get_show_numbers)
217   
218
219   void set_show_icons(bool show_icons = true);
220   
221   bool get_show_icons() const;
222   
223   void set_sort_type(RecentSortType sort_type);
224   
225   RecentSortType get_sort_type() const;
226
227
228   /** This callback should return -1 if b compares before a, 0 if they compare
229    * equal and 1 if a compares after b.
230    * For instance, int on_sort_compare(const Glib::RefPtr<Gtk::RecentInfo>& a, const Gtk::RecentInfo& b);
231    */
232   typedef sigc::slot<int, const Glib::RefPtr<RecentInfo>&, const Glib::RefPtr<RecentInfo>&> SlotCompare;
233   
234
235   /** Sets the comparison function used when sorting the list of recently
236    * used resources and the sort type is #RECENT_SORT_CUSTOM.
237    */
238   void set_sort_func(const SlotCompare& slot);
239
240   // TODO: Return type should be void since it will never return false but
241   // throwing RecentChooserError instead
242   
243 #ifdef GLIBMM_EXCEPTIONS_ENABLED
244   bool set_current_uri(const Glib::ustring& uri);
245 #else
246   bool set_current_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
247 #endif //GLIBMM_EXCEPTIONS_ENABLED
248
249   
250   Glib::ustring get_current_uri() const;
251   
252   Glib::RefPtr<RecentInfo> get_current_item();
253   
254   Glib::RefPtr<const RecentInfo> get_current_item() const;
255   // TODO: Same here
256   
257 #ifdef GLIBMM_EXCEPTIONS_ENABLED
258   bool select_uri(const Glib::ustring& uri);
259 #else
260   bool select_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
261 #endif //GLIBMM_EXCEPTIONS_ENABLED
262
263   
264   void unselect_uri(const Glib::ustring& uri);
265   
266   void select_all();
267   
268   void unselect_all();
269
270   typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
271   
272
273   ListHandle_RecentInfos get_items() const;
274
275   /** Gets the URI of the recently used resources.
276    *
277    * The return value of this function is affected by the "sort-type" and
278    * "limit" properties of the recent chooser.
279    */
280   Glib::StringArrayHandle get_uris() const;
281   
282
283   void add_filter(const RecentFilter& filter);
284   
285   void remove_filter(const RecentFilter& filter);
286   
287   Glib::SListHandle<RecentFilter*> list_filters();
288   
289   Glib::SListHandle<const RecentFilter*> list_filters() const;
290   
291   void set_filter(const RecentFilter& filter);
292   
293   RecentFilter* get_filter();
294   
295   const RecentFilter* get_filter() const;
296
297   /** This signal is emitted when there is a change in the set of
298    * selected recently used resources.  This can happen when a user
299    * modifies the selection with the mouse or the keyboard, or when
300    * explicitely calling functions to change the selection.
301    */
302   
303 /**
304    * @par Prototype:
305    * <tt>void %selection_changed()</tt>
306    */
307
308   Glib::SignalProxy0< void > signal_selection_changed();
309
310
311   /** This signal is emitted when the user "activates" a recent item
312    * in the recent chooser.  This can happen by double-clicking on an item
313    * in the recently used resources list, or by pressing
314    * <keycap>Enter</keycap>.
315    */
316   
317 /**
318    * @par Prototype:
319    * <tt>void %item_activated()</tt>
320    */
321
322   Glib::SignalProxy0< void > signal_item_activated();
323
324
325   #ifdef GLIBMM_PROPERTIES_ENABLED
326 /** 
327    *
328    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
329    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
330    * the value of the property changes.
331    */
332   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<RecentManager> > property_recent_manager() const;
333 #endif //#GLIBMM_PROPERTIES_ENABLED
334
335
336   #ifdef GLIBMM_PROPERTIES_ENABLED
337 /** 
338    *
339    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
340    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
341    * the value of the property changes.
342    */
343   Glib::PropertyProxy<bool> property_show_private() ;
344 #endif //#GLIBMM_PROPERTIES_ENABLED
345
346 #ifdef GLIBMM_PROPERTIES_ENABLED
347 /** 
348    *
349    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
350    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
351    * the value of the property changes.
352    */
353   Glib::PropertyProxy_ReadOnly<bool> property_show_private() const;
354 #endif //#GLIBMM_PROPERTIES_ENABLED
355
356   #ifdef GLIBMM_PROPERTIES_ENABLED
357 /** 
358    *
359    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
360    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
361    * the value of the property changes.
362    */
363   Glib::PropertyProxy<bool> property_show_tips() ;
364 #endif //#GLIBMM_PROPERTIES_ENABLED
365
366 #ifdef GLIBMM_PROPERTIES_ENABLED
367 /** 
368    *
369    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
370    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
371    * the value of the property changes.
372    */
373   Glib::PropertyProxy_ReadOnly<bool> property_show_tips() const;
374 #endif //#GLIBMM_PROPERTIES_ENABLED
375
376   #ifdef GLIBMM_PROPERTIES_ENABLED
377 /** 
378    *
379    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
380    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
381    * the value of the property changes.
382    */
383   Glib::PropertyProxy<bool> property_show_icons() ;
384 #endif //#GLIBMM_PROPERTIES_ENABLED
385
386 #ifdef GLIBMM_PROPERTIES_ENABLED
387 /** 
388    *
389    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
390    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
391    * the value of the property changes.
392    */
393   Glib::PropertyProxy_ReadOnly<bool> property_show_icons() const;
394 #endif //#GLIBMM_PROPERTIES_ENABLED
395
396   #ifdef GLIBMM_PROPERTIES_ENABLED
397 /** 
398    *
399    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
400    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
401    * the value of the property changes.
402    */
403   Glib::PropertyProxy<bool> property_show_not_found() ;
404 #endif //#GLIBMM_PROPERTIES_ENABLED
405
406 #ifdef GLIBMM_PROPERTIES_ENABLED
407 /** 
408    *
409    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
410    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
411    * the value of the property changes.
412    */
413   Glib::PropertyProxy_ReadOnly<bool> property_show_not_found() const;
414 #endif //#GLIBMM_PROPERTIES_ENABLED
415
416   #ifdef GLIBMM_PROPERTIES_ENABLED
417 /** 
418    *
419    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
420    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
421    * the value of the property changes.
422    */
423   Glib::PropertyProxy<bool> property_select_multiple() ;
424 #endif //#GLIBMM_PROPERTIES_ENABLED
425
426 #ifdef GLIBMM_PROPERTIES_ENABLED
427 /** 
428    *
429    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
430    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
431    * the value of the property changes.
432    */
433   Glib::PropertyProxy_ReadOnly<bool> property_select_multiple() const;
434 #endif //#GLIBMM_PROPERTIES_ENABLED
435
436   #ifdef GLIBMM_PROPERTIES_ENABLED
437 /** 
438    *
439    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
440    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
441    * the value of the property changes.
442    */
443   Glib::PropertyProxy<bool> property_local_only() ;
444 #endif //#GLIBMM_PROPERTIES_ENABLED
445
446 #ifdef GLIBMM_PROPERTIES_ENABLED
447 /** 
448    *
449    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
450    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
451    * the value of the property changes.
452    */
453   Glib::PropertyProxy_ReadOnly<bool> property_local_only() const;
454 #endif //#GLIBMM_PROPERTIES_ENABLED
455
456   #ifdef GLIBMM_PROPERTIES_ENABLED
457 /** 
458    *
459    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
460    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
461    * the value of the property changes.
462    */
463   Glib::PropertyProxy<int> property_limit() ;
464 #endif //#GLIBMM_PROPERTIES_ENABLED
465
466 #ifdef GLIBMM_PROPERTIES_ENABLED
467 /** 
468    *
469    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
470    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
471    * the value of the property changes.
472    */
473   Glib::PropertyProxy_ReadOnly<int> property_limit() const;
474 #endif //#GLIBMM_PROPERTIES_ENABLED
475
476   #ifdef GLIBMM_PROPERTIES_ENABLED
477 /** 
478    *
479    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
480    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
481    * the value of the property changes.
482    */
483   Glib::PropertyProxy<RecentSortType> property_sort_type() ;
484 #endif //#GLIBMM_PROPERTIES_ENABLED
485
486 #ifdef GLIBMM_PROPERTIES_ENABLED
487 /** 
488    *
489    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
490    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
491    * the value of the property changes.
492    */
493   Glib::PropertyProxy_ReadOnly<RecentSortType> property_sort_type() const;
494 #endif //#GLIBMM_PROPERTIES_ENABLED
495
496   #ifdef GLIBMM_PROPERTIES_ENABLED
497 /** 
498    *
499    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
500    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
501    * the value of the property changes.
502    */
503   Glib::PropertyProxy<RecentFilter*> property_filter() ;
504 #endif //#GLIBMM_PROPERTIES_ENABLED
505
506 #ifdef GLIBMM_PROPERTIES_ENABLED
507 /** 
508    *
509    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
510    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
511    * the value of the property changes.
512    */
513   Glib::PropertyProxy_ReadOnly<RecentFilter*> property_filter() const;
514 #endif //#GLIBMM_PROPERTIES_ENABLED
515
516
517 protected:
518
519   // As in editable.hg
520   
521
522   // TODO: How to wrap those vfuncs?
523
524   //__CONVERSION(`ListHandle_RecentInfos', `GList*', `($3).data()')
525   //__CONVERSION(`Glib::SListHandle<RecentFilter*>', `GSList*', `($3).data()')
526
527   //_WRAP_VFUNC(bool set_current_uri(const Glib::ustring& uri), "set_current_uri", errthrow)
528   #ifdef GLIBMM_VFUNCS_ENABLED
529   virtual Glib::ustring get_current_uri_vfunc() const;
530 #endif //GLIBMM_VFUNCS_ENABLED
531
532   //_WRAP_VFUNC(bool select_uri(const Glib::ustring& uri), "select_uri", errthrow)
533   #ifdef GLIBMM_VFUNCS_ENABLED
534   virtual void unselect_uri_vfunc(const Glib::ustring& uri);
535 #endif //GLIBMM_VFUNCS_ENABLED
536
537   #ifdef GLIBMM_VFUNCS_ENABLED
538   virtual void select_all_vfunc();
539 #endif //GLIBMM_VFUNCS_ENABLED
540
541   #ifdef GLIBMM_VFUNCS_ENABLED
542   virtual void unselect_all_vfunc();
543 #endif //GLIBMM_VFUNCS_ENABLED
544
545   //_WRAP_VFUNC(ArrayHandle_RecentInfos get_items() const, "get_items")
546   #ifdef GLIBMM_VFUNCS_ENABLED
547   virtual Glib::RefPtr<RecentManager> get_recent_manager_vfunc();
548 #endif //GLIBMM_VFUNCS_ENABLED
549
550   #ifdef GLIBMM_VFUNCS_ENABLED
551   virtual void add_filter_vfunc(const RecentFilter& filter);
552 #endif //GLIBMM_VFUNCS_ENABLED
553
554   #ifdef GLIBMM_VFUNCS_ENABLED
555   virtual void remove_filter_vfunc(const RecentFilter& filter);
556 #endif //GLIBMM_VFUNCS_ENABLED
557
558   //_WRAP_VFUNC(Glib::SListHandle<RecentFilter*> list_filters(), "list_filters")
559   //_WRAP_VFUNC(void set_sort_func(const SlotCompare& slot), "set_sort_func")
560
561
562 public:
563
564 public:
565   //C++ methods used to invoke GTK+ virtual functions:
566 #ifdef GLIBMM_VFUNCS_ENABLED
567 #endif //GLIBMM_VFUNCS_ENABLED
568
569 protected:
570   //GTK+ Virtual Functions (override these to change behaviour):
571 #ifdef GLIBMM_VFUNCS_ENABLED
572 #endif //GLIBMM_VFUNCS_ENABLED
573
574   //Default Signal Handlers::
575 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
576 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
577
578
579 };
580  
581 } // namespace Gtk
582
583
584 namespace Glib
585 {
586   /** @relates Gtk::RecentChooser
587    * @param object The C instance
588    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
589    * @result A C++ instance that wraps this C instance.
590    */
591   Glib::RefPtr<Gtk::RecentChooser> wrap(GtkRecentChooser* object, bool take_copy = false);
592
593 } // namespace Glib
594
595
596 #endif /* _GTKMM_RECENTCHOOSER_H */
597