/src/wrappers/gtk/library/gtk_menu_tool_button.e
Specman e | 132 lines | 70 code | 22 blank | 40 comment | 2 complexity | c58b23c5df42ccda0f14cc5296ed755d MD5 | raw file
1indexing 2 description: "GtkMenuToolButton: A GtkToolItem containing a button with an additional dropdown menu." 3 copyright: "[ 4 Copyright (C) 2007 Paolo Redaelli, 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 hopeOA 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 22 wrapped_version: "2.10.6" 23 24class GTK_MENU_TOOL_BUTTON 25 -- A GtkMenuToolButton is a GtkToolItem that contains a button and 26 -- a small additional button with an arrow. When clicked, the arrow 27 -- button pops up a dropdown menu. 28 29 -- Use `from_label' to create a new GTK_MENU_TOOL_BUTTON. Use 30 -- `from_stock' to create a new GTK_MENU_TOOL_BUTTON a stock item. 31 32 -- Note: the previous paragraph is translated from C documentation 33 -- althought it is plainly unnecessary in an Eiffel class, since 34 -- there are creation clause. 35 36inherit 37 GTK_TOOL_BUTTON 38 redefine 39 from_label, 40 from_stock, 41 struct_size 42 end 43 -- GtkMenuToolButton implements AtkImplementorIface. 44 45insert 46 GTK_MENU_TOOL_BUTTON_EXTERNALS 47 GTK_MENU_EXTERNALS -- to access gtk_is_menu 48 49creation from_label, from_stock, from_external_pointer 50 51feature {} -- Creation 52 from_label (an_icon_widget: GTK_WIDGET; a_label: STRING) is 53 -- Creates a new GtkMenuToolButton using `an_icon_widget' as icon 54 -- and `a_label' as label. Both can be Void. 55 do 56 from_external_pointer(gtk_menu_tool_button_new 57 (null_or(an_icon_widget), 58 null_or_string(a_label))) 59 end 60 61 from_stock (a_stock_id: STRING) is 62 -- Creates a new GtkMenuToolButton. The new GtkMenuToolButton 63 -- will contain an icon and label from the stock item 64 -- indicated by `a_stock_id'. 65 do 66 from_external_pointer(gtk_menu_tool_button_new_from_stock 67 (a_stock_id.to_external)) 68 end 69 70feature 71 set_menu (a_menu: GTK_MENU) is 72 -- Sets the GtkMenu that is popped up when the user clicks on 73 -- the arrow. If `a_menu' is Void, the arrow button becomes 74 -- insensitive. 75 76 -- Note: in the original C implementation `a_menu' is a 77 -- GTK_WIDGET, while the documentation says it is a GtkMenu. 78 -- We consider valid the more defined type. 79 do 80 gtk_menu_tool_button_set_menu(handle,null_or(a_menu)) 81 ensure set: a_menu = menu 82 end 83 84 menu: GTK_MENU is 85 -- the GTK_MENU associated with GTK_MENU_TOOL_BUTTON. 86 local factory: G_OBJECT_EXPANDED_FACTORY[GTK_MENU] 87 do 88 Result := factory.wrapper (gtk_menu_tool_button_get_menu(handle)) 89 end 90 91 set_arrow_tooltip (some_tooltips: GTK_TOOLTIPS; a_tip_text, a_tip_private: STRING) is 92 -- Sets the GtkTooltips object to be used for arrow button 93 -- which pops up the menu. See GTK_TOOL_ITEM's `set_tooltip' 94 -- for setting a tooltip on the whole GtkMenuToolButton. 95 96 -- `some_tooltips': the GtkTooltips object to be used 97 98 -- `a_tip_text': text to be used as tooltip text for tool 99 -- item 100 101 -- `a_tip_private': text to be used as private tooltip text 102 require 103 tooltips_not_void: some_tooltips /= Void 104 tip_text_not_void: a_tip_text /= Void 105 tip_private_not_void: a_tip_private /= Void 106 do 107 gtk_menu_tool_button_set_arrow_tooltip 108 (handle, some_tooltips.handle, 109 a_tip_text.to_external, a_tip_private.to_external) 110 end 111 112feature --TODO: --Signals 113 114 -- "show-menu" void user_function (GtkMenuToolButton *menutoolbutton, 115 -- gpointer user_data) : Run first 116 --Signal Details 117 -- 118 -- The "show-menu" signal 119 -- 120 -- void user_function (GtkMenuToolButton *menutoolbutton, 121 -- gpointer user_data) : Run first 122 -- 123 -- menutoolbutton : the object which received the signal. 124 -- user_data : user data set when the signal handler was connected. 125 -- 126 127feature -- size 128 struct_size: INTEGER is 129 external "C inline use <gtk/gtk.h>" 130 alias "sizeof(GtkMenuToolButton)" 131 end 132end -- class GTK_MENU_TOOL_BUTTON