/* 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, see .
*/
#include
#include
#include
#include
_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 GTKMM_API MenuButton : public ToggleButton
{
_CLASS_GTKOBJECT(MenuButton, GtkMenuButton, GTK_MENU_BUTTON, Gtk::ToggleButton, GtkToggleButton, , , GTKMM_API)
public:
_CTOR_DEFAULT
_WRAP_METHOD(void set_menu(Menu& menu), gtk_menu_button_set_popup, deprecated "Use set_popup() instead.")
_DEPRECATE_IFDEF_START
/** Disables the button.
*
* @deprecated Use unset_popup() instead.
*/
void unset_menu();
_DEPRECATE_IFDEF_END
_WRAP_METHOD(Menu* get_menu(), gtk_menu_button_get_popup, deprecated "Use get_popup() instead.")
_WRAP_METHOD(const Menu* get_menu() const, gtk_menu_button_get_popup, constversion, deprecated "Use get_popup() instead.")
_WRAP_METHOD(void set_popup(Menu& menu), gtk_menu_button_set_popup)
/** 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& menu_model), gtk_menu_button_set_menu_model)
/** Disables the button.
*/
void unset_menu_model();
_WRAP_METHOD(Glib::RefPtr get_menu_model(), gtk_menu_button_get_menu_model, refreturn)
_WRAP_METHOD(Glib::RefPtr 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)
#ifndef GTKMM_DISABLE_DEPRECATED
// _WRAP_PROPERTY("menu", Menu*, deprecated "Use popup instead.")
// The GtkMenuButton::menu property does not exist in gtk+ 3.7.0 and later. Must hand-code to avoid an API/ABI break.
/** The dropdown menu.
* @deprecated Use popup instead.
*
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Menu* > property_menu() ;
/** The dropdown menu.
* @deprecated Use popup instead.
*
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Menu* > property_menu() const;
#endif // GTKMM_DISABLE_DEPRECATED
_WRAP_PROPERTY("popup", Menu*)
_WRAP_PROPERTY("menu-model", Glib::RefPtr)
_WRAP_PROPERTY("align-widget", Widget*)
_WRAP_PROPERTY("direction", ArrowType)
_WRAP_PROPERTY("use-popover", bool)
_WRAP_PROPERTY("popover", Popover*)
};
} /* namespace Gtk */