/* Copyright (C) 2012 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/togglebutton.h>
#include <gtkmm/menu.h>
#include <gtkmm/popover.h>
#include <giomm/menumodel.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/togglebutton_p.h)

namespace Gtk
{

/** A widget that shows a menu when clicked on.
 *
 * This menu can be provided either as a Gtk::Menu, or an abstract Gio::MenuModel.
 *
 * This widget can hold any valid child widget. That is, it can hold
 * almost any other standard Gtk::Widget. The most commonly used child is the
 * provided Gtk::Arrow.
 *
 * @ingroup Widgets
 * @newin{3,6}
 */
class MenuButton : public ToggleButton
{
  _CLASS_GTKOBJECT(MenuButton, GtkMenuButton, GTK_MENU_BUTTON, Gtk::ToggleButton, GtkToggleButton)
public:

  _CTOR_DEFAULT

  /** Disables the button.
   */
  void unset_popup();

  _WRAP_METHOD(Menu* get_popup(), gtk_menu_button_get_popup)
  _WRAP_METHOD(const Menu* get_popup() const, gtk_menu_button_get_popup, constversion)

  _WRAP_METHOD(void set_popover(Popover& popover), gtk_menu_button_set_popover)

  /** Disables the button.
   */
  void unset_popover();

  _WRAP_METHOD(Popover* get_popover(), gtk_menu_button_get_popover)
  _WRAP_METHOD(const Popover* get_popover() const, gtk_menu_button_get_popover, constversion)

  _WRAP_METHOD(void set_use_popover(bool use_popover = true), gtk_menu_button_set_use_popover)
  _WRAP_METHOD(bool get_use_popover(), gtk_menu_button_get_use_popover)

  _WRAP_METHOD(void set_direction(ArrowType   direction), gtk_menu_button_set_direction)
  _WRAP_METHOD(ArrowType get_direction() const, gtk_menu_button_get_direction)

  _WRAP_METHOD(void set_menu_model(const Glib::RefPtr<const Gio::MenuModel>& menu_model), gtk_menu_button_set_menu_model)

  /** Disables the button.
   */
  void unset_menu_model();

  _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_menu_model(), gtk_menu_button_get_menu_model, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_menu_model() const, gtk_menu_button_get_menu_model, refreturn, constversion)

  _WRAP_METHOD(void set_align_widget(Widget& align_widget), gtk_menu_button_set_align_widget)
  _WRAP_METHOD(Widget* get_align_widget(), gtk_menu_button_get_align_widget)
  _WRAP_METHOD(const Widget* get_align_widget() const, gtk_menu_button_get_align_widget)

  _WRAP_PROPERTY("popup", Menu*)
  _WRAP_PROPERTY("menu-model", Glib::RefPtr<Gio::MenuModel>)
  _WRAP_PROPERTY("align-widget", Widget*)
  _WRAP_PROPERTY("direction", ArrowType)
  _WRAP_PROPERTY("use-popover", bool)
  _WRAP_PROPERTY("popover", Popover*)

};

} /* namespace Gtk */

