/* Copyright (C) 2011 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

_DEFS(gtkmm,gtk)
_CONFIGINCLUDE(gtkmmconfig.h)
_IS_DEPRECATED // The entire file is deprecated.

#include <gtkmm/appchooser.h>
#include <gtkmm/widget.h>

_PINCLUDE(gtkmm/private/widget_p.h)

#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef GTK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()

namespace Gtk
{

/** An application chooser widget that can be embedded in other widgets.
 *
 * This widget is for selecting applications. It is the main building block for AppChooserDialog.
 * Most applications only need to use the latter, but you can use this widget as part of
 * a larger widget if you have special needs.
 *
 * AppChooserWidget offers detailed control over what applications are shown, using
 * property_show_default() and its other properties.
 * See the AppChooser documentation for more information about the groups of applications.
 *
 * To keep track of the selected application, use signal_application_selected() and
 * signal_application_activated().
 *
 * @ingroup Widgets
 *
 * @newin{3,0}
 * @deprecated 4.10: The application selection widgets should be
 *   implemented according to the design of each platform and/or
 *   application requiring them.
 *   This widget will be removed in GTK 5
 */
class GTKMM_API AppChooserWidget
  : public Widget,
    public AppChooser
{
  _CLASS_GTKOBJECT(AppChooserWidget, GtkAppChooserWidget, GTK_APP_CHOOSER_WIDGET, Widget, GtkWidget, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(AppChooser)
public:

  /** Creates a new app-chooser widget for applications that can handle content of the given type.
   *
   * See @ref giommContentType in glibmm for more information about content types.
   *
   * @param content_type The content type to show applications for
   */
  _WRAP_CTOR(AppChooserWidget(const Glib::ustring& content_type), gtk_app_chooser_widget_new)

  _WRAP_METHOD(void set_show_default(bool setting = true), gtk_app_chooser_widget_set_show_default)
  _WRAP_METHOD(bool get_show_default(), gtk_app_chooser_widget_get_show_default )

  _WRAP_METHOD(void set_show_recommended(bool setting = true), gtk_app_chooser_widget_set_show_recommended)
  _WRAP_METHOD(bool get_show_recommended() const, gtk_app_chooser_widget_get_show_recommended)

  _WRAP_METHOD(void set_show_fallback(bool setting = true), gtk_app_chooser_widget_set_show_fallback)
  _WRAP_METHOD(bool get_show_fallback() const, gtk_app_chooser_widget_get_show_fallback)

  _WRAP_METHOD(void set_show_other(bool setting = true), gtk_app_chooser_widget_set_show_other)
  _WRAP_METHOD(bool get_show_other() const, gtk_app_chooser_widget_get_show_other)

  _WRAP_METHOD(void set_show_all(bool setting = true), gtk_app_chooser_widget_set_show_all)
  _WRAP_METHOD(bool get_show_all() const, gtk_app_chooser_widget_get_show_all)

  _WRAP_METHOD(void set_default_text(const Glib::ustring& text), gtk_app_chooser_widget_set_default_text)
  _WRAP_METHOD(Glib::ustring get_default_text(), gtk_app_chooser_widget_get_default_text)

  // no_default_handler because GtkAppChooserWidgetClass is private.
#m4 _CONVERSION(`GAppInfo*',`const Glib::RefPtr<Gio::AppInfo>&',`Glib::wrap($3, true)')
  _WRAP_SIGNAL(void application_selected(const Glib::RefPtr<Gio::AppInfo>& app_info), "application-selected", no_default_handler)
  _WRAP_SIGNAL(void application_activated(const Glib::RefPtr<Gio::AppInfo>& app_info), "application-activated", no_default_handler)

  _WRAP_PROPERTY("show-default", bool)
  _WRAP_PROPERTY("show-recommended", bool)
  _WRAP_PROPERTY("show-fallback", bool)
  _WRAP_PROPERTY("show-other", bool)
  _WRAP_PROPERTY("show-all", bool)
  _WRAP_PROPERTY("default-text", Glib::ustring)
};

} // namespace Gtk
