/* 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/appchooser.h>
#include <gtkmm/combobox.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/combobox_p.h)


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 ComboBox::signal_changed().
 *
 * The AppChooserButton widget looks like this:
 * @image html appchooserbutton1.png
 *
 * @ingroup Widgets
 *
 * @newin{3,0}
 */
class AppChooserButton
  : public ComboBox,
    public AppChooser
{
  _CLASS_GTKOBJECT(AppChooserButton, GtkAppChooserButton, GTK_APP_CHOOSER_BUTTON, ComboBox, GtkComboBox)
  _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_SIGNAL(void custom_item_activated(const Glib::ustring& item_name), "custom-item-activated")

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


} // namespace Gtk
