gtkmenutoolbutton.c 18.9 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * Copyright (C) 2003 Ricardo Fernandez Pascual
 * Copyright (C) 2004 Paolo Borelli
 *
 * 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 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

22
#include "config.h"
23 24 25

#undef GTK_DISABLE_DEPRECATED /* GtkTooltips */

26 27 28 29 30 31 32
#include "gtkmenutoolbutton.h"
#include "gtktogglebutton.h"
#include "gtkarrow.h"
#include "gtkhbox.h"
#include "gtkvbox.h"
#include "gtkmenu.h"
#include "gtkmain.h"
33
#include "gtkprivate.h"
34
#include "gtkintl.h"
35
#include "gtkalias.h"
36 37 38 39 40 41 42 43 44 45 46 47 48


#define GTK_MENU_TOOL_BUTTON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GTK_TYPE_MENU_TOOL_BUTTON, GtkMenuToolButtonPrivate))

struct _GtkMenuToolButtonPrivate
{
  GtkWidget *button;
  GtkWidget *arrow;
  GtkWidget *arrow_button;
  GtkWidget *box;
  GtkMenu   *menu;
};

49 50 51 52
static void gtk_menu_tool_button_destroy    (GtkObject              *object);

static int  menu_deactivate_cb              (GtkMenuShell           *menu_shell,
					     GtkMenuToolButton      *button);
53 54 55

enum
{
56
  SHOW_MENU,
57 58 59 60 61 62
  LAST_SIGNAL
};

enum
{
  PROP_0,
63
  PROP_MENU
64 65 66 67
};

static gint signals[LAST_SIGNAL];

Matthias Clasen's avatar
Matthias Clasen committed
68
G_DEFINE_TYPE (GtkMenuToolButton, gtk_menu_tool_button, GTK_TYPE_TOOL_BUTTON)
69 70 71 72

static void
gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button)
{
73
  GtkMenuToolButtonPrivate *priv = button->priv;
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
  GtkWidget *box;
  GtkOrientation orientation;

  orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));

  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    {
      box = gtk_hbox_new (FALSE, 0);
      gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_DOWN, GTK_SHADOW_NONE);
    }
  else
    {
      box = gtk_vbox_new (FALSE, 0);
      gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
    }

  if (priv->button && priv->button->parent)
    {
      g_object_ref (priv->button);
      gtk_container_remove (GTK_CONTAINER (priv->button->parent),
                            priv->button);
      gtk_container_add (GTK_CONTAINER (box), priv->button);
      g_object_unref (priv->button);
    }

  if (priv->arrow_button && priv->arrow_button->parent)
    {
      g_object_ref (priv->arrow_button);
      gtk_container_remove (GTK_CONTAINER (priv->arrow_button->parent),
                            priv->arrow_button);
      gtk_box_pack_end (GTK_BOX (box), priv->arrow_button,
                        FALSE, FALSE, 0);
      g_object_unref (priv->arrow_button);
    }

  if (priv->box)
    {
111 112 113 114 115 116 117 118 119 120 121
      gchar *tmp;

      /* Transfer a possible tooltip to the new box */
      g_object_get (priv->box, "tooltip-markup", &tmp, NULL);

      if (tmp)
        {
	  g_object_set (box, "tooltip-markup", tmp, NULL);
	  g_free (tmp);
	}

122 123 124 125 126 127 128 129 130 131 132
      /* Note: we are not destroying the button and the arrow_button
       * here because they were removed from their container above
       */
      gtk_widget_destroy (priv->box);
    }

  priv->box = box;

  gtk_container_add (GTK_CONTAINER (button), priv->box);
  gtk_widget_show_all (priv->box);

133 134 135
  gtk_button_set_relief (GTK_BUTTON (priv->arrow_button),
			 gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (button)));
  
136 137 138 139 140 141 142 143 144
  gtk_widget_queue_resize (GTK_WIDGET (button));
}

static void
gtk_menu_tool_button_toolbar_reconfigured (GtkToolItem *toolitem)
{
  gtk_menu_tool_button_construct_contents (GTK_MENU_TOOL_BUTTON (toolitem));

  /* chain up */
Matthias Clasen's avatar
Matthias Clasen committed
145
  GTK_TOOL_ITEM_CLASS (gtk_menu_tool_button_parent_class)->toolbar_reconfigured (toolitem);
146 147
}

