[gnomemm] CanvasImage



Title: CanvasImage

hello everybody,

does anyone know how to display an Image in a Gnome Canvas?
I tried it as follows:

I defined the class Cimage, instanced a Object of it and inserted it in a GTK::Hbox with pack_start(…). The result was the following Message at runtime:

Gtk-CRITICAL **: file gtkobject.c: line 939 (gtk_object_add_arg_type): assertion `arg_type > GTK_TYPE_NONE' failed.

GnomeUI-WARNING **: gnome_canvas_item_set(): could not find argument "image" in the `Gnome__CanvasImage' class ancestry


/* CODE */

#include <gnome--/canvas.h>
#include <gnome--/canvas-image.h>
#include <gnome--/imlib.h>
#include <string>
class CImage: public Gnome::Canvas {
public:
  CImage(string filename);
  ~CImage();
protected:

private:
  Gnome::CanvasImage *Image;
  Gdk_Imlib::Image Img;
  string FileName;
};

CImage::CImage(string filename):Gnome::Canvas()//, Img(filename)
{
  FileName = filename;
  Img.load(FileName);
  Image = new Gnome::CanvasImage(*root(), 1.0, 5.0, Img);
//  Image->set_anchor(GTK_ANCHOR_NW);
//  Image->set_image(Img);
}

CImage::~CImage()
{
  delete Image;
}




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