/* 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
{

/** A button to launch an application chooser dialog.
 *
 * This widget lets the user select an application. See the AppChooser base class API.
 *
 * Initially, an AppChooserButton selects the first application
 * in its list, which will either be the most-recently used application
 * or, if property_show_default_item() is <tt>true</tt>, the
 * default application.
 *
 * The list of applications shown in an AppChooserButton includes
 * the recommended applications for the given content type. When
 * property_show_default_item() is set, the default application
 * is also included. To let the user choose other applications,
 * you can set property_show_dialog_item(),
 * which allows to open a full AppChooserDialog.
 *
 * It is possible to add custom items to the list, using append_custom_item().
 * These items cause signal_custom_item_activated() to be
 * emitted when they are selected.
 *
 * To track changes in the selected application, use signal_changed().
 *
 * The AppChooserButton widget looks like this:
 * @image html appchooserbutton1.png
 *
 * @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 AppChooserButton
  : public Widget,
    public AppChooser
{
  _CLASS_GTKOBJECT(AppChooserButton, GtkAppChooserButton, GTK_APP_CHOOSER_BUTTON, Widget, GtkWidget, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(AppChooser)
public:

  /** Creates a new app-chooser button 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(AppChooserButton(const Glib::ustring& content_type), gtk_app_chooser_button_new)

  _WRAP_METHOD(void append_separator(), gtk_app_chooser_button_append_separator)
  _WRAP_METHOD(void append_custom_item(const Glib::ustring& name, const Glib::ustring& label, const Glib::RefPtr<Gio::Icon>& icon), gtk_app_chooser_button_append_custom_item)
  _WRAP_METHOD(void set_active_custom_item(const Glib::ustring& name), gtk_app_chooser_button_set_active_custom_item)
  _WRAP_METHOD(void set_show_dialog_item(bool setting = true), gtk_app_chooser_button_set_show_dialog_item)
  _WRAP_METHOD(bool get_show_dialog_item() const, gtk_app_chooser_button_get_show_dialog_item)
  _WRAP_METHOD(void set_heading(const Glib::ustring& heading), gtk_app_chooser_button_set_heading)
  _WRAP_METHOD(Glib::ustring get_heading() const, gtk_app_chooser_button_get_heading)
  _WRAP_METHOD(void set_show_default_item(bool setting = true), gtk_app_chooser_button_set_show_default_item)
  _WRAP_METHOD(bool get_show_default_item() const, gtk_app_chooser_button_get_show_default_item)
  _WRAP_METHOD(void set_modal(bool modal = true), gtk_app_chooser_button_set_modal)
  _WRAP_METHOD(bool get_modal() const, gtk_app_chooser_button_get_modal)

  // no_default_handler because GtkAppChooserButtonClass is private.
  _WRAP_SIGNAL(void changed(), "changed", no_default_handler)
  _WRAP_SIGNAL(void custom_item_activated(const Glib::ustring& item_name), "custom-item-activated",
    detail_name custom_item_name, no_default_handler)
  _IGNORE_SIGNAL("activate")dnl// Action signal

  _WRAP_PROPERTY("show-dialog-item", bool)
  _WRAP_PROPERTY("heading", Glib::ustring)
  _WRAP_PROPERTY("show-default-item", bool)
  _WRAP_PROPERTY("modal", bool)
};

} // namespace Gtk