148 149 150 151 152 153 154 155 156 157 158 159 160
static void
gtk_menu_tool_button_state_changed (GtkWidget    *widget,
				    GtkStateType  previous_state)
{
  GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (widget);
  GtkMenuToolButtonPrivate *priv = button->priv;

  if (!GTK_WIDGET_IS_SENSITIVE (widget) && priv->menu)
    {
      gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
    }
}

161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
static void
gtk_menu_tool_button_set_property (GObject      *object,
                                   guint         prop_id,
                                   const GValue *value,
                                   GParamSpec   *pspec)
{
  GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (object);

  switch (prop_id)
    {
    case PROP_MENU:
      gtk_menu_tool_button_set_menu (button, g_value_get_object (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}

static void
gtk_menu_tool_button_get_property (GObject    *object,
                                   guint       prop_id,
                                   GValue     *value,
                                   GParamSpec *pspec)
{
  GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (object);

  switch (prop_id)
    {
    case PROP_MENU:
      g_value_set_object (value, button->priv->menu);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}

static void
gtk_menu_tool_button_class_init (GtkMenuToolButtonClass *klass)
{
  GObjectClass *object_class;
205
  GtkObjectClass *gtk_object_class;
206
  GtkWidgetClass *widget_class;
207 208 209
  GtkToolItemClass *toolitem_class;

  object_class = (GObjectClass *)klass;
210
  gtk_object_class = (GtkObjectClass *)klass;
211
  widget_class = (GtkWidgetClass *)klass;
212 213 214 215
  toolitem_class = (GtkToolItemClass *)klass;

  object_class->set_property = gtk_menu_tool_button_set_property;
  object_class->get_property = gtk_menu_tool_button_get_property;
216
  gtk_object_class->destroy = gtk_menu_tool_button_destroy;
217
  widget_class->state_changed = gtk_menu_tool_button_state_changed;
218 219
  toolitem_class->toolbar_reconfigured = gtk_menu_tool_button_toolbar_reconfigured;

Matthias Clasen's avatar
Matthias Clasen committed
220 221 222 223 224 225 226 227 228 229 230 231 232
  /**
   * GtkMenuToolButton::show-menu:
   * @button: the object on which the signal is emitted
   *
   * The ::show-menu signal is emitted before the menu is shown.
   *
   * It can be used to populate the menu on demand, using 
   * gtk_menu_tool_button_get_menu(). 

   * Note that even if you populate the menu dynamically in this way, 
   * you must set an empty menu on the #GtkMenuToolButton beforehand,
   * since the arrow is made insensitive if the menu is not set.
   */
233
  signals[SHOW_MENU] =
234
    g_signal_new (I_("show-menu"),
235
                  G_OBJECT_CLASS_TYPE (klass),
236 237 238 239 240
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (GtkMenuToolButtonClass, show_menu),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
241 242 243 244 245 246 247

  g_object_class_install_property (object_class,
                                   PROP_MENU,
                                   g_param_spec_object ("menu",
                                                        P_("Menu"),
                                                        P_("The dropdown menu"),
                                                        GTK_TYPE_MENU,
248
                                                        GTK_PARAM_READWRITE));
249 250 251 252 253 254 255 256 257 258 259

  g_type_class_add_private (object_class, sizeof (GtkMenuToolButtonPrivate));
}

static void
menu_position_func (GtkMenu           *menu,
                    int               *x,
                    int               *y,
                    gboolean          *push_in,
                    GtkMenuToolButton *button)
{
260
  GtkMenuToolButtonPrivate *priv = button->priv;
261
  GtkWidget *widget = GTK_WIDGET (button);
262 263 264 265
  GtkRequisition req;
  GtkRequisition menu_req;
  GtkOrientation orientation;
  GtkTextDirection direction;
266 267 268
  GdkRectangle monitor;
  gint monitor_num;
  GdkScreen *screen;
269 270 271 272

  gtk_widget_size_request (GTK_WIDGET (priv->menu), &menu_req);

  orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));
273 274 275 276 277 278 279
  direction = gtk_widget_get_direction (widget);

  screen = gtk_widget_get_screen (GTK_WIDGET (menu));
  monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
  if (monitor_num < 0)
    monitor_num = 0;
  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
280 281 282

  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    {
283 284
      gdk_window_get_origin (widget->window, x, y);
      *x += widget->allocation.x;
285
      *y += widget->allocation.y;
286

287
      if (direction == GTK_TEXT_DIR_LTR)
288 289 290 291 292 293 294 295 296 297
	*x += MAX (widget->allocation.width - menu_req.width, 0);
      else if (menu_req.width > widget->allocation.width)
        *x -= menu_req.width - widget->allocation.width;

      if ((*y + priv->arrow_button->allocation.height + menu_req.height) <= monitor.y + monitor.height)
	*y += priv->arrow_button->allocation.height;
      else if ((*y - menu_req.height) >= monitor.y)
	*y -= menu_req.height;
      else if (monitor.y + monitor.height - (*y + priv->arrow_button->allocation.height) > *y)
	*y += priv->arrow_button->allocation.height;
298
      else
299
	*y -= menu_req.height;
300 301 302
    }
  else 
    {
303 304 305
      gdk_window_get_origin (GTK_BUTTON (priv->arrow_button)->event_window, x, y);
      gtk_widget_size_request (priv->arrow_button, &req);

306 307 308 309
      if (direction == GTK_TEXT_DIR_LTR)
        *x += priv->arrow_button->allocation.width;
      else 
        *x -= menu_req.width;
310 311 312 313

      if (*y + menu_req.height > monitor.y + monitor.height &&
	  *y + priv->arrow_button->allocation.height - monitor.y > monitor.y + monitor.height - *y)
	*y += priv->arrow_button->allocation.height - menu_req.height;
314 315
    }

316
  *push_in = FALSE;
317 318 319 320 321 322
}

static void
popup_menu_under_arrow (GtkMenuToolButton *button,
                        GdkEventButton    *event)
{
323
  GtkMenuToolButtonPrivate *priv = button->priv;
324

325
  g_signal_emit (button, signals[SHOW_MENU], 0);
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340

  if (!priv->menu)
    return;

  gtk_menu_popup (priv->menu, NULL, NULL,
                  (GtkMenuPositionFunc) menu_position_func,
                  button,
                  event ? event->button : 0,
                  event ? event->time : gtk_get_current_event_time ());
}

static void
arrow_button_toggled_cb (GtkToggleButton   *togglebutton,
                         GtkMenuToolButton *button)
{
341
  GtkMenuToolButtonPrivate *priv = button->priv;
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360

  if (!priv->menu)
    return;

  if (gtk_toggle_button_get_active (togglebutton) &&
      !GTK_WIDGET_VISIBLE (priv->menu))
    {
      /* we get here only when the menu is activated by a key
       * press, so that we can select the first menu item */
      popup_menu_under_arrow (button, NULL);
      gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE);
    }
}

static gboolean
arrow_button_button_press_event_cb (GtkWidget         *widget,
                                    GdkEventButton    *event,
                                    GtkMenuToolButton *button)
{
361 362 363 364
  if (event->button == 1)
    {
      popup_menu_under_arrow (button, event);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
365

366 367 368 369 370 371
      return TRUE;
    }
  else
    {
      return FALSE;
    }
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
}

static void
gtk_menu_tool_button_init (GtkMenuToolButton *button)
{
  GtkWidget *box;
  GtkWidget *arrow;
  GtkWidget *arrow_button;
  GtkWidget *real_button;

  button->priv = GTK_MENU_TOOL_BUTTON_GET_PRIVATE (button);

  gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (button), FALSE);

  box = gtk_hbox_new (FALSE, 0);

  real_button = GTK_BIN (button)->child;
  g_object_ref (real_button);
  gtk_container_remove (GTK_CONTAINER (button), real_button);
  gtk_container_add (GTK_CONTAINER (box), real_button);
  g_object_unref (real_button);

  arrow_button = gtk_toggle_button_new ();
  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
  gtk_container_add (GTK_CONTAINER (arrow_button), arrow);
  gtk_box_pack_end (GTK_BOX (box), arrow_button,
                    FALSE, FALSE, 0);

  /* the arrow button is insentive until we set a menu */
  gtk_widget_set_sensitive (arrow_button, FALSE);

  gtk_widget_show_all (box);

  gtk_container_add (GTK_CONTAINER (button), box);

  button->priv->button = real_button;
  button->priv->arrow = arrow;
  button->priv->arrow_button = arrow_button;
  button->priv->box = box;

  g_signal_connect (arrow_button, "toggled",
413
		    G_CALLBACK (arrow_button_toggled_cb), button);
414
  g_signal_connect (arrow_button, "button-press-event",
415
		    G_CALLBACK (arrow_button_button_press_event_cb), button);
416 417 418
}

static void
419
gtk_menu_tool_button_destroy (GtkObject *object)
420 421 422 423 424 425
{
  GtkMenuToolButton *button;

  button = GTK_MENU_TOOL_BUTTON (object);

  if (button->priv->menu)
426 427 428 429
    {
      g_signal_handlers_disconnect_by_func (button->priv->menu, 
					    menu_deactivate_cb, 
					    button);
430
      gtk_menu_detach (button->priv->menu);
431 432 433 434 435 436 437 438

      g_signal_handlers_disconnect_by_func (button->priv->arrow_button,
					    arrow_button_toggled_cb, 
					    button);
      g_signal_handlers_disconnect_by_func (button->priv->arrow_button, 
					    arrow_button_button_press_event_cb, 
					    button);
    }
439 440

  GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy (object);
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
}

/**
 * gtk_menu_tool_button_new:
 * @icon_widget: a widget that will be used as icon widget, or %NULL
 * @label: a string that will be used as label, or %NULL
 *
 * Creates a new #GtkMenuToolButton using @icon_widget as icon and
 * @label as label.
 *
 * Return value: the new #GtkMenuToolButton
 *
 * Since: 2.6
 **/
GtkToolItem *
gtk_menu_tool_button_new (GtkWidget   *icon_widget,
                          const gchar *label)
{
  GtkMenuToolButton *button;

  button = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL);

  if (label)
    gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), label);

  if (icon_widget)
    gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (button), icon_widget);

  return GTK_TOOL_ITEM (button);
}

