[Rock-dev] Subclassing a C++ widget from ruby, and registering the result as a Vizkit widget

Sylvain Joyeux sylvain.joyeux at dfki.de
Mon Apr 11 11:09:42 CEST 2011


Hello

I'd like to subclass the ImageView widget to create a RasterMapView 
widget -- which is basically converting a Gdal raster band into an image.

I'd like to do it in Ruby ... and register the result in vizkit.

As far as I understood, it boils down to get vizkit to return me the 
ImageView class (NOT an ImageView instance), i.e.


<code>
require 'vizkit'
image_view_klass = Vizkit.<I don't know what to put there>
class RasterMapView < image_view_klass
   [implement the view]
end

Vizkit::UILoader.register_ruby_widget "RasterMapView", 
RasterMapView.method(:new)
Vizkit::UILoader.register_widget_for "RasterMapView", Gdal::Band, :display
</code>

Can I do that ? And if I can, how ?

Sylvain


More information about the Rock-dev mailing list