/src/wrappers/gtk/library/gtk_image_menu_item.e

http://github.com/tybor/Liberty · Specman e · 124 lines · 78 code · 19 blank · 27 comment · 2 complexity · 780e9a62bb06a3a5a2433aa4300c3189 MD5 · raw file

  1. indexing
  2. description: "GTK_IMAGE_MENU_ITEM."
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, 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 hope 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. class GTK_IMAGE_MENU_ITEM
  19. -- A GtkImageMenuItem is a menu item which has an icon next to the
  20. -- text label. Note that the user can disable display of menu
  21. -- icons, so make sure to still fill in the text label.
  22. inherit GTK_MENU_ITEM redefine make, struct_size, with_mnemonic, with_label end
  23. -- GtkImageMenuItem implements AtkImplementorIface.
  24. creation make, from_stock, with_label, with_mnemonic, from_external_pointer
  25. feature {} -- Creation
  26. make is
  27. -- Creates a new GtkImageMenuItem with an empty label.
  28. do
  29. from_external_pointer (gtk_image_menu_item_new)
  30. end
  31. from_stock (a_stock_item: STRING) is
  32. -- Creates a new GtkImageMenuItem containing the image and
  33. -- text from `a_stock_item'. Some stock ids have preprocessor
  34. -- macros like GTK_STOCK_OK and GTK_STOCK_APPLY (TODO:
  35. -- Eiffelize this description).
  36. -- TODO: Provide support for accel group If you want this
  37. -- menu item to have changeable accelerators, then pass in
  38. -- NULL for accel_group. Next call
  39. -- gtk_menu_item_set_accel_path() with an appropriate path
  40. -- for the menu item, use gtk_stock_lookup() to look up the
  41. -- standard accelerator for the stock item, and if one is
  42. -- found, call gtk_accel_map_add_entry() to register it.
  43. require
  44. gtk_initialized: gtk.is_initialized
  45. stock_item_not_void: a_stock_item /= Void
  46. do
  47. from_external_pointer (gtk_image_menu_item_new_from_stock (a_stock_item.to_external, default_pointer))
  48. -- GtkWidget* gtk_image_menu_item_new_from_stock (const
  49. -- gchar *stock_id, -- GtkAccelGroup *accel_group);
  50. end
  51. with_label (a_label: STRING) is
  52. -- Creates a new GtkImageMenuItem containing `a_label'.
  53. do
  54. handle:=gtk_image_menu_item_new_with_label (a_label.to_external)
  55. store_eiffel_wrapper
  56. end
  57. with_mnemonic (a_label: STRING) is
  58. -- Creates a new GtkImageMenuItem containing a label. Put an
  59. -- underscore in front of the mnemonic character for the menu
  60. -- item.
  61. do
  62. handle:= gtk_image_menu_item_new_with_mnemonic(a_label.to_external)
  63. store_eiffel_wrapper
  64. end
  65. feature
  66. set_image (a_widget: GTK_WIDGET) is
  67. -- Sets the image of image menu item to `a_widget'. Note that
  68. -- it depends on the show-menu-images setting whether the
  69. -- image will be displayed or not.
  70. require widget_not_void: a_widget /= Void
  71. do
  72. gtk_image_menu_item_set_image (handle, a_widget.handle)
  73. end
  74. image: GTK_WIDGET is
  75. -- The widget currently set as the image of
  76. -- image_menu_item. See `set_image'.
  77. local factory: G_OBJECT_EXPANDED_FACTORY [GTK_WIDGET]
  78. do
  79. Result := factory.wrapper_or_void (gtk_image_menu_item_get_image (handle))
  80. end
  81. feature -- size
  82. struct_size: INTEGER is
  83. external "C inline use <gtk/gtk.h>"
  84. alias "sizeof(GtkImageMenuItem)"
  85. end
  86. feature {} -- External calls
  87. gtk_image_menu_item_set_image (an_image_menu_item,a_widget: POINTER) is
  88. external "C use <gtk/gtk.h>"
  89. end
  90. gtk_image_menu_item_get_image (an_image_menu_item: POINTER): POINTER is -- GtkWidget*
  91. external "C use <gtk/gtk.h>"
  92. end
  93. gtk_image_menu_item_new: POINTER is -- GtkWidget*
  94. external "C use <gtk/gtk.h>"
  95. end
  96. gtk_image_menu_item_new_from_stock (a_stock_id, an_accel_group: POINTER): POINTER is -- GtkWidget*
  97. external "C use <gtk/gtk.h>"
  98. end
  99. gtk_image_menu_item_new_with_label (a_label: POINTER): POINTER is -- GtkWidget*
  100. external "C use <gtk/gtk.h>"
  101. end
  102. gtk_image_menu_item_new_with_mnemonic (a_label: POINTER): POINTER is -- GtkWidget*
  103. external "C use <gtk/gtk.h>"
  104. end
  105. end