iup_radio.e 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. class IUP_RADIO
  2. -- Creates a void container for grouping mutual exclusive toggles. Only one
  3. -- of its descendent toggles will be active at a time. The toggles can be at
  4. -- any composition.
  5. --
  6. -- It does not have a native representation.
  7. inherit
  8. IUP_CONTAINER
  9. IUP_WIDGET_EXPAND
  10. IUP_WIDGET_WID
  11. IUP_WIDGET_FONT
  12. IUP_WIDGET_CLIENTSIZE
  13. IUP_WIDGET_CLIENTOFFSET
  14. IUP_WIDGET_POSITION
  15. IUP_WIDGET_MAXMIN_SIZE
  16. IUP_WIDGET_VISIBLE
  17. IUP_WIDGET_CHILD
  18. IUP_WIDGET_NAME
  19. IUP_WIDGET_CUSTOM_ATTRIBUTES
  20. create {ANY}
  21. radio_empty,
  22. radio
  23. feature {ANY}
  24. radio_empty
  25. -- Create an empty radio
  26. local
  27. p, a_radio: POINTER
  28. do
  29. a_radio := int_radio (p)
  30. set_widget(a_radio)
  31. end
  32. radio (child: IUP_WIDGET)
  33. -- Create a new radio containing the widget.
  34. local
  35. a_radio: POINTER
  36. do
  37. a_radio := int_radio (child.widget)
  38. set_widget(a_radio)
  39. end
  40. -- Attributes
  41. set_value (name: STRING)
  42. -- (non inheritable): The visible child accessed by its name. The value
  43. -- passed must be the name of one of the children contained in the zbox.
  44. -- Use set_widget_name to associate a child to a name. When the
  45. -- value is changed the selected child is made visible and all other
  46. -- children are made invisible, regardless their previous visible state.
  47. do
  48. iup_open.set_attribute(Current, "VALUE", name)
  49. end
  50. get_value: STRING
  51. -- Return the name of the visible child.
  52. do
  53. Result := iup_open.get_attribute(Current, "VALUE")
  54. end
  55. set_value_widget (wgt: IUP_WIDGET)
  56. -- (non inheritable): The visible child accessed by its handle. The
  57. -- value passed must be the handle of a child contained in the zbox.
  58. -- When the zbox is created, the first element inserted is set as the
  59. -- visible child.
  60. do
  61. iup_open.set_attribute_widget(Current, "VALUE_HANDLE", wgt)
  62. end
  63. get_value_widget: IUP_WIDGET
  64. -- Return the IUP_WIDGET that is visible.
  65. do
  66. Result := iup_open.get_attribute_widget(Current, "VALUE_HANDLE")
  67. end
  68. feature {NONE}
  69. -- Internal
  70. int_radio (child: POINTER): POINTER
  71. external
  72. "C inline use %"eiffel-iup.h%""
  73. alias
  74. "return IupRadio ($child);"
  75. end
  76. end
  77. -- The MIT License (MIT)
  78. -- Copyright (c) 2016, 2017, 2019 by German A. Arias
  79. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  80. -- of this software and associated documentation files (the "Software"), to deal
  81. -- in the Software without restriction, including without limitation the rights
  82. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  83. -- copies of the Software, and to permit persons to whom the Software is
  84. -- furnished to do so, subject to the following conditions:
  85. --
  86. -- The above copyright notice and this permission notice shall be included in
  87. -- all copies or substantial portions of the Software.
  88. --
  89. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  90. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  91. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  92. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  93. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  94. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  95. -- SOFTWARE.