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)
On Thu, 2004-07-08 at 08:40, aubi@...373... wrote:
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.
Hmm, that sounds vaguely familiar. It could be a refcounting issue.
I will have to try it when I have time.
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.
As a matter of fact, SPButton and SPIcon were custom widgets before I rewrote them as subclasses of GtkToggleButton and GtkImage instead.
What I want to do now is to rework our icon code to use GtkIconFactory. That way, SVG images are only rendered once for each size (we can cache them in the factory), and we can more easily use standard Gtk image/icon facilities (whether via gtkmm or direct Gtk).
-mental
participants (2)
-
aubi@...373...
-
MenTaLguY