/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

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