PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  1indexing
  2	description: "GtkLinkButton -- A buttons bound to a URL."
  3	copyright: "[
  4					Copyright (C) 2006 Paolo Redaelli, GTK+ team
  5					
  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					
 11					This library is distributed in the hopeOA that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20			]"
 21			
 22class GTK_LINK_BUTTON
 23	-- A GtkLinkButton is a GtkButton with a hyperlink, similar to the one used
 24	-- by web browsers, which triggers an action when clicked. It is useful to
 25	-- show quick links to resources.
 26
 27	-- A link button is created by calling either `make' or `make_with_label'. If
 28	-- using the former, the URI you pass to the constructor is used as a label
 29	-- for the widget.
 30
 31	-- The URI bound to a GtkLinkButton can be set specifically using `set_uri',
 32	-- and retrieved using `uri'.
 33
 34	-- GtkLinkButton offers a global hook, which is called when the used clicks
 35	-- on it: see `set_uri_hook'.
 36	
 37	-- GtkLinkButton was added in GTK+ 2.10.
 38
 39inherit
 40	GTK_BUTTON
 41		rename make as make_button end
 42		-- TODO: GtkLinkButton implements AtkImplementorIface.
 43	
 44creation make, from_external_pointer
 45
 46feature {} -- Creation
 47	make (an_uri: STRING) is
 48			-- Creates a new GtkLinkButton with the `an_uri' as its text.
 49		require
 50			uri_not_void: an_uri /= Void
 51			valid_uri: -- TODO:
 52		do
 53			from_external_pointer (gtk_link_button_new(gtk_link_button_new(an_uri.to_external)))
 54		end
 55	
 56	make_with_label (an_uri, a_label: STRING) is
 57			-- Creates a new GtkLinkButton containing `a_label' as the text of the 
 58			-- button pointing to `an_uri'.
 59		require
 60			uri_not_void: an_uri /= Void
 61			valid_uri: -- TODO:
 62			label_not_void: a_label /= Void
 63		do
 64			from_external_pointer (gtk_link_button_new_with_label (an_uri.to_external, a_label.to_external))
 65		end
 66	
 67feature
 68	uri: STRING is
 69			-- the URI of the link button.
 70		do
 71			-- The returned string is owned by the link button and should
 72			-- not be modified or freed.
 73			create {CONST_STRING} Result.from_external
 74			(gtk_link_button_get_uri (handle))
 75		ensure Result /= Void
 76		end
 77
 78	set_uri (an_uri: STRING) is
 79			-- Sets uri as the URI where the GtkLinkButton points.
 80		require
 81			uri_not_void: an_uri /= Void
 82		do
 83			gtk_link_button_set_uri(handle,an_uri.to_external)
 84		ensure set: uri.is_equal(an_uri)
 85		end
 86	
 87	-- GtkLinkButtonUriFunc ()
 88	
 89	-- void (*GtkLinkButtonUriFunc) (GtkLinkButton *button, const gchar *link,
 90	-- gpointer user_data);
 91
 92	-- The type of a function which is called when the GtkLinkButton is clicked.
 93	-- button : 	the GtkLinkButton which was clicked
 94	-- link : 	the URI to which the clicked GtkLinkButton points
 95	-- user_data :
 96	
 97	-- gtk_link_button_set_uri_hook ()
 98
 99	-- GtkLinkButtonUriFunc gtk_link_button_set_uri_hook (GtkLinkButtonUriFunc
100	-- func, gpointer data, GDestroyNotify destroy);
101
102-- 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.
103
104-- func : 	a function called each time a GtkLinkButton is clicked, or NULL
105-- data : 	user data to be passed to func, or NULL
106-- destroy : 	a GDestroyNotify that gets called when data is no longer needed, or NULL
107-- Returns : 	the previously set hook function.
108
109-- Since 2.10
110-- Property Details
111-- The "uri" property
112
113--   "uri"                  gchararray            : Read / Write
114
115-- The URI bound to this button.
116
117-- Default value: "http://www.gtk.org"
118-- Properties
119
120--   "uri"                  gchararray            : Read / Write
121
122
123feature {} -- External calls
124	gtk_link_button_new  (an_uri: POINTER): POINTER is
125			-- GtkWidget* gtk_link_button_new (const gchar *uri);
126		external "C use <gtk/gtk.h>"
127		end
128
129	 gtk_link_button_new_with_label (an_uri, a_label: POINTER): POINTER is
130			-- GtkWidget* gtk_link_button_new_with_label (const gchar
131			-- *uri, const gchar *label);
132		external "C use <gtk/gtk.h>"
133		end
134
135	
136	gtk_link_button_get_uri (a_link_button: POINTER): POINTER is
137			-- const gchar* gtk_link_button_get_uri (GtkLinkButton
138			-- *link_button);
139		external "C use <gtk/gtk.h>"
140		end
141
142	gtk_link_button_set_uri (a_link_button, an_uri: POINTER) is
143			-- void gtk_link_button_set_uri (GtkLinkButton *link_button,
144			-- const gchar *uri);
145		external "C use <gtk/gtk.h>"
146		end
147
148	-- void (*GtkLinkButtonUriFunc) (GtkLinkButton *button, const gchar
149	-- *link, gpointer user_data);
150	
151	gtk_link_button_set_uri_hook (a_func, some_data, a_destroy: POINTER): POINTER is
152			-- GtkLinkButtonUriFunc gtk_link_button_set_uri_hook
153			-- (GtkLinkButtonUriFunc func, gpointer data, GDestroyNotify
154			-- destroy);
155		external "C use <gtk/gtk.h>"
156		end
157end -- class GTK_LINK_BUTTON