iup_widget_child.e 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. deferred class IUP_WIDGET_CHILD
  2. -- Commands to handle the attributes related with the child.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. insert
  6. IUP_INTERFACE
  7. feature {ANY}
  8. -- Attributes to be used inside a container.
  9. set_cx (cx: INTEGER)
  10. -- X coordinate of the position to be used inside a IUP_CBOX container.
  11. require
  12. non_negative: cx >= 0
  13. do
  14. iup_open.set_attribute(Current, "CX", cx.to_string)
  15. end
  16. get_cx: INTEGER
  17. -- Return the x coordinate used inside a IUP_CBOX container.
  18. local
  19. cx: STRING
  20. do
  21. cx := iup_open.get_attribute(Current, "CX")
  22. Result := cx.to_integer
  23. end
  24. set_cy (cy: INTEGER)
  25. -- Y coordinate of the position to be used inside a IUP_CBOX container.
  26. require
  27. non_negative: cy >= 0
  28. do
  29. iup_open.set_attribute(Current, "CY", cy.to_string)
  30. end
  31. get_cy: INTEGER
  32. -- Return the y coordinate used inside a IUP_CBOX container.
  33. local
  34. cy: STRING
  35. do
  36. cy := iup_open.get_attribute(Current, "CY")
  37. Result := cy.to_integer
  38. end
  39. set_expand_weight (value: INTEGER)
  40. -- (non inheritable) (at children only): If a child defines the expand
  41. -- weight, then it is used to multiply the free space used for expansion.
  42. do
  43. iup_open.set_attribute(Current, "EXPANDWEIGHT", value.to_string)
  44. end
  45. get_expand_weight: INTEGER
  46. -- Return the value of expandweight.
  47. local
  48. str: STRING
  49. do
  50. str := iup_open.get_attribute(Current, "EXPANDWEIGHT")
  51. Result := str.to_integer
  52. end
  53. set_tab_title (value: STRING)
  54. -- (non inheritable) (at children only): Same as TABTITLEn in
  55. -- IUP_TABS but set in each child. Works only if set before the child is
  56. -- added to the tabs.
  57. do
  58. iup_open.set_attribute(Current, "TABTITLE", value)
  59. end
  60. get_tab_title: STRING
  61. -- Return the value of tabtitle.
  62. do
  63. Result := iup_open.get_attribute(Current, "TABTITLE")
  64. end
  65. set_tab_image (value: STRING)
  66. -- (non inheritable) (at children only): Same as TABIMAGEn in
  67. -- IUP_TABS but set in each child. Works only if set before the child is
  68. -- added to the tabs.
  69. do
  70. iup_open.set_attribute(Current, "TABIMAGE", value)
  71. end
  72. get_tab_image: STRING
  73. -- Return the value of tabimage.
  74. do
  75. Result := iup_open.get_attribute(Current, "TABIMAGE")
  76. end
  77. -- Commands to handle the hierarchy
  78. detach
  79. -- Detaches the interface element from its parent.
  80. do
  81. iup_open.iup_detach(Current)
  82. end
  83. get_parent: IUP_CONTAINER
  84. -- Return the parent of the element or void if does not have a parent.
  85. local
  86. pr: IUP_CONTAINER
  87. do
  88. if pr ?:= iup_open.iup_get_parent(Current) then
  89. Result ::= iup_open.iup_get_parent(Current)
  90. end
  91. end
  92. get_brother: IUP_WIDGET
  93. -- Return the next element in the parent where this element is
  94. -- placed or void if there is none.
  95. do
  96. Result := iup_open.iup_get_brother(Current)
  97. end
  98. get_dialog: IUP_DIALOG
  99. -- Returns the dialog that contains this interface element. Works
  100. -- also for children of a menu that is associated with a dialog.
  101. -- Returns: the dialog or void if not found.
  102. local
  103. wgt: IUP_WIDGET
  104. dlg: IUP_DIALOG
  105. do
  106. wgt := iup_open.iup_get_dialog(Current)
  107. if dlg ?:= wgt then
  108. dlg ::= wgt
  109. end
  110. Result := dlg
  111. end
  112. set_normalizer_group (name: STRING)
  113. -- (non inheritable): name of a normalizer element to which to
  114. -- automatically add the control. If an element with that name does not
  115. -- exists then one is created.
  116. do
  117. iup_open.set_attribute(Current, "NORMALIZERGROUP", name)
  118. end
  119. end
  120. -- The MIT License (MIT)
  121. -- Copyright (c) 2016, 2017, 2018 by German A. Arias
  122. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  123. -- of this software and associated documentation files (the "Software"), to deal
  124. -- in the Software without restriction, including without limitation the rights
  125. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  126. -- copies of the Software, and to permit persons to whom the Software is
  127. -- furnished to do so, subject to the following conditions:
  128. --
  129. -- The above copyright notice and this permission notice shall be included in
  130. -- all copies or substantial portions of the Software.
  131. --
  132. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  133. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  134. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  135. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  136. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  137. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  138. -- SOFTWARE.