/src/wrappers/gtk/library/gtk_cell_renderer_progress.e

http://github.com/tybor/Liberty · Specman e · 90 lines · 62 code · 15 blank · 13 comment · 2 complexity · 0e790e4f2c0ce4f9467cc4b6285d4509 MD5 · raw file

  1. indexing
  2. description: "GtkCellRendererProgress — Renders numbers as progress bars."
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. date: "$Date:$"
  19. revision: "$Revision:$"
  20. class GTK_CELL_RENDERER_PROGRESS
  21. inherit GTK_CELL_RENDERER
  22. creation make, from_external_pointer
  23. feature {} -- size
  24. struct_size: INTEGER is
  25. external "C inline use <gtk/gtk.h>"
  26. alias "sizeof(GtkCellRendererProgress)"
  27. end
  28. feature {} -- Creation
  29. make is
  30. -- Creates a new GtkCellRendererProgress.
  31. do
  32. from_external_pointer (gtk_cell_renderer_progress_new)
  33. end
  34. feature -- Properties
  35. -- "text" gchararray : Read / Write
  36. -- "value" gint : Read / Write
  37. -- Property Details
  38. feature -- The "text" property
  39. text: STRING is
  40. -- The "text" property determines the label which will be
  41. -- drawn over the progress bar. Setting this property to Void
  42. -- causes the default label to be displayed. Setting this
  43. -- property to an empty string causes no label to be
  44. -- displayed.
  45. do
  46. Result:= get_string_property(text_property_name)
  47. end
  48. set_text (a_text: STRING) is
  49. -- Set text property
  50. -- TODO: provide a more direct implementation. Currently there is a temporary G_VALUE object
  51. require valid_text: a_text /= Void
  52. do
  53. set_property (text_property_name, create {G_VALUE}.from_string(a_text))
  54. end
  55. feature -- The "value" property
  56. value: INTEGER is
  57. -- The "value" property determines the percentage to which
  58. -- the progress bar will be "filled in".
  59. do
  60. Result:=integer_property(value_property_name)
  61. ensure in_range: Result.in_range(0,100)
  62. end
  63. set_value (a_value: INTEGER) is
  64. require in_range: a_value.in_range(0,100)
  65. do
  66. set_integer_property(value_property_name,a_value)
  67. end
  68. feature {} -- Properties names
  69. text_property_name: STRING is "text"
  70. value_property_name: STRING is "value"
  71. feature {} -- External calls
  72. gtk_cell_renderer_progress_new: POINTER is
  73. external "C use <gtk/gtk.h>"
  74. end
  75. end