链接按钮¶
显示指向资源的超链接的按钮。
GtkWidget *link = gtk_link_button_new ("https://developer.gnome.org.cn");
gtk_button_set_label (GTK_BUTTON (link), "Developer Documentation");
link = Gtk.LinkButton(uri="https://developer.gnome.org.cn",
label="Developer Documentation")
var link = new Gtk.LinkButton.with_label ("https://developer.gnome.org.cn",
"Developer Documentation");
const link = new Gtk.LinkButton({
uri: "https://developer.gnome.org.cn",
label: "Developer Documentation",
});
可以链接到操作系统中定义了处理程序的任何具有 URI 方案的资源;例如,此按钮将打开帮助浏览器
GtkWidget *help = gtk_link_button_new ("help:devhelp");
gtk_button_set_label (GTK_BUTTON (help), "Open the Devhelp documentation");
help = Gtk.LinkButton(uri="help:devhelp", label="Open the Devhelp documentation")
var help = new Gtk.LinkButton.with_label ("help:devhelp",
"Open the Devhelp documentation");
const help = new Gtk.LinkButton({
uri: "help:devhelp",
label: "Open the Devhelp documentation"
});
组件的常用方法¶
如果您想知道用户是否点击了按钮并访问了 URL,则可以使用
get_visited()方法。 如果您更改了链接按钮的 URL,则GtkLinkButton:visited属性将被重置。
API 参考¶
在示例中,我们使用了以下类