Re: A custom cellrenderer for a bixbuf with text



On Friday, April 30, 2004, at 01:55 AM, Florian Schaefer wrote:

On Thu, 29 Apr 2004 20:23:52 -0400, muppet said:

i tried it -- a window pops up and immediately explodes, with the message

Huh, it didn't do that here (running XFree 4.3.0).

undoubtedly because your colormap and visual are the same as the X default. i am running on a linux server and displaying on a powerbook using Apple's X11, which always has something different going on. on linux, X runs at 32 bits with LSB byte order, but on Mac, it runs at 32 bits with MSB.


3) but even the two solutions mentioned above aren't the right thing to do. GtkWidget keeps a pointer to a GtkStyle, which has a bunch of GdkGCs in it, already configured for the current mode! you should be using those!

I would certainly have done this, if I would have know this. I suppose that I've again overseen it in the docs somewhere.

several examples do the same thing:
http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Gtk2/ examples/cellrenderer_popup.pl?rev=1.7&view=markup http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Gtk2/ examples/scribble.pl?rev=1.10&view=markup http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Gtk2/ examples/histogramplot.pl?rev=1.11&view=markup

what are graphics contexts?
  http://developer.gnome.org/doc/API/2.0/gdk/gdk-Graphics-Contexts.html
  http://developer.gnome.org/doc/GGAD/sec-gc.html

each widget has a style, and styles have colors and contexts:
  http://developer.gnome.org/doc/GGAD/sec-style.html
  http://developer.gnome.org/doc/API/2.0/gtk/GtkStyle.html




perldoc Gtk2::Pango::Layout lists

    (width, height) = $layout->get_pixel_size

(available since Gtk2 0.20)

Ouch, I tried $layout->get_size, but this call just returned numbers way too large.

they are in "thousandths of device units". you divide those numbers by PANGO_SCALE to get pixels. the reasons have to do with accuracy and speed and other things.

http://developer.gnome.org/doc/API/2.0/pango/pango-Glyph- Storage.html#PANGO-SCALE-CAPS


Thanks a lot for taking the time to help me.

no problem.  it's a great break from crying babies.

--
I don't have a drinking problem,
'cept when i can't get drink.
  -- Tom Waits




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