/src/wrappers/gtk/library/gtk_cell_renderer_toggle.e

http://github.com/tybor/Liberty · Specman e · 150 lines · 65 code · 32 blank · 53 comment · 2 complexity · e3a2f2a0892e8107e51e51c9224c1ff2 MD5 · raw file

  1. indexing
  2. description: "GtkCellRendererToggle Renders a toggle button in a cell."
  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. class GTK_CELL_RENDERER_TOGGLE
  19. -- GtkCellRendererToggle renders a toggle button in a cell. The
  20. -- button is drawn as a radio- or checkbutton, depending on the
  21. -- radio property. When activated, it emits the toggled signal.
  22. inherit
  23. GTK_CELL_RENDERER
  24. insert
  25. GTK_CELL_RENDERER_TOGGLE_EXTERNALS
  26. creation make, from_external_pointer
  27. feature {} -- size
  28. struct_size: INTEGER is
  29. external "C inline use <gtk/gtk.h>"
  30. alias "sizeof(GtkCellRenderer)"
  31. end
  32. feature {} -- Creation
  33. make is
  34. -- Creates a new GtkCellRendererToggle. Adjust rendering
  35. -- parameters using object properties. Object properties can
  36. -- be set globally (with G_OBJECT.set). Also, with
  37. -- GtkTreeViewColumn, you can bind a property to a value in a
  38. -- GtkTreeModel. For example, you can bind the "active"
  39. -- property on the cell renderer to a boolean value in the
  40. -- model, thus causing the check button to reflect the state
  41. -- of the model.
  42. do
  43. from_external_pointer (gtk_cell_renderer_toggle_new)
  44. end
  45. feature
  46. is_radio_toggle: BOOLEAN is
  47. -- Is Current cell rendering a radio toggle rather than a checkbox?
  48. do
  49. Result:=(gtk_cell_renderer_toggle_get_radio(handle).to_boolean)
  50. end
  51. set_radio is
  52. -- Makes the cell renderer to render a radio toggle (i.e. a
  53. -- toggle in a group of mutually-exclusive toggles). This can
  54. -- be set globally for the cell renderer, or changed just
  55. -- before rendering each cell in the model (for GtkTreeView,
  56. -- you set up a per-row setting using GtkTreeViewColumn to
  57. -- associate model columns with cell renderer properties).
  58. do
  59. gtk_cell_renderer_toggle_set_radio (handle,1)
  60. ensure set: is_radio_toggle
  61. end
  62. unset_radio is
  63. -- Makes the cell renderer to render a check toggle (a
  64. -- standalone boolean option). See also 'set_radio'.
  65. -- with cell renderer properties).
  66. do
  67. gtk_cell_renderer_toggle_set_radio (handle,0)
  68. ensure unset: not is_radio_toggle
  69. end
  70. feature -- State
  71. is_active: BOOLEAN is
  72. -- Is the cell renderer is active? See 'set_active'.
  73. do
  74. Result:=gtk_cell_renderer_toggle_get_active(handle).to_boolean
  75. end
  76. set_active is
  77. -- Activates a cell renderer.
  78. do
  79. gtk_cell_renderer_toggle_set_active (handle,1)
  80. ensure set: is_active
  81. end
  82. unset_active, set_inactive is
  83. -- Deactivates a cell renderer. Note TODO: this feature has
  84. -- a double name currently: 'unset_active' is more
  85. -- consistent and follow a common naming scheme while
  86. -- 'set_inactive' should be "easier" to read and understand.
  87. -- Paolo 2006-03-15.
  88. do
  89. gtk_cell_renderer_toggle_set_active (handle,0)
  90. ensure set: is_active
  91. end
  92. feature -- TODO: Property Details
  93. -- The "activatable" property
  94. -- "activatable" gboolean : Read / Write
  95. -- The toggle button can be activated.
  96. -- Default value: TRUE
  97. -- The "active" property
  98. -- "active" gboolean : Read / Write
  99. -- The toggle state of the button.
  100. -- Default value: FALSE
  101. -- The "inconsistent" property
  102. -- "inconsistent" gboolean : Read / Write
  103. -- The inconsistent state of the button.
  104. -- Default value: FALSE
  105. -- The "radio" property
  106. -- "radio" gboolean : Read / Write
  107. -- Draw the toggle button as a radio button.
  108. -- Default value: FALSE
  109. -- Signal Details
  110. -- The "toggled" signal
  111. -- void user_function (GtkCellRendererToggle *cell_renderer,
  112. -- gchar *path,
  113. -- gpointer user_data);
  114. -- The ::toggled signal is emitted when the cell is toggled.
  115. -- cell_renderer : the object which received the signal
  116. -- path : string representation of GtkTreePath describing the event location
  117. -- user_data : user data set when the signal handler was connected.
  118. end