/src/wrappers/gtk/library/gtk_radio_action.e

http://github.com/tybor/Liberty · Specman e · 144 lines · 64 code · 34 blank · 46 comment · 2 complexity · f866ff84bdafc6217e86df5270a12a1c MD5 · raw file

  1. indexing
  2. description: "GtkRadioAction — An action of which only one in a group can be active."
  3. copyright: "[
  4. Copyright (C) 2006 Paolo Redaelli, GTS 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. -- Description: A GtkRadioAction is similar to
  19. -- GtkRadioMenuItem. A number of radio actions can be linked
  20. -- together so that only one may be active at any one time.
  21. class GTK_RADIO_ACTION
  22. inherit
  23. GTK_TOGGLE_ACTION
  24. rename make as make_toggle
  25. redefine struct_size
  26. end
  27. creation make, from_external_pointer
  28. feature -- Creation
  29. make (a_name, a_label, a_tooltip, a_stock_id: STRING; a_value: INTEGER) is
  30. -- Creates a new GtkRadioAction object. To add the action to
  31. -- a GtkActionGroup and set the accelerator for the action,
  32. -- call `GTK_ACTION_GROUP.add_action_with_accel'.
  33. require gtk_initialized: gtk.is_initialized
  34. do
  35. from_external_pointer (gtk_radio_action_new (a_name.to_external, a_label.to_external,
  36. a_tooltip.to_external, a_stock_id.to_external, a_value))
  37. end
  38. feature
  39. group: G_SLIST [GTK_RADIO_ACTION] is
  40. -- the list representing the radio group for this
  41. -- object. Note that the returned list is only valid until
  42. -- the next change to the group.
  43. -- TODO: Eiffelize this example
  44. -- A common way to set up a group of radio group is the following:
  45. -- GSList *group = NULL;
  46. -- GtkRadioAction *action;
  47. -- while (/* more actions to add */) {
  48. -- action = gtk_radio_action_new (...);
  49. -- gtk_radio_action_set_group (action, group);
  50. -- group = gtk_radio_action_get_group (action);
  51. -- }
  52. do
  53. create {G_OBJECT_SLIST[GTK_RADIO_ACTION]} Result.from_external_pointer (gtk_radio_action_get_group(handle))
  54. end
  55. set_group (a_group: G_SLIST [GTK_RADIO_ACTION]) is
  56. -- Sets the radio group for the radio action object.
  57. do
  58. gtk_radio_action_set_group (handle,a_group.handle)
  59. end
  60. current_value: INTEGER is
  61. -- the value of the currently active member of the group to which action belongs.
  62. do
  63. Result := gtk_radio_action_get_current_value(handle)
  64. end
  65. feature -- Properties
  66. -- "group" GtkRadioAction : Write
  67. -- "value" gint : Read / Write
  68. -- Signals
  69. -- "changed" void user_function (GtkRadioAction *action,
  70. -- GtkRadioAction *current,
  71. -- gpointer user_data) : Run first / No recursion
  72. -- Property Details
  73. -- The "group" property
  74. -- "group" GtkRadioAction : Write
  75. -- Sets a new group for a radio action.
  76. -- Since 2.4
  77. -- The "value" property
  78. -- "value" gint : Read / Write
  79. -- The value is an arbitrary integer which can be used as a convenient way to determine which action in the group is currently active in an ::activate or ::changed signal handler. See gtk_radio_action_get_current_value() and GtkRadioActionEntry for convenient ways to get and set this property.
  80. -- Default value: 0
  81. -- Since 2.4
  82. -- Signal Details
  83. -- The "changed" signal
  84. -- void user_function (GtkRadioAction *action,
  85. -- GtkRadioAction *current,
  86. -- gpointer user_data) : Run first / No recursion
  87. -- The ::changed signal is emitted on every member of a radio group when the active member is changed. The signal gets emitted after the ::activate signals for the previous and current active members.
  88. -- action : the action on which the signal is emitted
  89. -- current : the member of actions group which has just been activated
  90. -- user_data : user data set when the signal handler was connected.
  91. -- Since 2.4
  92. feature -- size
  93. struct_size: INTEGER is
  94. external "C inline use <gtk/gtk.h>"
  95. alias "sizeof(GtkRadioAction)"
  96. end
  97. feature {} -- External calls
  98. gtk_radio_action_new (name_str,label_str,tooltip_str,stock_id_str: POINTER; a_value: INTEGER): POINTER is -- GtkRadioAction*
  99. external "C use <gtk/gtk.h>"
  100. end
  101. gtk_radio_action_get_group (an_action: POINTER): POINTER is -- GSList*
  102. external "C use <gtk/gtk.h>"
  103. end
  104. gtk_radio_action_set_group (an_action, gslist_group: POINTER) is
  105. external "C use <gtk/gtk.h>"
  106. end
  107. gtk_radio_action_get_current_value (an_action: POINTER): INTEGER is
  108. external "C use <gtk/gtk.h>"
  109. end
  110. end -- class GTK_RADIO_ACTION