+
+ return GTK_WIDGET_CLASS (gtk_menu_button_parent_class)->button_press_event (widget, event);
+}
+
+static void
+gtk_menu_button_add (GtkContainer *container,
+ GtkWidget *child)
+{
+ GtkMenuButton *button = GTK_MENU_BUTTON (container);
+
+ if (button->priv->arrow_widget)
+ gtk_container_remove (container, button->priv->arrow_widget);
+
+ GTK_CONTAINER_CLASS (gtk_menu_button_parent_class)->add (container, child);
+}
+
+static void
+gtk_menu_button_remove (GtkContainer *container,
+ GtkWidget *child)
+{
+ GtkMenuButton *button = GTK_MENU_BUTTON (container);
+
+ if (child == button->priv->arrow_widget)
+ button->priv->arrow_widget = NULL;
+
+ GTK_CONTAINER_CLASS (gtk_menu_button_parent_class)->remove (container, child);
+}
+
+static void
+gtk_menu_button_class_init (GtkMenuButtonClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+ GtkToggleButtonClass *toggle_button_class = GTK_TOGGLE_BUTTON_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GtkMenuButtonPrivate));
+
+ gobject_class->set_property = gtk_menu_button_set_property;
+ gobject_class->get_property = gtk_menu_button_get_property;
+ gobject_class->dispose = gtk_menu_button_dispose;
+
+ widget_class->state_flags_changed = gtk_menu_button_state_flags_changed;
+ widget_class->button_press_event = gtk_menu_button_button_press_event;
+
+ container_class->add = gtk_menu_button_add;
+ container_class->remove = gtk_menu_button_remove;
+
+ toggle_button_class->toggled = gtk_menu_button_toggled;
+
+ /**
+ * GtkMenuButton:popup:
+ *
+ * The #GtkMenu that will be popped up when the button is clicked.
+ *
+ * Since: 3.6
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_POPUP,
+ g_param_spec_object ("popup",
+ P_("popup"),
+ P_("The dropdown menu."),
+ GTK_TYPE_MENU,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkMenuButton:menu-model:
+ *
+ * The #GMenuModel from which the menu to pop up will be created.
+ * See gtk_menu_button_set_menu_model() for the interaction with the
+ * #GtkMenuButton:popup property.
+ *
+ * Since: 3.6
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_MODEL,
+ g_param_spec_object ("menu-model",
+ P_("menu-model"),
+ P_("The dropdown menu's model."),
+ G_TYPE_MENU_MODEL,
+ G_PARAM_READWRITE));
+ /**
+ * GtkMenuButton:align-widget:
+ *
+ * The #GtkWidget to use to align the popup menu with.
+ *
+ * Since: 3.6
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_ALIGN_WIDGET,
+ g_param_spec_object ("align-widget",
+ P_("align-widget"),
+ P_("The parent widget which the menu should align with."),
+ GTK_TYPE_CONTAINER,
+ G_PARAM_READWRITE));
+ /**
+ * GtkMenuButton:direction:
+ *
+ * The #GtkArrowType representing the direction in which the
+ * menu will be popped out.
+ *
+ * Since: 3.6
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_DIRECTION,
+ g_param_spec_enum ("direction",
+ P_("direction"),
+ P_("The direction the arrow should point."),
+ GTK_TYPE_ARROW_TYPE,
+ GTK_ARROW_DOWN,
+ G_PARAM_READWRITE));
+}
+
+static void
+add_arrow (GtkMenuButton *menu_button)
+{
+ GtkWidget *arrow;
+
+ arrow = gtk_arrow_new (menu_button->priv->arrow_type, GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (menu_button), arrow);
+ gtk_widget_show (arrow);
+ menu_button->priv->arrow_widget = arrow;