iup_radio.e 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_attribute_handle 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 {}
  69. -- Internal
  70. int_radio (child: POINTER): POINTER
  71. external "plug_in"
  72. alias "{
  73. location: "${sys}/plugins"
  74. module_name: "iup"
  75. feature_name: "IupRadio"
  76. }"
  77. end
  78. end
  79. -- The MIT License (MIT)
  80. -- Copyright (c) 2016, 2017 by German A. Arias
  81. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  82. -- of this software and associated documentation files (the "Software"), to deal
  83. -- in the Software without restriction, including without limitation the rights
  84. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  85. -- copies of the Software, and to permit persons to whom the Software is
  86. -- furnished to do so, subject to the following conditions:
  87. --
  88. -- The above copyright notice and this permission notice shall be included in
  89. -- all copies or substantial portions of the Software.
  90. --
  91. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  92. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  93. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  94. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  95. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  96. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  97. -- SOFTWARE.