/src/wrappers/gtk/library/gtk_radio_tool_button.e
Specman e | 150 lines | 92 code | 25 blank | 33 comment | 3 complexity | dced231e9dc4fca1afa7235f95009c6b MD5 | raw file
1indexing 2 description: "GtkRadioToolButton -- A toolbar item that contains a radio button." 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 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 22 wrapped_version: "2.10.6" 23 24class GTK_RADIO_TOOL_BUTTON 25 -- A GtkRadioToolButton is a GtkToolItem that contains a radio 26 -- button, that is, a button that is part of a group of toggle 27 -- buttons where only one button can be active at a time. 28 29inherit 30 GTK_TOGGLE_TOOL_BUTTON 31 rename from_stock as toggle_from_stock 32 redefine struct_size 33 end 34 -- GtkRadioToolButton implements AtkImplementorIface. 35 36creation 37 from_group, from_stock, from_widget, from_external_pointer 38 39feature {} -- Creation 40 41 from_group (a_group: G_SLIST[GTK_RADIO_TOOL_BUTTON]) is 42 -- Creates a new GtkRadioToolButton, adding it to `a_group'. 43 -- If it is Void a new group is created. 44 45 -- TODO: this behaviour may be inconsistent with 46 -- GTK_RADIO_BUTTON. Check which is better suited to real 47 -- use. 48 do 49 from_external_pointer(gtk_radio_tool_button_new (null_or(a_group))) 50 end 51 52 from_stock (a_group: G_SLIST[GTK_RADIO_TOOL_BUTTON]; a_stock_id: STRING) is 53 -- Creates a new GtkRadioToolButton, adding it to 54 -- `a_group'. The new GtkRadioToolButton will contain an icon 55 -- and label `a_stock_id'. If `a_group' is Void, a new group 56 -- is created; `a_stock_id' is the name of a stock item 57 require 58 id_not_void: a_stock_id /= Void 59 valid_stock_id: -- TODO It is an error if stock_id is not a name of a stock item. 60 do 61 from_external_pointer(gtk_radio_tool_button_new_from_stock 62 (null_or(a_group), a_stock_id.to_external)) 63 end 64 65 from_widget (a_radio: GTK_RADIO_TOOL_BUTTON) is 66 -- Creates a new GtkRadioToolButton adding it to the same 67 -- group of `a_radio'. 68 require radio_not_void: a_radio /= Void 69 do 70 from_external_pointer(gtk_radio_tool_button_new_from_widget(a_radio.handle)) 71 end 72 73 from_widget_with_stock (a_radio: GTK_RADIO_TOOL_BUTTON; a_stock_id: STRING) is 74 -- Creates a new GtkRadioToolButton adding it to the same 75 -- group of `a_radio'. The new GtkRadioToolButton will 76 -- contain an icon and label from `a_stock_id'. 77 require 78 radio_not_void: a_radio /= Void 79 id_not_void: a_stock_id /= Void 80 valid_stock_id: -- TODO It is an error if stock_id is not a name of a stock item. 81 do 82 from_external_pointer(gtk_radio_tool_button_new_with_stock_from_widget 83 (a_radio.handle, a_stock_id.to_external)) 84 end 85 86feature 87 group: G_SLIST[GTK_RADIO_TOOL_BUTTON] is 88 -- the radio button group button belongs to. 89 90 -- Note: this feature is re-computed every time it is accessed. 91 local ptr: POINTER 92 do 93 ptr:=gtk_radio_tool_button_get_group (handle) 94 if ptr.is_not_null then 95 create {G_OBJECT_SLIST[GTK_RADIO_TOOL_BUTTON]} Result.from_external_pointer(ptr) 96 end 97 end 98 99 set_group (a_group: G_SLIST[GTK_RADIO_TOOL_BUTTON]) is 100 -- Adds button to `a_group', removing it from the group it 101 -- belonged to before. 102 do 103 gtk_radio_tool_button_set_group (handle, a_group.handle) 104 ensure set: a_group = group 105 end 106 107 -- Note: "group" property is already handled by strongly-typed 108 -- "group" and "set_group" features. 109 110feature {} -- External calls 111 112 gtk_radio_tool_button_new (a_group: POINTER): POINTER is 113 -- GtkToolItem* gtk_radio_tool_button_new (GSList *group); 114 external "C use <gtk/gtk.h>" 115 end 116 117 gtk_radio_tool_button_new_from_stock (a_group, a_stock_id: POINTER): POINTER is 118 -- GtkToolItem* gtk_radio_tool_button_new_from_stock (GSList 119 -- *group, const gchar *stock_id); 120 external "C use <gtk/gtk.h>" 121 end 122 123 gtk_radio_tool_button_new_from_widget (a_group: POINTER): POINTER is 124 -- GtkToolItem* gtk_radio_tool_button_new_from_widget 125 -- (GtkRadioToolButton *group); 126 external "C use <gtk/gtk.h>" 127 end 128 129 gtk_radio_tool_button_new_with_stock_from_widget (a_group, a_stock_id: POINTER): POINTER is 130 -- GtkToolItem* gtk_radio_tool_button_new_with_stock_from_widget (GtkRadioToolButton *group, const gchar *stock_id); 131 external "C use <gtk/gtk.h>" 132 end 133 134 gtk_radio_tool_button_get_group (a_button: POINTER): POINTER is 135 -- GSList* gtk_radio_tool_button_get_group (GtkRadioToolButton *button); 136 external "C use <gtk/gtk.h>" 137 end 138 139 gtk_radio_tool_button_set_group (a_button, a_group: POINTER) is 140 -- void gtk_radio_tool_button_set_group (GtkRadioToolButton 141 -- *button, GSList *group); 142 external "C use <gtk/gtk.h>" 143 end 144 145feature -- size 146 struct_size: INTEGER is 147 external "C inline use <gtk/gtk.h>" 148 alias "sizeof(GtkRadioToolButton)" 149 end 150end -- class GTK_RADIO_TOOL_BUTTON