/**
 * gtk_menu_tool_button_new_from_stock:
 * @stock_id: the name of a stock item
 *
 * Creates a new #GtkMenuToolButton.
 * The new #GtkMenuToolButton will contain an icon and label from
 * the stock item indicated by @stock_id.
 *
 * Return value: the new #GtkMenuToolButton
 *
 * Since: 2.6
 **/
GtkToolItem *
gtk_menu_tool_button_new_from_stock (const gchar *stock_id)
{
  GtkMenuToolButton *button;

  g_return_val_if_fail (stock_id != NULL, NULL);

  button = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON,
492
			 "stock-id", stock_id,
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
			 NULL);

  return GTK_TOOL_ITEM (button);
}

/* Callback for the "deactivate" signal on the pop-up menu.
 * This is used so that we unset the state of the toggle button
 * when the pop-up menu disappears. 
 */
static int
menu_deactivate_cb (GtkMenuShell      *menu_shell,
		    GtkMenuToolButton *button)
{
  GtkMenuToolButtonPrivate *priv = button->priv;

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->arrow_button), FALSE);

  return TRUE;
}

513 514 515 516 517 518 519 520 521 522 523
static void
menu_detacher (GtkWidget *widget,
               GtkMenu   *menu)
{
  GtkMenuToolButtonPrivate *priv = GTK_MENU_TOOL_BUTTON (widget)->priv;

  g_return_if_fail (priv->menu == menu);

  priv->menu = NULL;
}

