| 1 |
/* Copyright (C) 2011 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/appchooser.h> |
| 18 |
#include <gtkmm/box.h> |
| 19 |
#include <gtkmm/menu.h> |
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/box_p.h) |
| 22 |
|
| 23 |
|
| 24 |
namespace Gtk |
| 25 |
{ |
| 26 |
|
| 27 |
/** An application chooser widget that can be embedded in other widgets. |
| 28 |
* |
| 29 |
* This widget is for selecting applications. It is the main building block for AppChooserDialog. |
| 30 |
* Most applications only need to use the latter, but you can use this widget as part of |
| 31 |
* a larger widget if you have special needs. |
| 32 |
* |
| 33 |
* AppChooserWidget offers detailed control over what applications are shown, using |
| 34 |
* property_show_default() and its other properties. |
| 35 |
* See the AppChooser documentation for more information about the groups of applications. |
| 36 |
* |
| 37 |
* To keep track of the selected application, use signal_application_selected() and |
| 38 |
* signal_application_activated(). |
| 39 |
* |
| 40 |
* @ingroup Widgets |
| 41 |
* |
| 42 |
* @newin{3,0} |
| 43 |
*/ |
| 44 |
class GTKMM_API AppChooserWidget |
| 45 |
: public Box, |
| 46 |
public AppChooser |
| 47 |
{ |
| 48 |
_CLASS_GTKOBJECT(AppChooserWidget, GtkAppChooserWidget, GTK_APP_CHOOSER_WIDGET, Box, GtkBox, , , GTKMM_API) |
| 49 |
_IMPLEMENTS_INTERFACE(AppChooser) |
| 50 |
public: |
| 51 |
|
| 52 |
/** Creates a new app-chooser widget for applications that can handle content of the given type. |
| 53 |
* |
| 54 |
* See @ref giommContentType in glibmm for more information about content types. |
| 55 |
* |
| 56 |
* @param content_type The content type to show applications for |
| 57 |
*/ |
| 58 |
_WRAP_CTOR(AppChooserWidget(const Glib::ustring& content_type), gtk_app_chooser_widget_new) |
| 59 |
|
| 60 |
_WRAP_METHOD(void set_show_default(bool setting = true), gtk_app_chooser_widget_set_show_default) |
| 61 |
_WRAP_METHOD(bool get_show_default(), gtk_app_chooser_widget_get_show_default ) |
| 62 |
|
| 63 |
_WRAP_METHOD(void set_show_recommended(bool setting = true), gtk_app_chooser_widget_set_show_recommended) |
| 64 |
_WRAP_METHOD(bool get_show_recommended() const, gtk_app_chooser_widget_get_show_recommended) |
| 65 |
|
| 66 |
_WRAP_METHOD(void set_show_fallback(bool setting = true), gtk_app_chooser_widget_set_show_fallback) |
| 67 |
_WRAP_METHOD(bool get_show_fallback() const, gtk_app_chooser_widget_get_show_fallback) |
| 68 |
|
| 69 |
_WRAP_METHOD(void set_show_other(bool setting = true), gtk_app_chooser_widget_set_show_other) |
| 70 |
_WRAP_METHOD(bool get_show_other() const, gtk_app_chooser_widget_get_show_other) |
| 71 |
|
| 72 |
_WRAP_METHOD(void set_show_all(bool setting = true), gtk_app_chooser_widget_set_show_all) |
| 73 |
_WRAP_METHOD(bool get_show_all() const, gtk_app_chooser_widget_get_show_all) |
| 74 |
|
| 75 |
_WRAP_METHOD(void set_default_text(const Glib::ustring& text), gtk_app_chooser_widget_set_default_text) |
| 76 |
_WRAP_METHOD(Glib::ustring get_default_text(), gtk_app_chooser_widget_get_default_text) |
| 77 |
|
| 78 |
|
| 79 |
#m4 _CONVERSION(`GAppInfo*',`const Glib::RefPtr<Gio::AppInfo>&',`Glib::wrap($3, true)') |
| 80 |
_WRAP_SIGNAL(void application_selected(const Glib::RefPtr<Gio::AppInfo>& app_info), "application-selected") |
| 81 |
_WRAP_SIGNAL(void application_activated(const Glib::RefPtr<Gio::AppInfo>& app_info), "application-activated") |
| 82 |
_WRAP_SIGNAL(void populate_popup(Menu* menu, const Glib::RefPtr<Gio::AppInfo>& app_info), "populate-popup") |
| 83 |
|
| 84 |
_WRAP_PROPERTY("show-default", bool) |
| 85 |
_WRAP_PROPERTY("show-recommended", bool) |
| 86 |
_WRAP_PROPERTY("show-fallback", bool) |
| 87 |
_WRAP_PROPERTY("show-other", bool) |
| 88 |
_WRAP_PROPERTY("show-all", bool) |
| 89 |
_WRAP_PROPERTY("default-text", Glib::ustring) |
| 90 |
}; |
| 91 |
|
| 92 |
} // namespace Gtk |