2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_RECENTCHOOSER_H
4 #define _GTKMM_RECENTCHOOSER_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 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.
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.
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.
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>
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkRecentChooser GtkRecentChooser;
35 typedef struct _GtkRecentChooserClass GtkRecentChooserClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40 { class RecentChooser_Class; } // namespace Gtk
44 /** @addtogroup gtkmmEnums Enums and Flags */
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65 class Value<Gtk::RecentSortType> : public Glib::Value_Enum<Gtk::RecentSortType>
68 static GType value_type() G_GNUC_CONST;
72 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
79 /** Exception class for Gtk::RecentChooser errors.
81 class RecentChooserError : public Glib::Error
90 RecentChooserError(Code error_code, const Glib::ustring& error_message);
91 explicit RecentChooserError(GError* gobject);
94 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97 #ifdef GLIBMM_EXCEPTIONS_ENABLED
98 static void throw_func(GError* gobject);
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
104 friend void wrap_init(); // uses throw_func()
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
115 class Value<Gtk::RecentChooserError::Code> : public Glib::Value_Enum<Gtk::RecentChooserError::Code>
118 static GType value_type() G_GNUC_CONST;
122 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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.
136 * @ingroup RecentFiles
139 class RecentChooser : public Glib::Interface
142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
145 typedef RecentChooser CppObjectType;
146 typedef RecentChooser_Class CppClassType;
147 typedef GtkRecentChooser BaseObjectType;
148 typedef GtkRecentChooserIface BaseClassType;
151 friend class RecentChooser_Class;
152 static CppClassType recentchooser_class_;
155 RecentChooser(const RecentChooser&);
156 RecentChooser& operator=(const RecentChooser&);
159 RecentChooser(); // you must derive from this class
162 // This is public so that C++ wrapper instances can be
163 // created for C instances of unwrapped types.
164 // For instance, if an unexpected C type implements the C interface.
165 explicit RecentChooser(GtkRecentChooser* castitem);
168 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
171 virtual ~RecentChooser();
173 static void add_interface(GType gtype_implementer);
175 #ifndef DOXYGEN_SHOULD_SKIP_THIS
176 static GType get_type() G_GNUC_CONST;
177 static GType get_base_type() G_GNUC_CONST;
180 ///Provides access to the underlying C GObject.
181 GtkRecentChooser* gobj() { return reinterpret_cast<GtkRecentChooser*>(gobject_); }
183 ///Provides access to the underlying C GObject.
184 const GtkRecentChooser* gobj() const { return reinterpret_cast<GtkRecentChooser*>(gobject_); }
191 /** Whether to show recently used resources marked registered as private.
194 * @param show_private <tt>true</tt> to show private items, <tt>false</tt> otherwise.
196 void set_show_private(bool show_private = true);
198 /** Return value: <tt>true</tt> if the recent chooser should show private items,
199 * @return <tt>true</tt> if the recent chooser should show private items,
200 * <tt>false</tt> otherwise.
204 bool get_show_private() const;
206 /** Sets whether @a chooser should display the recently used resources that
207 * it didn't find. This only applies to local resources.
210 * @param show_not_found Whether to show the local items we didn't find.
212 void set_show_not_found(bool show_not_found = true);
214 /** Retrieves whether @a chooser should show the recently used resources that
216 * @return <tt>true</tt> if the resources not found should be displayed, and
217 * <tt>false</tt> otheriwse.
221 bool get_show_not_found() const;
223 /** Sets whether @a chooser can select multiple items.
226 * @param select_multiple <tt>true</tt> if @a chooser can select more than one item.
228 void set_select_multiple(bool select_multiple = true);
230 /** Gets whether @a chooser can select multiple items.
231 * @return <tt>true</tt> if @a chooser can select more than one item.
235 bool get_select_multiple() const;
237 /** Sets the number of items that should be returned by
238 * get_items() and get_uris().
241 * @param limit A positive integer, or -1 for all items.
243 void set_limit(int limit);
246 /** Gets the number of items returned by get_items()
248 * @return A positive integer, or -1 meaning that all items are
253 int get_limit() const;
255 /** Sets whether only local resources, that is resources using the file:// URI
256 * scheme, should be shown in the recently used resources selector. If
257 * @a local_only is <tt>true</tt> (the default) then the shown resources are guaranteed
258 * to be accessible through the operating system native file system.
261 * @param local_only <tt>true</tt> if only local files can be shown.
263 void set_local_only(bool local_only = true);
265 /** Gets whether only local resources should be shown in the recently used
266 * resources selector. See set_local_only()
267 * @return <tt>true</tt> if only local resources should be shown.
271 bool get_local_only() const;
273 /** Sets whether to show a tooltips on the widget.
276 * @param show_tips <tt>true</tt> if tooltips should be shown.
278 void set_show_tips(bool show_tips = true);
280 /** Gets whether @a chooser should display tooltips.
281 * @return <tt>true</tt> if the recent chooser should show tooltips,
282 * <tt>false</tt> otherwise.
286 bool get_show_tips() const;
288 // Deprecated in GTK+ 2.12. murrayc:
291 /** Sets whether @a chooser should show an icon near the resource when
295 * @param show_icons Whether to show an icon near the resource.
297 void set_show_icons(bool show_icons = true);
299 /** Retrieves whether @a chooser should show an icon near the resource.
300 * @return <tt>true</tt> if the icons should be displayed, <tt>false</tt> otherwise.
304 bool get_show_icons() const;
306 /** Changes the sorting order of the recently used resources list displayed by
310 * @param sort_type Sort order that the chooser should use.
312 void set_sort_type(RecentSortType sort_type);
314 /** Gets the value set by set_sort_type().
315 * @return The sorting order of the @a chooser .
319 RecentSortType get_sort_type() const;
322 /** This callback should return -1 if b compares before a, 0 if they compare
323 * equal and 1 if a compares after b.
324 * For instance, int on_sort_compare(const Glib::RefPtr<Gtk::RecentInfo>& a, const Gtk::RecentInfo& b);
326 typedef sigc::slot<int, const Glib::RefPtr<RecentInfo>&, const Glib::RefPtr<RecentInfo>&> SlotCompare;
329 /** Sets the comparison function used when sorting the list of recently
330 * used resources and the sort type is #RECENT_SORT_CUSTOM.
332 void set_sort_func(const SlotCompare& slot);
334 // TODO: Return type should be void since it will never return false but
335 // throwing RecentChooserError instead
337 /** Sets @a uri as the current URI for @a chooser .
339 * @param error Return location for a G::Error, or <tt>0</tt>.
340 * @return <tt>true</tt> if the URI was found.
344 #ifdef GLIBMM_EXCEPTIONS_ENABLED
345 bool set_current_uri(const Glib::ustring& uri);
347 bool set_current_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
348 #endif //GLIBMM_EXCEPTIONS_ENABLED
351 /** Gets the URI currently selected by @a chooser .
352 * @return A newly allocated string holding a URI.
356 Glib::ustring get_current_uri() const;
358 /** Gets the Gtk::RecentInfo currently selected by @a chooser .
359 * @return A Gtk::RecentInfo. Use gtk_recent_info_unref() when
360 * when you have finished using it.
364 Glib::RefPtr<RecentInfo> get_current_item();
366 /** Gets the Gtk::RecentInfo currently selected by @a chooser .
367 * @return A Gtk::RecentInfo. Use gtk_recent_info_unref() when
368 * when you have finished using it.
372 Glib::RefPtr<const RecentInfo> get_current_item() const;
375 /** Selects @a uri inside @a chooser .
377 * @param error Return location for a G::Error, or <tt>0</tt>.
378 * @return <tt>true</tt> if @a uri was found.
382 #ifdef GLIBMM_EXCEPTIONS_ENABLED
383 bool select_uri(const Glib::ustring& uri);
385 bool select_uri(const Glib::ustring& uri, std::auto_ptr<Glib::Error>& error);
386 #endif //GLIBMM_EXCEPTIONS_ENABLED
389 /** Unselects @a uri inside @a chooser .
394 void unselect_uri(const Glib::ustring& uri);
396 /** Selects all the items inside @a chooser , if the @a chooser supports
397 * multiple selection.
403 /** Unselects all the items inside @a chooser .
409 typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
412 /** Gets the list of recently used resources in form of Gtk::RecentInfo objects.
414 * The return value of this function is affected by the "sort-type" and
415 * "limit" properties of @a chooser .
416 * @return A newly allocated list of Gtk::RecentInfo objects. You should
417 * use gtk_recent_info_unref() on every item of the list, and then free
418 * the list itself using Glib::list_free().
422 ListHandle_RecentInfos get_items() const;
424 /** Gets the URI of the recently used resources.
426 * The return value of this function is affected by the "sort-type" and
427 * "limit" properties of the recent chooser.
429 Glib::StringArrayHandle get_uris() const;
432 /** Adds @a filter to the list of Gtk::RecentFilter objects held by @a chooser .
434 * If no previous filter objects were defined, this function will call
438 * @param filter A Gtk::RecentFilter.
440 void add_filter(const RecentFilter& filter);
442 /** Removes @a filter from the list of Gtk::RecentFilter objects held by @a chooser .
445 * @param filter A Gtk::RecentFilter.
447 void remove_filter(const RecentFilter& filter);
449 /** Gets the Gtk::RecentFilter objects held by @a chooser .
450 * @return A singly linked list of Gtk::RecentFilter objects. You
451 * should just free the returned list using Glib::slist_free().
455 Glib::SListHandle<RecentFilter*> list_filters();
457 /** Gets the Gtk::RecentFilter objects held by @a chooser .
458 * @return A singly linked list of Gtk::RecentFilter objects. You
459 * should just free the returned list using Glib::slist_free().
463 Glib::SListHandle<const RecentFilter*> list_filters() const;
465 /** Sets @a filter as the current Gtk::RecentFilter object used by @a chooser
466 * to affect the displayed recently used resources.
469 * @param filter A Gtk::RecentFilter.
471 void set_filter(const RecentFilter& filter);
473 /** Gets the Gtk::RecentFilter object currently used by @a chooser to affect
474 * the display of the recently used resources.
475 * @return A Gtk::RecentFilter object.
479 RecentFilter* get_filter();
481 /** Gets the Gtk::RecentFilter object currently used by @a chooser to affect
482 * the display of the recently used resources.
483 * @return A Gtk::RecentFilter object.
487 const RecentFilter* get_filter() const;
489 /** This signal is emitted when there is a change in the set of
490 * selected recently used resources. This can happen when a user
491 * modifies the selection with the mouse or the keyboard, or when
492 * explicitely calling functions to change the selection.
495 * <tt>void on_my_%selection_changed()</tt>
498 Glib::SignalProxy0< void > signal_selection_changed();
501 /** This signal is emitted when the user "activates" a recent item
502 * in the recent chooser. This can happen by double-clicking on an item
503 * in the recently used resources list, or by pressing
504 * <keycap>Enter</keycap>.
507 * <tt>void on_my_%item_activated()</tt>
510 Glib::SignalProxy0< void > signal_item_activated();
513 #ifdef GLIBMM_PROPERTIES_ENABLED
516 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
517 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
518 * the value of the property changes.
520 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<RecentManager> > property_recent_manager() const;
521 #endif //#GLIBMM_PROPERTIES_ENABLED
524 #ifdef GLIBMM_PROPERTIES_ENABLED
527 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
528 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
529 * the value of the property changes.
531 Glib::PropertyProxy<bool> property_show_private() ;
532 #endif //#GLIBMM_PROPERTIES_ENABLED
534 #ifdef GLIBMM_PROPERTIES_ENABLED
537 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
538 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
539 * the value of the property changes.
541 Glib::PropertyProxy_ReadOnly<bool> property_show_private() const;
542 #endif //#GLIBMM_PROPERTIES_ENABLED
544 #ifdef GLIBMM_PROPERTIES_ENABLED
547 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
548 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
549 * the value of the property changes.
551 Glib::PropertyProxy<bool> property_show_tips() ;
552 #endif //#GLIBMM_PROPERTIES_ENABLED
554 #ifdef GLIBMM_PROPERTIES_ENABLED
557 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
558 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
559 * the value of the property changes.
561 Glib::PropertyProxy_ReadOnly<bool> property_show_tips() const;
562 #endif //#GLIBMM_PROPERTIES_ENABLED
564 #ifdef GLIBMM_PROPERTIES_ENABLED
567 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
568 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
569 * the value of the property changes.
571 Glib::PropertyProxy<bool> property_show_icons() ;
572 #endif //#GLIBMM_PROPERTIES_ENABLED
574 #ifdef GLIBMM_PROPERTIES_ENABLED
577 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
578 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
579 * the value of the property changes.
581 Glib::PropertyProxy_ReadOnly<bool> property_show_icons() const;
582 #endif //#GLIBMM_PROPERTIES_ENABLED
584 #ifdef GLIBMM_PROPERTIES_ENABLED
587 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
588 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
589 * the value of the property changes.
591 Glib::PropertyProxy<bool> property_show_not_found() ;
592 #endif //#GLIBMM_PROPERTIES_ENABLED
594 #ifdef GLIBMM_PROPERTIES_ENABLED
597 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
598 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
599 * the value of the property changes.
601 Glib::PropertyProxy_ReadOnly<bool> property_show_not_found() const;
602 #endif //#GLIBMM_PROPERTIES_ENABLED
604 #ifdef GLIBMM_PROPERTIES_ENABLED
607 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
608 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
609 * the value of the property changes.
611 Glib::PropertyProxy<bool> property_select_multiple() ;
612 #endif //#GLIBMM_PROPERTIES_ENABLED
614 #ifdef GLIBMM_PROPERTIES_ENABLED
617 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
618 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
619 * the value of the property changes.
621 Glib::PropertyProxy_ReadOnly<bool> property_select_multiple() const;
622 #endif //#GLIBMM_PROPERTIES_ENABLED
624 #ifdef GLIBMM_PROPERTIES_ENABLED
627 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
628 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
629 * the value of the property changes.
631 Glib::PropertyProxy<bool> property_local_only() ;
632 #endif //#GLIBMM_PROPERTIES_ENABLED
634 #ifdef GLIBMM_PROPERTIES_ENABLED
637 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
638 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
639 * the value of the property changes.
641 Glib::PropertyProxy_ReadOnly<bool> property_local_only() const;
642 #endif //#GLIBMM_PROPERTIES_ENABLED
644 #ifdef GLIBMM_PROPERTIES_ENABLED
647 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
648 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
649 * the value of the property changes.
651 Glib::PropertyProxy<int> property_limit() ;
652 #endif //#GLIBMM_PROPERTIES_ENABLED
654 #ifdef GLIBMM_PROPERTIES_ENABLED
657 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
658 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
659 * the value of the property changes.
661 Glib::PropertyProxy_ReadOnly<int> property_limit() const;
662 #endif //#GLIBMM_PROPERTIES_ENABLED
664 #ifdef GLIBMM_PROPERTIES_ENABLED
667 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
668 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
669 * the value of the property changes.
671 Glib::PropertyProxy<RecentSortType> property_sort_type() ;
672 #endif //#GLIBMM_PROPERTIES_ENABLED
674 #ifdef GLIBMM_PROPERTIES_ENABLED
677 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
678 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
679 * the value of the property changes.
681 Glib::PropertyProxy_ReadOnly<RecentSortType> property_sort_type() const;
682 #endif //#GLIBMM_PROPERTIES_ENABLED
684 #ifdef GLIBMM_PROPERTIES_ENABLED
687 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
688 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
689 * the value of the property changes.
691 Glib::PropertyProxy<RecentFilter*> property_filter() ;
692 #endif //#GLIBMM_PROPERTIES_ENABLED
694 #ifdef GLIBMM_PROPERTIES_ENABLED
697 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
698 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
699 * the value of the property changes.
701 Glib::PropertyProxy_ReadOnly<RecentFilter*> property_filter() const;
702 #endif //#GLIBMM_PROPERTIES_ENABLED
710 // TODO: How to wrap those vfuncs?
712 //__CONVERSION(`ListHandle_RecentInfos', `GList*', `($3).data()')
713 //__CONVERSION(`Glib::SListHandle<RecentFilter*>', `GSList*', `($3).data()')
715 //_WRAP_VFUNC(bool set_current_uri(const Glib::ustring& uri), "set_current_uri", errthrow)
716 #ifdef GLIBMM_VFUNCS_ENABLED
717 virtual Glib::ustring get_current_uri_vfunc() const;
718 #endif //GLIBMM_VFUNCS_ENABLED
720 //_WRAP_VFUNC(bool select_uri(const Glib::ustring& uri), "select_uri", errthrow)
721 #ifdef GLIBMM_VFUNCS_ENABLED
722 virtual void unselect_uri_vfunc(const Glib::ustring& uri);
723 #endif //GLIBMM_VFUNCS_ENABLED
725 #ifdef GLIBMM_VFUNCS_ENABLED
726 virtual void select_all_vfunc();
727 #endif //GLIBMM_VFUNCS_ENABLED
729 #ifdef GLIBMM_VFUNCS_ENABLED
730 virtual void unselect_all_vfunc();
731 #endif //GLIBMM_VFUNCS_ENABLED
733 //_WRAP_VFUNC(ArrayHandle_RecentInfos get_items() const, "get_items")
734 #ifdef GLIBMM_VFUNCS_ENABLED
735 virtual Glib::RefPtr<RecentManager> get_recent_manager_vfunc();
736 #endif //GLIBMM_VFUNCS_ENABLED
738 #ifdef GLIBMM_VFUNCS_ENABLED
739 virtual void add_filter_vfunc(const RecentFilter& filter);
740 #endif //GLIBMM_VFUNCS_ENABLED
742 #ifdef GLIBMM_VFUNCS_ENABLED
743 virtual void remove_filter_vfunc(const RecentFilter& filter);
744 #endif //GLIBMM_VFUNCS_ENABLED
746 //_WRAP_VFUNC(Glib::SListHandle<RecentFilter*> list_filters(), "list_filters")
747 //_WRAP_VFUNC(void set_sort_func(const SlotCompare& slot), "set_sort_func")
753 //C++ methods used to invoke GTK+ virtual functions:
754 #ifdef GLIBMM_VFUNCS_ENABLED
755 #endif //GLIBMM_VFUNCS_ENABLED
758 //GTK+ Virtual Functions (override these to change behaviour):
759 #ifdef GLIBMM_VFUNCS_ENABLED
760 #endif //GLIBMM_VFUNCS_ENABLED
762 //Default Signal Handlers::
763 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
764 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
774 /** A Glib::wrap() method for this object.
776 * @param object The C instance.
777 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
778 * @result A C++ instance that wraps this C instance.
780 * @relates Gtk::RecentChooser
782 Glib::RefPtr<Gtk::RecentChooser> wrap(GtkRecentChooser* object, bool take_copy = false);
787 #endif /* _GTKMM_RECENTCHOOSER_H */