/src/wrappers/gtk/library/gtk_radio_tool_button.e

http://github.com/tybor/Liberty · Specman e · 150 lines · 92 code · 25 blank · 33 comment · 3 complexity · dced231e9dc4fca1afa7235f95009c6b MD5 · raw file

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