/src/wrappers/gdk/library/gdk_color.e

http://github.com/tybor/Liberty · Specman e · 157 lines · 112 code · 27 blank · 18 comment · 0 complexity · 4a1f102c62d2fb25149428e90585ba1e MD5 · raw file

  1. indexing
  2. description: "The GdkColor structure is used to describe an allocated or unallocated color."
  3. copyright: "(C) 2006 Paolo Redaelli "
  4. license: "LGPL v2 or later"
  5. date: "$Date:$"
  6. revision: "$Revision:$"
  7. class GDK_COLOR
  8. inherit
  9. C_STRUCT
  10. redefine
  11. copy
  12. end
  13. creation
  14. from_external_pointer, make
  15. feature
  16. struct_size: INTEGER is
  17. external "C inline use <gdk/gdk.h>"
  18. alias "sizeof(GdkColor)"
  19. end
  20. make is
  21. do
  22. allocate
  23. end
  24. dispose is
  25. do
  26. gdk_color_free (handle)
  27. end
  28. copy (another: like Current) is
  29. do
  30. from_external_pointer(gdk_color_copy(handle))
  31. end
  32. feature -- Getters and setters
  33. is_allocated: BOOLEAN
  34. -- Not implemented, we still need GdkColormaps for this.
  35. -- Shall be set to True after a call to gdk_color_alloc()
  36. -- or gdk_colors_alloc()
  37. pixel: INTEGER is
  38. -- For allocated colors, the value used to draw this color on the
  39. -- screen.
  40. require
  41. is_allocated
  42. do
  43. Result := get_pixel_external (handle)
  44. ensure
  45. Result > 0
  46. end
  47. red: INTEGER is
  48. -- The red component of the color. This is a value between 0 and
  49. -- 65535, with 65535 indicating full intensitiy.
  50. do
  51. Result := get_red_external (handle)
  52. ensure
  53. Result.in_range (0, 65535)
  54. end
  55. green: INTEGER is
  56. -- The green component of the color.
  57. do
  58. Result := get_green_external (handle)
  59. ensure
  60. Result.in_range (0, 65535)
  61. end
  62. blue: INTEGER is
  63. -- The blue component of the color.
  64. do
  65. Result := get_blue_external (handle)
  66. ensure
  67. Result.in_range (0, 65535)
  68. end
  69. set_red (a_red: INTEGER) is
  70. require
  71. a_red.in_range (0, 65535)
  72. do
  73. set_red_external (handle, a_red)
  74. ensure
  75. red = a_red
  76. end
  77. set_green (a_green: INTEGER) is
  78. require
  79. a_green.in_range (0, 65535)
  80. do
  81. set_green_external (handle, a_green)
  82. ensure
  83. green = a_green
  84. end
  85. set_blue (a_blue: INTEGER) is
  86. require
  87. a_blue.in_range (0, 65535)
  88. do
  89. set_blue_external (handle, a_blue)
  90. ensure
  91. blue = a_blue
  92. end
  93. feature {} -- Low level access
  94. gdk_color_copy (a_color: POINTER): POINTER is
  95. -- GdkColor* gdk_color_copy (const GdkColor *color);
  96. external "C use <gdk/gdk.h>"
  97. end
  98. gdk_color_free (a_color: POINTER) is
  99. -- void gdk_color_free (GdkColor *color);
  100. external "C use <gdk/gdk.h>"
  101. end
  102. get_pixel_external (ptr: POINTER): INTEGER is
  103. -- Note: Result shall be NATURAL_32 since itr's a guint32
  104. external "C struct GdkColor get pixel use <gdk/gdk.h>"
  105. end
  106. get_red_external (ptr: POINTER): INTEGER is
  107. -- Note: Result shall be NATURAL_16 since itr's a guint16
  108. external "C struct GdkColor get red use <gdk/gdk.h>"
  109. end
  110. set_red_external (ptr: POINTER; a_red: INTEGER) is
  111. -- NOTE: a_red shall be a NATURAL_16 since it's a guint16
  112. external "C struct GdkColor set red use <gdk/gdk.h>"
  113. end
  114. get_green_external (ptr: POINTER): INTEGER is
  115. -- Note: Result shall be NATURAL_16 since itr's a guint16
  116. external "C struct GdkColor get green use <gdk/gdk.h>"
  117. end
  118. set_green_external (ptr: POINTER; a_green: INTEGER) is
  119. -- NOTE: a_ shall be a NATURAL_16 since it's a guint16
  120. external "C struct GdkColor set green use <gdk/gdk.h>"
  121. end
  122. get_blue_external (ptr: POINTER): INTEGER is
  123. -- Note: Result shall be NATURAL_16 since itr's a guint16
  124. external "C struct GdkColor get blue use <gdk/gdk.h>"
  125. end
  126. set_blue_external (ptr: POINTER; a_blue: INTEGER) is
  127. -- NOTE: a_blue shall be a NATURAL_16 since it's a guint16
  128. external "C struct GdkColor set blue use <gdk/gdk.h>"
  129. end
  130. end