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

2005-04-25 Thread Erik Ohrnberger
Chris,
I've since found out that embedded mozilla is a far easier solution to
displaying HTML content, images, etc., than the gtkhtml library (Thanks
Murray).

So this issue is moot at present.

Thanks for your response anyway.

Erik.

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Chris Vine
 Sent: Saturday, April 23, 2005 8:38 PM
 To: gtkmm-list@gnome.org
 Cc: [EMAIL PROTECTED]
 Subject: Re: Displaying simple HTML in gtkmm app (got it!)
 
 
 On Thursday 21 April 2005 19:06, [EMAIL PROTECTED] wrote:
 
 [snip]
 
   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.
 
 I am not sure I have understood the question but if relates 
 to making the 
 callback aware of the class instance invoking the callback 
 (say the one in 
 whose constructor the call to g_signal_connect() was made) 
 then pass the 
 address of that instance (the this pointer) as the data 
 argument, which is 
 the last argument and is of type void*, thus:
 
   g_signal_connect( G_OBJECT( document ), request_url,
 G_CALLBACK(gtkhtml::url_requested ), this );
 
 then gtkhtml::url_requested() would use static_cast() to 
 cast its last 
 argument back to a pointer of the relevant type.
 
 gtkhtml::url_requested() should have extern C linkage (and 
 made a friend if 
 it needs to have access to the class internals), but it looks 
 as if it is a 
 static class member function, which cannot have C linkage.  
 Using a static 
 member function will work with some compilers (eg g++) but 
 not with others - 
 it is implementation dependent.
 
 Chris.
 
 -- 
 Summer is y-cumen in, lhude sing, cuccu!
 Groweth sed and bloweth med, springeth the wude nu. 
 ___
 gtkmm-list mailing list
 gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
 

___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


problems with Glib::locale_from_utf8

2005-04-25 Thread Aaron Walker
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Greetings,

I'm using libxml++ (which uses glibmm) to parse some XML, but am getting aborts
every time my parser class calls it's on_characters callback and tries to
display a word with a utf8 character.

#6  0xb7e2d298 in Glib::ConvertError::throw_func (gobject=0x805f908)
at convert.cc:305
#7  0xb7e38fe4 in Glib::Error::throw_exception (gobject=0x805f908)
at error.cc:174
#8  0xb7e2ca7f in Glib::locale_from_utf8 ([EMAIL PROTECTED])
at convert.cc:192
#9  0xb7e49b9f in Glib::operator ([EMAIL PROTECTED], [EMAIL PROTECTED])
at ustring.cc:1202
#10 0x0804999e in XMLParser::on_characters (this=0xb120, [EMAIL PROTECTED])
at test.cc:32

Looks like locale_from_utf8 throws an exception if g_locale_from_utf8 returns
an error (specifically G_CONVERT_ERROR_ILLEGAL_SEQUENCE).  I thought maybe my
utf8 setup was borked but I've got several other folks with supposedly working
utf8 setups who were able to reproduce.  This is probably more of a gtk-list
question but I figured I'd ask here first.

Anyone have an idea why this would be happening?

Thanks
- --
Kent's Heuristic:
Look for it first where you'd most like to find it.

Aaron Walker [EMAIL PROTECTED]
[ BSD | cron | forensics | shell-tools | commonbox | netmon | vim | web-apps ]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCbQXWC3poscuANHARAuNGAKCP8fQfVYB2QGlWxeYviR/wm8xHMQCfQnK9
r62Hah3WcbisPKlPCWrCLgA=
=20ng
-END PGP SIGNATURE-
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: new_from_stock

2005-04-25 Thread Emre Turkay
Hi Folks,

   I've realized that glade handles this situation well. So I put a
   button with a label in glade and let it generate C code for me. It
   seems that it is using the button with an HBox (maybe this is a
   workaround for the problem), i.e. it is adding an image and a label
   separately. It is also using alignment, however I don't need it. So my
   code now looks like this, and works as intended. Sending list for the
   people having the same problem:

   class New_Button: public Gtk::ToggleButton {
 public:
   New_Button(const Glib::ustring text)
 : Gtk::ToggleButton(),
   img_(Gtk::StockID(gtk-add),
Gtk::IconSize(Gtk::ICON_SIZE_BUTTON)),
   lbl_(text)
   {
 setup_box();
   }

 protected:
   void setup_box()
   {
 img_.show();
 lbl_.show();
 box_.pack_start(img_);
 box_.pack_Start(lbl_);
 box_.show();
 this-add(box_);
   }
 
 private:
   Gtk::Image img_;
   Gtk::Label lbl_;
   Gtk::HBox box_;
   };

Thanks for your helps,

  emre

On Sun, Apr 24, 2005 at 03:19:15PM +0200, Murray Cumming wrote:
 On Sat, 2005-04-23 at 12:57 -0500, Emre Turkay wrote:
  Hi Folks,
  
 In the gtkmm documentation for Gtk::Image (and therefore in some .h
 files distributed with gtkmm) the method Gtk::Image::new_from_stock()
 is referred, however I couldn't find where it is defined (i.e., I
 'grep'ed the /usr/include/gtkmm-2.0 directory and couldn't find it.)
  
 What may be wrong?
 
 The documenation is partly automatically generated from the C API's
 documentation, and this new part (in 2.6) was not correctly transformed.
 I've fixed it now.
 
 -- 
 Murray Cumming
 [EMAIL PROTECTED]
 www.murrayc.com
 www.openismus.com
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: problems with Glib::locale_from_utf8

2005-04-25 Thread Murray Cumming
On Mon, 2005-04-25 at 10:59 -0400, Aaron Walker wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Greetings,
 
 I'm using libxml++ (which uses glibmm) to parse some XML, but am getting 
 aborts
 every time my parser class calls it's on_characters callback and tries to
 display a word with a utf8 character.

Do you have the latest libxml++? We fixed a UTF8 bytes/characters
confusion recently.

-- 
Murray Cumming
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


rgb number scheme

2005-04-25 Thread John Taber
gtkmm uses the gdk color  r_g_b numbering scheme that goes from 0-65535 
instead of the more normal 0-255.  Can anyone explain what the 65535 is based 
on.   I'm guess we have to divide all our color numbers and use 
set_rgb_p(...) - I'm wondering why there isn't a set_rgb method for using the 
normal 0-255 range.  
___
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list