/src/wrappers/gtk/library/gtk_toggle_tool_button.e

http://github.com/tybor/Liberty · Specman e · 97 lines · 64 code · 20 blank · 13 comment · 2 complexity · 72a830e7c03a5e534df9893af9d9e62d MD5 · raw file

  1. indexing
  2. description: "GtkToggleToolButton - A GtkToolItem containing a toggle button."
  3. copyright: "[
  4. Copyright (C) 2006 Soluciones Informaticas Libres S.A.,
  5. eiffel-libraries team, GTK+ team
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public License
  8. as published by the Free Software Foundation; either version 2.1 of
  9. the License, or (at your option) any later version.
  10. This library is distributed in the hopeOA that it will be useful, but
  11. WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. 02110-1301 USA
  18. ]"
  19. class GTK_TOGGLE_TOOL_BUTTON
  20. inherit
  21. GTK_TOOL_BUTTON
  22. redefine
  23. make,
  24. from_stock
  25. end
  26. insert
  27. GTK_TOGGLE_TOOL_BUTTON_EXTERNALS
  28. create
  29. from_external_pointer, make
  30. feature {} -- Creation
  31. make is
  32. do
  33. from_external_pointer (gtk_toggle_tool_button_new)
  34. end
  35. from_stock (a_stock_id: STRING) is
  36. do
  37. from_external_pointer(gtk_toggle_tool_button_new_from_stock (a_stock_id.to_external))
  38. end
  39. feature -- Operations
  40. set_active (is_active: BOOLEAN) is
  41. -- Sets the status of the toggle tool button.
  42. -- Set to TRUE if you want the GtkToggleButton to be
  43. -- 'pressed in', and FALSE to raise it.
  44. -- This action causes the toggled signal to be emitted.
  45. do
  46. gtk_toggle_tool_button_set_active (handle, is_active.to_integer)
  47. end
  48. active: BOOLEAN is
  49. -- Queries a GtkToggleToolButton and returns its current state.
  50. -- Returns TRUE if the toggle button is pressed in
  51. -- and FALSE if it is raised.
  52. do
  53. Result := gtk_toggle_tool_button_get_active (handle).to_boolean
  54. end
  55. feature -- The "toggled" signal
  56. toggled_signal_name: STRING is "toggled"
  57. --void user_function (GtkToggleToolButton *toggle_tool_button,
  58. -- gpointer user_data);
  59. on_toggled is
  60. -- Built-in toggled signal handler; empty by design; redefine it.
  61. do
  62. end
  63. enable_on_toggled is
  64. -- Connects "toggled" signal to `on_toggled' feature.
  65. -- Emitted whenever the toggle tool button changes state..
  66. do
  67. connect (Current, toggled_signal_name, $on_toggled)
  68. end
  69. connect_agent_to_toggled_signal (a_procedure: PROCEDURE [ANY, TUPLE[GTK_TOGGLE_TOOL_BUTTON]]) is
  70. -- togglebutton : the object which received the signal.
  71. require valid_procedure: a_procedure /= Void
  72. local toggled_callback: TOGGLED_CALLBACK [like Current]
  73. do
  74. create toggled_callback.make
  75. toggled_callback.connect (Current, a_procedure)
  76. end
  77. end -- class GTK_TOGGLE_TOOL_BUTTON