PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/gtk_check_menu_item.e

http://github.com/tybor/Liberty
Specman e | 292 lines | 120 code | 85 blank | 87 comment | 2 complexity | ac2c3171fe4e352f51a48f4dd52a25aa MD5 | raw file
  1indexing
  2	description: "GtkCheckMenuItem -- A menu item with a check box."
  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_CHECK_MENU_ITEM
 23	-- A GtkCheckMenuItem is a menu item that maintains the state of a
 24	-- boolean value in addition to a GtkMenuItem's usual role in
 25	-- activating application code.
 26
 27	-- A check box indicating the state of the boolean value is
 28	-- displayed at the left side of the GtkMenuItem. Activating the
 29	-- GtkMenuItem toggles the value.
 30	
 31inherit
 32	GTK_MENU_ITEM
 33		redefine
 34			make, with_label, with_mnemonic, struct_size
 35		end
 36	-- Known heirs: GtkRadioMenuItem
 37
 38	-- GtkCheckMenuItem implements AtkImplementorIface.
 39
 40	
 41creation make, with_label, with_mnemonic, from_external_pointer
 42
 43feature {} -- Creation
 44	make	is
 45			-- Creates a new GtkCheckMenuItem.
 46		do
 47			from_external_pointer (gtk_check_menu_item_new)
 48		end
 49
 50	with_label (a_label: STRING) is
 51			-- Creates a new GtkCheckMenuItem with `a_label'.
 52		do
 53			from_external_pointer (gtk_check_menu_item_new_with_label (a_label.to_external))
 54		end
 55
 56	with_mnemonic (a_label: STRING) is
 57			-- Creates a new GtkCheckMenuItem containing `a_label'. An
 58			-- underscore in the text of the button marks the mnemonic
 59			-- character.
 60		do
 61			from_external_pointer (gtk_check_menu_item_new_with_mnemonic (a_label.to_external))
 62		end
 63	
 64feature
 65	is_active: BOOLEAN is
 66			-- Is the check menu item active? See `set_active'
 67		do
 68			Result:=(gtk_check_menu_item_get_active (handle).to_boolean)
 69		end
 70
 71	set_active is
 72			-- Makes the menu item's check box active.
 73		do
 74			gtk_check_menu_item_set_active (handle,1)
 75		end
 76
 77	set_inactive is
 78			-- Makes the menu item's check box inactive.
 79		do
 80			gtk_check_menu_item_set_active (handle,0)
 81		end
 82
 83
 84	toggled is
 85			-- Emits the GtkCheckMenuItem::toggled signal.
 86		do
 87			gtk_check_menu_item_toggled (handle)
 88		end
 89
 90	is_inconsistent: BOOLEAN is
 91			-- Has Current been made inconsistent using `set_inconsistent'?
 92		do
 93			Result := (gtk_check_menu_item_get_inconsistent(handle).to_boolean)
 94		end
 95
 96	set_inconsistent is
 97			-- If the user has selected a range of elements (such as some
 98			-- text or spreadsheet cells) that are affected by a boolean
 99			-- setting, and the current values in that range are
