On 9/6/06, Lance Dillon <[EMAIL PROTECTED]> wrote: > The easiest and quickest way I can think of is create a TextView, add some > TextAnchors, define some LinkButtons, and anchor the LinkButtons to the > TextAnchors. > Thanks, without your help I never catch this feature of GtkTextView, but there is some minor thing, what about "LinkButton", I don't find such component, I have to write it? I used GtkButton, but it is appered above the other text, and I can not find method to make text in it it "blue" and underlined, here is code:
#include <cstdlib> #include <gtk/gtk.h> static void on_link(GtkButton *button, gpointer user_data) { g_debug("on_link\n"); } int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GtkWidget *topLevelWindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(topLevelWindow), "delete_event", G_CALLBACK(gtk_false), NULL); g_signal_connect(G_OBJECT(topLevelWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); GtkTextView *tv = GTK_TEXT_VIEW(gtk_text_view_new()); gtk_container_add(GTK_CONTAINER(topLevelWindow), GTK_WIDGET(tv)); GtkButton *bt = GTK_BUTTON(gtk_button_new_with_label("link")); gtk_button_set_relief(bt, GTK_RELIEF_NONE); g_signal_connect(G_OBJECT(bt), "clicked", G_CALLBACK(on_link), NULL); GtkTextBuffer *buffer = gtk_text_view_get_buffer(tv); GtkTextIter iter; gtk_text_buffer_get_iter_at_offset( buffer, &iter, 0 ); gtk_text_buffer_insert(buffer, &iter, "aaa ", -1); GtkTextChildAnchor *anchor = gtk_text_buffer_create_child_anchor(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, "\nbbb", -1); gtk_text_view_set_editable(tv, FALSE); gtk_text_view_add_child_at_anchor(tv, GTK_WIDGET(bt), anchor); gtk_widget_show_all(topLevelWindow); gtk_main(); return EXIT_SUCCESS; } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list