/src/wrappers/gtk/library/gtk_menu_tool_button.e

http://github.com/tybor/Liberty · Specman e · 132 lines · 70 code · 22 blank · 40 comment · 2 complexity · c58b23c5df42ccda0f14cc5296ed755d MD5 · raw file

  1. indexing
  2. description: "GtkMenuToolButton: A GtkToolItem containing a button with an additional dropdown menu."
  3. copyright: "[
  4. Copyright (C) 2007 Paolo Redaelli, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hopeOA that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. wrapped_version: "2.10.6"
  19. class GTK_MENU_TOOL_BUTTON
  20. -- A GtkMenuToolButton is a GtkToolItem that contains a button and
  21. -- a small additional button with an arrow. When clicked, the arrow
  22. -- button pops up a dropdown menu.
  23. -- Use `from_label' to create a new GTK_MENU_TOOL_BUTTON. Use
  24. -- `from_stock' to create a new GTK_MENU_TOOL_BUTTON a stock item.
  25. -- Note: the previous paragraph is translated from C documentation
  26. -- althought it is plainly unnecessary in an Eiffel class, since
  27. -- there are creation clause.
  28. inherit
  29. GTK_TOOL_BUTTON
  30. redefine
  31. from_label,
  32. from_stock,
  33. struct_size
  34. end
  35. -- GtkMenuToolButton implements AtkImplementorIface.
  36. insert
  37. GTK_MENU_TOOL_BUTTON_EXTERNALS
  38. GTK_MENU_EXTERNALS -- to access gtk_is_menu
  39. creation from_label, from_stock, from_external_pointer
  40. feature {} -- Creation
  41. from_label (an_icon_widget: GTK_WIDGET; a_label: STRING) is
  42. -- Creates a new GtkMenuToolButton using `an_icon_widget' as icon
  43. -- and `a_label' as label. Both can be Void.
  44. do
  45. from_external_pointer(gtk_menu_tool_button_new
  46. (null_or(an_icon_widget),
  47. null_or_string(a_label)))
  48. end
  49. from_stock (a_stock_id: STRING) is
  50. -- Creates a new GtkMenuToolButton. The new GtkMenuToolButton
  51. -- will contain an icon and label from the stock item
  52. -- indicated by `a_stock_id'.
  53. do
  54. from_external_pointer(gtk_menu_tool_button_new_from_stock
  55. (a_stock_id.to_external))
  56. end
  57. feature
  58. set_menu (a_menu: GTK_MENU) is
  59. -- Sets the GtkMenu that is popped up when the user clicks on
  60. -- the arrow. If `a_menu' is Void, the arrow button becomes
  61. -- insensitive.
  62. -- Note: in the original C implementation `a_menu' is a
  63. -- GTK_WIDGET, while the documentation says it is a GtkMenu.
  64. -- We consider valid the more defined type.
  65. do
  66. gtk_menu_tool_button_set_menu(handle,null_or(a_menu))
  67. ensure set: a_menu = menu
  68. end
  69. menu: GTK_MENU is
  70. -- the GTK_MENU associated with GTK_MENU_TOOL_BUTTON.
  71. local factory: G_OBJECT_EXPANDED_FACTORY[GTK_MENU]
  72. do
  73. Result := factory.wrapper (gtk_menu_tool_button_get_menu(handle))
  74. end
  75. set_arrow_tooltip (some_tooltips: GTK_TOOLTIPS; a_tip_text, a_tip_private: STRING) is
  76. -- Sets the GtkTooltips object to be used for arrow button
  77. -- which pops up the menu. See GTK_TOOL_ITEM's `set_tooltip'
  78. -- for setting a tooltip on the whole GtkMenuToolButton.
  79. -- `some_tooltips': the GtkTooltips object to be used
  80. -- `a_tip_text': text to be used as tooltip text for tool
  81. -- item
  82. -- `a_tip_private': text to be used as private tooltip text
  83. require
  84. tooltips_not_void: some_tooltips /= Void
  85. tip_text_not_void: a_tip_text /= Void
  86. tip_private_not_void: a_tip_private /= Void
  87. do
  88. gtk_menu_tool_button_set_arrow_tooltip
  89. (handle, some_tooltips.handle,
  90. a_tip_text.to_external, a_tip_private.to_external)
  91. end
  92. feature --TODO: --Signals
  93. -- "show-menu" void user_function (GtkMenuToolButton *menutoolbutton,
  94. -- gpointer user_data) : Run first
  95. --Signal Details
  96. --
  97. -- The "show-menu" signal
  98. --
  99. -- void user_function (GtkMenuToolButton *menutoolbutton,
  100. -- gpointer user_data) : Run first
  101. --
  102. -- menutoolbutton : the object which received the signal.
  103. -- user_data : user data set when the signal handler was connected.
  104. --
  105. feature -- size
  106. struct_size: INTEGER is
  107. external "C inline use <gtk/gtk.h>"
  108. alias "sizeof(GtkMenuToolButton)"
  109. end
  110. end -- class GTK_MENU_TOOL_BUTTON