/src/wrappers/gtk/library/gtk_link_button.e

http://github.com/tybor/Liberty · Specman e · 157 lines · 69 code · 34 blank · 54 comment · 2 complexity · 0f14d46e2d084d10c163fa82df006530 MD5 · raw file

  1. indexing
  2. description: "GtkLinkButton -- A buttons bound to a URL."
  3. copyright: "[
  4. Copyright (C) 2006 Paolo Redaelli, 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 hopeOA 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_LINK_BUTTON
  19. -- A GtkLinkButton is a GtkButton with a hyperlink, similar to the one used
  20. -- by web browsers, which triggers an action when clicked. It is useful to
  21. -- show quick links to resources.
  22. -- A link button is created by calling either `make' or `make_with_label'. If
  23. -- using the former, the URI you pass to the constructor is used as a label
  24. -- for the widget.
  25. -- The URI bound to a GtkLinkButton can be set specifically using `set_uri',
  26. -- and retrieved using `uri'.
  27. -- GtkLinkButton offers a global hook, which is called when the used clicks
  28. -- on it: see `set_uri_hook'.
  29. -- GtkLinkButton was added in GTK+ 2.10.
  30. inherit
  31. GTK_BUTTON
  32. rename make as make_button end
  33. -- TODO: GtkLinkButton implements AtkImplementorIface.
  34. creation make, from_external_pointer
  35. feature {} -- Creation
  36. make (an_uri: STRING) is
  37. -- Creates a new GtkLinkButton with the `an_uri' as its text.
  38. require
  39. uri_not_void: an_uri /= Void
  40. valid_uri: -- TODO:
  41. do
  42. from_external_pointer (gtk_link_button_new(gtk_link_button_new(an_uri.to_external)))
  43. end
  44. make_with_label (an_uri, a_label: STRING) is
  45. -- Creates a new GtkLinkButton containing `a_label' as the text of the
  46. -- button pointing to `an_uri'.
  47. require
  48. uri_not_void: an_uri /= Void
  49. valid_uri: -- TODO:
  50. label_not_void: a_label /= Void
  51. do
  52. from_external_pointer (gtk_link_button_new_with_label (an_uri.to_external, a_label.to_external))
  53. end
  54. feature
  55. uri: STRING is
  56. -- the URI of the link button.
  57. do
  58. -- The returned string is owned by the link button and should
  59. -- not be modified or freed.
  60. create {CONST_STRING} Result.from_external
  61. (gtk_link_button_get_uri (handle))
  62. ensure Result /= Void
  63. end
  64. set_uri (an_uri: STRING) is
  65. -- Sets uri as the URI where the GtkLinkButton points.
  66. require
  67. uri_not_void: an_uri /= Void
  68. do
  69. gtk_link_button_set_uri(handle,an_uri.to_external)
  70. ensure set: uri.is_equal(an_uri)
  71. end
  72. -- GtkLinkButtonUriFunc ()
  73. -- void (*GtkLinkButtonUriFunc) (GtkLinkButton *button, const gchar *link,
  74. -- gpointer user_data);
  75. -- The type of a function which is called when the GtkLinkButton is clicked.
  76. -- button : the GtkLinkButton which was clicked
  77. -- link : the URI to which the clicked GtkLinkButton points
  78. -- user_data :
  79. -- gtk_link_button_set_uri_hook ()
  80. -- GtkLinkButtonUriFunc gtk_link_button_set_uri_hook (GtkLinkButtonUriFunc
  81. -- func, gpointer data, GDestroyNotify destroy);
  82. -- Sets func as the function that should be invoked every time a user clicks a GtkLinkButton. This function is called before every callback registered for the "clicked" signal.
  83. -- func : a function called each time a GtkLinkButton is clicked, or NULL
  84. -- data : user data to be passed to func, or NULL
  85. -- destroy : a GDestroyNotify that gets called when data is no longer needed, or NULL
  86. -- Returns : the previously set hook function.
  87. -- Since 2.10
  88. -- Property Details
  89. -- The "uri" property
  90. -- "uri" gchararray : Read / Write
  91. -- The URI bound to this button.
  92. -- Default value: "http://www.gtk.org"
  93. -- Properties
  94. -- "uri" gchararray : Read / Write
  95. feature {} -- External calls
  96. gtk_link_button_new (an_uri: POINTER): POINTER is
  97. -- GtkWidget* gtk_link_button_new (const gchar *uri);
  98. external "C use <gtk/gtk.h>"
  99. end
  100. gtk_link_button_new_with_label (an_uri, a_label: POINTER): POINTER is
  101. -- GtkWidget* gtk_link_button_new_with_label (const gchar
  102. -- *uri, const gchar *label);
  103. external "C use <gtk/gtk.h>"
  104. end
  105. gtk_link_button_get_uri (a_link_button: POINTER): POINTER is
  106. -- const gchar* gtk_link_button_get_uri (GtkLinkButton
  107. -- *link_button);
  108. external "C use <gtk/gtk.h>"
  109. end
  110. gtk_link_button_set_uri (a_link_button, an_uri: POINTER) is
  111. -- void gtk_link_button_set_uri (GtkLinkButton *link_button,
  112. -- const gchar *uri);
  113. external "C use <gtk/gtk.h>"
  114. end
  115. -- void (*GtkLinkButtonUriFunc) (GtkLinkButton *button, const gchar
  116. -- *link, gpointer user_data);
  117. gtk_link_button_set_uri_hook (a_func, some_data, a_destroy: POINTER): POINTER is
  118. -- GtkLinkButtonUriFunc gtk_link_button_set_uri_hook
  119. -- (GtkLinkButtonUriFunc func, gpointer data, GDestroyNotify
  120. -- destroy);
  121. external "C use <gtk/gtk.h>"
  122. end
  123. end -- class GTK_LINK_BUTTON