static void add_arrow (GtkMenuButton *menu_button) { GtkWidget *arrow; arrow = gtk_image_new (); set_arrow_type (GTK_IMAGE (arrow), menu_button->priv->arrow_type); gtk_container_add (GTK_CONTAINER (menu_button), arrow); gtk_widget_show (arrow); menu_button->priv->arrow_widget = arrow; }
/** * gtk_menu_button_set_direction: * @menu_button: a #GtkMenuButton * @direction: a #GtkArrowType * * Sets the direction in which the popup will be popped up, as * well as changing the arrow’s direction. The child will not * be changed to an arrow if it was customized. * * If the does not fit in the available space in the given direction, * GTK+ will its best to keep it inside the screen and fully visible. * * If you pass %GTK_ARROW_NONE for a @direction, the popup will behave * as if you passed %GTK_ARROW_DOWN (although you won’t see any arrows). * * Since: 3.6 */ void gtk_menu_button_set_direction (GtkMenuButton *menu_button, GtkArrowType direction) { GtkMenuButtonPrivate *priv = menu_button->priv; GtkWidget *child; g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button)); if (priv->arrow_type == direction) return; priv->arrow_type = direction; g_object_notify (G_OBJECT (menu_button), "direction"); /* Is it custom content? We don't change that */ child = gtk_bin_get_child (GTK_BIN (menu_button)); if (priv->arrow_widget != child) return; set_arrow_type (GTK_IMAGE (child), priv->arrow_type); update_popover_direction (menu_button); }