RE: Re: Displaying simple HTML in gtkmm app (got it!)
- From: erik_ohrnberger dme net
- To: gtkmm-list gnome org
- Subject: RE: Re: Displaying simple HTML in gtkmm app (got it!)
- Date: Fri, 15 Apr 2005 11:46:05 -0400
OK, so I got it working now. It's pretty much a hack job, but it'll get me
by for now.
I've declared a class gtkhtml, which is a sub class of Gtk::ScrolledWindow.
In this code module, I just include the simple.c source code file like so:
extern "C"
{
# include "simple.c"
};
And make sure to either remove or commnet out the int main( int argc, char**
argv) code
Below is the class' CTOR:
gtkhtml::gtkhtml( void )
: ScrolledWindow()
{
// Set properties
g_object_set( G_OBJECT( gtk_html_context_get () ), "debug_painting",
FALSE, NULL);
// Create the document
document = html_document_new();
g_signal_connect( G_OBJECT( document ), "request_url", G_CALLBACK(
url_requested ), NULL );
g_signal_connect( G_OBJECT( document ), "link_clicked", G_CALLBACK(
link_clicked ), NULL );
// And the view
view = html_view_new();
html_view_set_document( HTML_VIEW( view ), document );
g_signal_connect( G_OBJECT( view ), "request_object", G_CALLBACK(
request_object ), NULL );
// ScrolledWindow that's hosting is already created.
// Now wrap and add the Gtkhtml widget to the ScrolledWindow
Gtk::Widget* GtkmmView = Glib::wrap( view );
add( *GtkmmView );
GtkmmView->show();
}
And finally, is the LoadFile method, where you can load a file from local
disk and display it in the ScrolledWindow.
void gtkhtml::LoadFile( char* Filename )
{
load_file( Filename );
}
The only other thing is that I had to hack the
/usr/include/gtkhtml-2.0/libgtkhtml/css/cssstylesheet.h header file, 'cause
the structure below had a field called 'class', which g++ didn't like, so I
renamed it '_class':
struct _CssTail {
CssTailType type;
union {
struct {
HtmlAtom att;
CssAttrMatch match;
CssAttrVal val;
} attr_sel;
struct {
HtmlAtom id;
} id_sel;
struct {
HtmlAtom _class;
} class_sel;
struct {
HtmlAtom name;
} pseudo_sel;
} t;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]