100			-- inconsistent, you may want to display the check in an "in
101			-- between" state. This function turns on "in between"
102			-- display. Normally you would turn off the inconsistent
103			-- state again if the user explicitly selects a setting. This
104			-- has to be done manually, `set_inconsistent' only affects
105			-- visual appearance, it doesn't affect the semantics of the
106			-- widget.
107		do
108			gtk_check_menu_item_set_inconsistent (handle, 1)
109		end
110
111	-- ------------------------------------------------------------------------------------------------------------
112
113	-- gtk_check_menu_item_set_draw_as_radio ()
114
115	-- void gtk_check_menu_item_set_draw_as_radio
116	-- (GtkCheckMenuItem *check_menu_item,
117	-- gboolean draw_as_radio);
118
119	-- Sets whether check_menu_item is drawn like a GtkRadioMenuItem
120
121	-- check_menu_item : a GtkCheckMenuItem
122	-- draw_as_radio : whether check_menu_item is drawn like a GtkRadioMenuItem
123
124	-- Since 2.4
125
126	-- ------------------------------------------------------------------------------------------------------------
127
128	-- gtk_check_menu_item_get_draw_as_radio ()
129
130	-- gboolean gtk_check_menu_item_get_draw_as_radio
131	-- (GtkCheckMenuItem *check_menu_item);
132
133	-- Returns whether check_menu_item looks like a GtkRadioMenuItem
134
135	-- check_menu_item : a GtkCheckMenuItem
136	-- Returns : Whether check_menu_item looks like a GtkRadioMenuItem
137
138	-- Since 2.4
139
140
141	-- Properties
142
143
144	-- "active" gboolean : Read / Write
145	-- "draw-as-radio" gboolean : Read / Write
146	-- "inconsistent" gboolean : Read / Write
147
148	-- Style Properties
149
150
151	-- "indicator-size" gint : Read
152
153	-- Signals
154
155feature -- Signals
156
157	toggle_signal_name: STRING is "toggle"
158
159	on_toggle is
160			-- Built-in toggle signal handler; empty by design; redefine it.
161		do
162		end
163
164	enable_on_toggle is
165			-- Connects "toggle" signal to `on_toggle' feature.
166			-- Emitted when the item is toggled.
167		do
168			connect (Current, toggle_signal_name, $on_toggle)
169		end
170
171	connect_agent_to_toggle_signal (a_procedure: PROCEDURE [ANY, TUPLE[GTK_CHECK_MENU_ITEM]]) is
172		require
173			valid_procedure: a_procedure /= Void
174		local
175			toggle_callback: TOGGLED_CALLBACK [like Current]
176		do
177			create toggle_callback.make
178			toggle_callback.connect (Current, a_procedure)
179		end
180
181
182	-- "toggled" void user_function (GtkCheckMenuItem *checkmenuitem,
183	-- gpointer user_data) : Run first
184
185	-- Property Details
186
187	-- The "active" property
188
189	-- "active" gboolean : Read / Write
190
191	-- Whether the menu item is checked.
192
193	-- Default value: FALSE
194
195	-- ------------------------------------------------------------------------------------------------------------
196
197	-- The "draw-as-radio" property
198
199	-- "draw-as-radio" gboolean : Read / Write
200
201	-- Whether the menu item looks like a radio menu item.
202
203	-- Default value: FALSE
204
205	-- ------------------------------------------------------------------------------------------------------------
206
207	-- The "inconsistent" property
208
209	-- "inconsistent" gboolean : Read / Write
210
211	-- Whether to display an "inconsistent" state.
212
213	-- Default value: FALSE
214
215	-- Style Property Details
216
217	-- The "indicator-size" style property
218
219	-- "indicator-size" gint : Read
220
221	-- Size of check or radio indicator.
222
223	-- Allowed values: >= 0
224
225	-- Default value: 12
226
227	-- Signal Details
228
229	-- The "toggled" signal
230
231	-- void user_function (GtkCheckMenuItem *checkmenuitem,
232	-- gpointer user_data) : Run first
233
234	-- This signal is emitted when the state of the check box is changed.
235
236	-- A signal handler can examine the active field of the GtkCheckMenuItem-struct struct to discover the new
237	-- state.
238
239	-- checkmenuitem : the object which received the signal.
240	-- user_data : user data set when the signal handler was connected.
241feature -- size
242	struct_size: INTEGER is
243		external "C inline use <gtk/gtk.h>"
244		alias "sizeof(GtkCheckMenuItem)"
245		end
246
247feature {} -- External calls
248	
249	gtk_check_menu_item_new: POINTER is
250		external "C use <gtk/gtk.h>"
251		end
252	
253	gtk_check_menu_item_new_with_label (a_label: POINTER):POINTER is
254		external "C use <gtk/gtk.h>"
255		end
256	
257	gtk_check_menu_item_new_with_mnemonic (a_label: POINTER): POINTER is
258		external "C use <gtk/gtk.h>"
259		end
260	
261	gtk_check_menu_item_get_active (a_check_menu_item: POINTER): INTEGER is -- gboolean
262		external "C use <gtk/gtk.h>"
263		end
264	
265	gtk_check_menu_item_set_active (a_check_menu_item: POINTER; an_is_active: INTEGER) is
266		external "C use <gtk/gtk.h>"
267		end
268	
269	gtk_check_menu_item_set_show_toggle (a_gtkcheckmenuitem: POINTER; a_always: INTEGER) is
270		external "C use <gtk/gtk.h>"
271		end
272	
273	gtk_check_menu_item_toggled (a_check_menu_item: POINTER) is
274		external "C use <gtk/gtk.h>"
275		end
276	
277	gtk_check_menu_item_get_inconsistent (a_check_menu_item: POINTER): INTEGER is -- gboolean
278		external "C use <gtk/gtk.h>"
279		end
280	
281	gtk_check_menu_item_set_inconsistent (a_check_menu_item: POINTER; a_setting: INTEGER) is
282		external "C use <gtk/gtk.h>"
283		end
284	
285	gtk_check_menu_item_set_draw_as_radio (a_check_menu_item: POINTER; a_draw_as_radio: INTEGER) is
286		external "C use <gtk/gtk.h>"
287		end
288	
289	gtk_check_menu_item_get_draw_as_radio (a_check_menu_item: POINTER): INTEGER is 	-- gboolean
290		external "C use <gtk/gtk.h>"
291		end
292end