PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/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
  1indexing
  2	description: "GTK_IMAGE_MENU_ITEM."
  3	copyright: "[
  4					Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20				]"
 21
 22class GTK_IMAGE_MENU_ITEM
 23	-- A GtkImageMenuItem is a menu item which has an icon next to the
 24	-- text label. Note that the user can disable display of menu
 25	-- icons, so make sure to still fill in the text label.
 26
 27inherit GTK_MENU_ITEM redefine make, struct_size, with_mnemonic, with_label end
 28	--    GtkImageMenuItem implements AtkImplementorIface.
 29
 30creation make, from_stock, with_label, with_mnemonic, from_external_pointer
 31
 32feature {} -- Creation
 33	make is
 34			-- Creates a new GtkImageMenuItem with an empty label.
 35		do
 36			from_external_pointer (gtk_image_menu_item_new)
 37		end
 38
 39	from_stock (a_stock_item: STRING) is
 40			-- Creates a new GtkImageMenuItem containing the image and
 41			-- text from `a_stock_item'. Some stock ids have preprocessor
 42			-- macros like GTK_STOCK_OK and GTK_STOCK_APPLY (TODO:
 43			-- Eiffelize this description).
 44
 45			-- TODO: Provide support for accel group If you want this
 46			-- menu item to have changeable accelerators, then pass in
 47			-- NULL for accel_group. Next call
 48			-- gtk_menu_item_set_accel_path() with an appropriate path
 49			-- for the menu item, use gtk_stock_lookup() to look up the
 50			-- standard accelerator for the stock item, and if one is
 51			-- found, call gtk_accel_map_add_entry() to register it.
 52		require
 53			gtk_initialized: gtk.is_initialized
 54			stock_item_not_void: a_stock_item /= Void
 55		do
 56			from_external_pointer (gtk_image_menu_item_new_from_stock (a_stock_item.to_external, default_pointer))
 57			--  GtkWidget* gtk_image_menu_item_new_from_stock (const
 58			--  gchar *stock_id, -- GtkAccelGroup *accel_group);
 59		end
 60
 61	with_label (a_label: STRING) is
 62			-- Creates a new GtkImageMenuItem containing `a_label'.
 63		do
 64			handle:=gtk_image_menu_item_new_with_label (a_label.to_external)
 65			store_eiffel_wrapper
 66		end
 67
 68	with_mnemonic (a_label: STRING) is
 69			-- Creates a new GtkImageMenuItem containing a label. Put an
 70			-- underscore in front of the mnemonic character for the menu
 71			-- item.
 72		do
 73			handle:= gtk_image_menu_item_new_with_mnemonic(a_label.to_external)
 74			store_eiffel_wrapper
 75		end
 76
 77feature
 78	set_image (a_widget: GTK_WIDGET) is
 79			-- Sets the image of image menu item to `a_widget'. Note that
 80			-- it depends on the show-menu-images setting whether the
 81			-- image will be displayed or not.
 82		require widget_not_void: a_widget /= Void
 83		do
 84			gtk_image_menu_item_set_image (handle, a_widget.handle)
 85		end
 86
 87	image: GTK_WIDGET is
 88			-- The widget currently set as the image of
 89			-- image_menu_item. See `set_image'.
 90		local factory: G_OBJECT_EXPANDED_FACTORY [GTK_WIDGET]
 91		do
 92			Result := factory.wrapper_or_void (gtk_image_menu_item_get_image (handle))
 93		end
 94
 95feature -- size
 96	struct_size: INTEGER is
 97		external "C inline use <gtk/gtk.h>"
 98		alias "sizeof(GtkImageMenuItem)"
 99		end
100
101feature {} -- External calls
102	gtk_image_menu_item_set_image (an_image_menu_item,a_widget: POINTER) is
103		external "C use <gtk/gtk.h>"
104		end
105
106	gtk_image_menu_item_get_image (an_image_menu_item: POINTER): POINTER is -- GtkWidget*
107		external "C use <gtk/gtk.h>"
108		end
109	
110	gtk_image_menu_item_new: POINTER is -- GtkWidget*
111		external "C use <gtk/gtk.h>"
112		end
113
114	gtk_image_menu_item_new_from_stock (a_stock_id, an_accel_group: POINTER): POINTER is -- GtkWidget*
115		external "C use <gtk/gtk.h>"
116		end
117
118	gtk_image_menu_item_new_with_label (a_label: POINTER): POINTER is -- GtkWidget*
119		external "C use <gtk/gtk.h>"
120		end
121	gtk_image_menu_item_new_with_mnemonic (a_label: POINTER): POINTER is -- GtkWidget*
122		external "C use <gtk/gtk.h>"
123		end
124end