![](https://secure.gravatar.com/avatar/37a9f1974ecc0ee900e36d5c7e2bdf02.jpg?s=120&d=mm&r=g)
On Wed, 2004-07-07 at 13:33, bulia byak wrote:
this code works Gtk::Image *pImg= new Image ("/x/y/z/toto.png");
while this one don't Gtk::Image *pImg= new Image (Gdk::Pixbuf::create_from_file("/x/y/z/toto.png"));
Judging by
http://www.gtkmm.org/gtkmm2/docs/reference/html/classGtk_1_1Image.html,
both uses are valid. But we haven't yet used Gtkmm in this
project so
I can't tell. Mental, can you comment?
As far as I know both examples are valid (and should be essentially interchangable), but I've not tried either. There are occasionally some gotchas which the documentation does not make clear.
Aubi, does "doesn't work" mean that it doesn't compile, or that it misbehaves when run? What are the error messages or deviations from expected behavior you encounter?
-mental
The failure is at run time. As far as I remember (I doesn't have my machine right now), there is an assertion on the Pixbuf, something like could not bind pixbuf. And of course, nothing is displayed.
Talking about GTKmm doc, I was wondering if we could put it in a wiki, this way we could add comments as we gain experience.
I also have more general questions about gtkmm ification and widgettery. Do we try to redo custom widgets (ie inheriting from drawables) for the SPIcon and SPButton thingies, or do we provide static Images widgets with the according content (ie pixbuf) already loaded ? I would vote for the second solution as I remarked an important performance hit since we display SVG icons in eg the Fill dialog. The result would be something like class SVGIcons { public : const Gtk::Image & get (std::string name); private : static const Gtk::Image &icon1; static const Gtk::Image &icon2; static const Gtk::Image &icon3;
etc ...
}
************************ ADSL ILLIMITE TISCALI + TELEPHONE GRATUIT ************************ Surfez 40 fois plus vite pour 30EUR/mois seulement ! Et téléphonez partout en France gratuitement, vers les postes fixes (hors numéros spéciaux). Tarifs très avantageux vers les mobiles et l'international ! Pour profiter de cette offre exceptionnelle, cliquez ici : http://register.tiscali.fr/adsl (voir conditions sur le site)