Show webpage using libgtkhtml c c ++

I want to display a very simple html page from the web using libgtkhtml. Can you give an example, please? Or some kind of documentation / resources? I did not find anything. (C is desirable, but C ++ is also acceptable). Thanks in advance.

+4
source share
4 answers

If you want to browse online content, you might be better off using gtkmozembed (Gecko) or WebkitGTK + (Webkit)

+2
source

Here is a (rather old) tutorial: http://primates.ximian.com/~rodo/programing_with_gtkhtml_tutorial/guadec.html

You also need to know that GtkHTML does not load from the Internet, so you need to use a different library to extract the HTML page itself and submit it to GtkHTML.

0
source

Why don't you adapt the test programs distributed with tarball?

0
source

Something like this should do it fast. Just put the info info widget in GtkScrolledWindow, for example.

#include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-stream.h> #define WRITE_HTML(html, args...) \ { gchar *ph; \ ph=g_markup_printf_escaped(html, ##args); \ gtk_html_write(GTK_HTML(info), s, ph, strlen(ph)); \ g_free(ph); } { GtkWidget *info; GtkHTMLStream *s; info=gtk_html_new(); gtk_html_set_editable(GTK_HTML(info), FALSE); gtk_html_allow_selection(GTK_HTML(info), TRUE); /* Optional, connect signals for link clicks, url load requests, etc */ #if 0 g_signal_connect(G_OBJECT(info), "link_clicked", G_CALLBACK(info_url_clicked_cb), NULL); g_signal_connect(G_OBJECT(info), "url_requested", G_CALLBACK(info_url_requested_cb), NULL); g_signal_connect(G_OBJECT(info), "title_changed", G_CALLBACK(info_title_cb), NULL); #endif s=gtk_html_begin(GTK_HTML(info)); WRITE_HTML("<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" \ "<head><title>Testing</title></head><body><h1>GtkHTML</h3><p>Example</p>"); WRITE_HTML("<p>Postal Code: %s</p>", some_random_data); WRITE_HTML("</body></html>"); gtk_html_end(GTK_HTML(info), s, GTK_HTML_STREAM_OK); } 
0
source

Source: https://habr.com/ru/post/1302678/


All Articles