524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
/**
 * gtk_menu_tool_button_set_menu:
 * @button: a #GtkMenuToolButton
 * @menu: the #GtkMenu associated with #GtkMenuToolButton
 *
 * Sets the #GtkMenu that is popped up when the user clicks on the arrow.
 * If @menu is NULL, the arrow button becomes insensitive.
 *
 * Since: 2.6
 **/
void
gtk_menu_tool_button_set_menu (GtkMenuToolButton *button,
                               GtkWidget         *menu)
{
  GtkMenuToolButtonPrivate *priv;

  g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));
  g_return_if_fail (GTK_IS_MENU (menu) || menu == NULL);

  priv = button->priv;

  if (priv->menu != GTK_MENU (menu))
    {
547 548 549
      if (priv->menu && GTK_WIDGET_VISIBLE (priv->menu))
        gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));

550
      if (priv->menu)
551 552 553 554
	{
          g_signal_handlers_disconnect_by_func (priv->menu, 
						menu_deactivate_cb, 
						button);
555
	  gtk_menu_detach (priv->menu);
556
	}
557 558 559 560 561

      priv->menu = GTK_MENU (menu);

      if (priv->menu)
        {
562 563
          gtk_menu_attach_to_widget (priv->menu, GTK_WIDGET (button),
                                     menu_detacher);
564 565 566

          gtk_widget_set_sensitive (priv->arrow_button, TRUE);

567
          g_signal_connect (priv->menu, "deactivate",
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
                            G_CALLBACK (menu_deactivate_cb), button);
        }
      else
       gtk_widget_set_sensitive (priv->arrow_button, FALSE);
    }

  g_object_notify (G_OBJECT (button), "menu");
}

