RE: Re: Displaying simple HTML in gtkmm app (got it!)



Sorry for the late reply, but it seems as if the list email is not making it
to me.

	The compile line looks like this:

g++ -pipe -M `pkg-config gtkmm-2.0 --cflags` `pkg-config glib-2.0 --cflags`
`pkg-config libgtkhtml-2.0 --cflags` `pkg-config gnome-vfs-2.0 --cflags`
testgtkhtml.cpp -o testgtkhtml.o

	And the link line like this:

g++ testgtkhtml.o `pkg-config gtkmm-2.0 --libs` `pkg-config glib-2.0 --libs`
`pkg-config libgtkhtml-2.0 --libs` `pkg-config gnome-vfs-2.0 --libs`  -o
testgtkhtml

	The other thing that I noticed about this way of implementing this
is that you are limited to a single instance of a window that can render
HTML.  I was starting to create a C++ wrapper class, but found out that the
lines:

	g_signal_connect( G_OBJECT( document ), "request_url",	G_CALLBACK(
&gtkhtml::url_requested ),	NULL );
	g_signal_connect( G_OBJECT( document ), "link_clicked",	G_CALLBACK(
&gtkhtml::link_clicked ),		NULL );

	are proving to be difficult to resolve.  How would you connect gtk+
signals to a C++ class instance?  That appears to be the question now, for
me at least.

	Erik.

> -----Original Message-----
> From: Ohrnberger, Erik 
> Sent: Thursday, April 21, 2005 2:01 PM
> To: Ohrnberger, Erik
> Subject: Re: Displaying simple HTML in gtkmm app (got it!)
> 
> 
> On Friday 15 April 2005 09:46, [EMAIL PROTECTED] wrote:
> > OK, so I got it working now.  It's pretty much a hack job, 
> but it'll get me
> > by for now.
> 
> Erik,
> thks for the post - using gtkhtml will be really useful for 
> some of us.  I'm 
> trying to get this working in a small demo program but struggling:
> 1) which libs did you include when you compiled?
> 2) still not sure how you combined the simple c program under 
> gtkmm - could 
> you post the complete code listing (or email it).  thks
> 
> >
> > 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;
> > };
> >
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]