Re: Converting signal code from RubyGTK to Gtkmm



 Hello,

I am new to gtkmm too, and i understand how you feel with documentation, but i am used to it now, its not so bad. My only reference is the API eg http://library.gnome.org/devel/gtkmm/unstable/namespaceGtk.html for Gtk.

I haven't done what you need to accomplish but i looked up Gtk::Image ( http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1Image.html ). There is no signal function, so you check up the parent classes. I thought of Gtk::Widget because it has very many "general" signals for widgets, and i found signal_expose_event ( http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1Widget.html#a9c49fed7d291d08f057bdb38ddeafab3 ).

About the dimensions i guess you can check Gtk::Image and Gdk::Pixbuf class references.

If you make yourself comfortable with the reference-style documentation you wont need help, unless you do some complicated things.

Danny.

On 07/10/2010 05:39 AM, Jason Grimes wrote:
Hi everyone,

Just a caveat before I continue, I'm new to C++ so I'm jumping in with both
feet by adding in Gtkmm.  :)  I have a Ruby application that uses GTK to
display an image being generated via OpenCL, so I created an expose_event
signal to handle the image update redraw.  I'm having all sorts of problems
finding good documentation/tutorials on Gtkmm signals or even documentation
on the gtk::image widget.  I'm also using Glade and builder to construct the
interface. Here is the Ruby code I'm using that I would like to convert to
Gtkmm:

$image.signal_connect('expose_event') do
     if $rgb == nil || $rgb.length != $iwidth*$iheight*3
         puts 'rgb buffer is null or wrong length'
     else
         Gdk::RGB.draw_rgb_image($image.window,
$image.style.fg_gc($image.state),
             0, 0, $iwidth, $iheight,
             Gdk::RGB::Dither::NORMAL, $rgb, $iwidth*3, 0, 0)
     end
end

$image is the image widget that is from the builder object.
$rgb is the 8-bit rgb image.
$iwidth and $iheight is the image dimensions.

Any help or links to some documentation would be great.  I thought that
RubyGTK documentation was bad, Gtkmm is so much worse. :(

Jason



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