/**
 * gtk_menu_tool_button_get_menu:
 * @button: a #GtkMenuToolButton
 *
 * Gets the #GtkMenu associated with #GtkMenuToolButton.
 *
 * Return value: the #GtkMenu associated with #GtkMenuToolButton
 *
 * Since: 2.6
 **/
GtkWidget *
gtk_menu_tool_button_get_menu (GtkMenuToolButton *button)
{
  g_return_val_if_fail (GTK_IS_MENU_TOOL_BUTTON (button), NULL);

  return GTK_WIDGET (button->priv->menu);
}

/**
Matthias Clasen's avatar
Matthias Clasen committed
596
 * gtk_menu_tool_button_set_arrow_tooltip:
597 598 599 600 601 602 603 604 605 606
 * @button: a #GtkMenuToolButton
 * @tooltips: the #GtkTooltips object to be used
 * @tip_text: text to be used as tooltip text for tool_item
 * @tip_private: text to be used as private tooltip text
 *
 * Sets the #GtkTooltips object to be used for arrow button which
 * pops up the menu. See gtk_tool_item_set_tooltip() for setting
 * a tooltip on the whole #GtkMenuToolButton.
 *
 * Since: 2.6
607 608 609
 *
 * Deprecated: 2.12: Use gtk_menu_tool_button_set_arrow_tooltip_text()
 * instead.
610 611 612 613 614 615 616 617 618 619 620 621
 **/
void
gtk_menu_tool_button_set_arrow_tooltip (GtkMenuToolButton *button,
                                        GtkTooltips       *tooltips,
                                        const gchar       *tip_text,
                                        const gchar       *tip_private)
{
  g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));

  gtk_tooltips_set_tip (tooltips, button->priv->arrow_button, tip_text, tip_private);
}

622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
/**
 * gtk_menu_tool_button_set_arrow_tooltip_text:
 * @button: a #GtkMenuToolButton
 * @text: text to be used as tooltip text for button's arrow button
 *
 * Sets the tooltip text to be used as tooltip for the arrow button which
 * pops up the menu.  See gtk_tool_item_set_tooltip() for setting a tooltip
 * on the whole #GtkMenuToolButton.
 *
 * Since: 2.12
 **/
void
gtk_menu_tool_button_set_arrow_tooltip_text (GtkMenuToolButton *button,
					     const gchar       *text)
{
  g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));

  gtk_widget_set_tooltip_text (button->priv->arrow_button, text);
}

/**
 * gtk_menu_tool_button_set_arrow_tooltip_markup:
 * @button: a #GtkMenuToolButton
 * @markup: markup text to be used as tooltip text for button's arrow button
 *
 * Sets the tooltip markup text to be used as tooltip for the arrow button
 * which pops up the menu.  See gtk_tool_item_set_tooltip() for setting a
 * tooltip on the whole #GtkMenuToolButton.
 *
 * Since: 2.12
 **/
void
gtk_menu_tool_button_set_arrow_tooltip_markup (GtkMenuToolButton *button,
					       const gchar       *markup)
{
  g_return_if_fail (GTK_IS_MENU_TOOL_BUTTON (button));

  gtk_widget_set_tooltip_markup (button->priv->arrow_button, markup);
}

662 663
#define __GTK_MENU_TOOL_BUTTON_C__
#include "gtkaliasdef.c"