iup_flat_label.e 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. class IUP_FLAT_LABEL
  2. -- Creates an interface element that is a label, but it does not have native
  3. -- decorations. Its visual presentation can contain a text and/or an image.
  4. --
  5. -- It behaves just like an IUP_LABEL, but since it is not a native control it
  6. -- has more flexibility for additional options.
  7. --
  8. -- It inherits from IUP_CANVAS.
  9. --
  10. -- Notes:
  11. --
  12. -- The IUP_FLAT_LABEL can contain text and image simultaneously.
  13. --
  14. -- The natural size will be a combination of the size of the image and the
  15. -- title, if any, plus PADDING and SPACING (if both image and title are
  16. -- present).
  17. --
  18. -- The IUP_LABEL SEPARATOR attribute to configure a separator (horizontal or
  19. -- vertical lines) is not supported. ELLIPSIS, MARKUP and WORDWRAP IUP_LABEL
  20. -- attributes are also not supported. Mnemonics are not supported.
  21. inherit
  22. IUP_CANVAS
  23. redefine
  24. set_border
  25. end
  26. IUP_WIDGET_FGCOLOR
  27. IUP_WIDGET_SPACING
  28. IUP_WIDGET_TITLE
  29. IUP_WIDGET_PADDING
  30. IUP_WIDGET_FLAT_TEXT
  31. IUP_WIDGET_BACK_IMAGE_1
  32. IUP_WIDGET_FRONT_IMAGE_1
  33. IUP_WIDGET_IMAGE_1
  34. create {ANY}
  35. flat_label
  36. feature {ANY}
  37. flat_label (text: STRING)
  38. -- Create a new flat label with the provided text.
  39. local
  40. a_flat_label: POINTER
  41. do
  42. a_flat_label := int_flat_label (get_pointer(text.to_c))
  43. set_widget(a_flat_label)
  44. end
  45. -- Attributes
  46. set_border (state: BOOLEAN)
  47. -- (creation only): Shows a border around the canvas. Default: "False".
  48. do
  49. Precursor (state)
  50. end
  51. feature {NONE}
  52. -- Internals
  53. int_flat_label (text: POINTER): POINTER
  54. external
  55. "C inline use %"eiffel-iup.h%""
  56. alias
  57. "return IupFlatLabel ($text);"
  58. end
  59. end -- class IUP_FLAT_LABEL
  60. -- The MIT License (MIT)
  61. -- Copyright (c) 2018, 2019 by German A. Arias
  62. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  63. -- of this software and associated documentation files (the "Software"), to deal
  64. -- in the Software without restriction, including without limitation the rights
  65. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  66. -- copies of the Software, and to permit persons to whom the Software is
  67. -- furnished to do so, subject to the following conditions:
  68. --
  69. -- The above copyright notice and this permission notice shall be included in
  70. -- all copies or substantial portions of the Software.
  71. --
  72. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  73. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  74. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  75. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  76. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  77. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  78. -- SOFTWARE.