Re: How Do I get WM Decorations and Pixmaps to work [gtk1-perl]?



On Thursday, October 2, 2003, at 01:04 PM, Mauricio Silveira wrote:

An example showing a pixmap file (any from /usr/share/pixmaps) being loaded into a window or H/VBox.

create a Gtk::Pixmap, and set a Gtk::Gdk::Pixmap into it. Gtk::Pixmap is a widget that displays an image; you can then pack the Gtk::Pixmap anywhere you like.

  # load the XPM from a disk file.
  # assume that $widget is part of the window into which this
  # pixmap will be placed, so that it has the same visual
  # and depth.
  ($icon, $mask) = Gtk::Gdk::Pixmap->create_from_xpm
                            ($widget->window, undef, $filename);
  # now create a Gtk::Pixmap with that xpm...
  $pixmap = Gtk::Pixmap->new ($icon, $mask);
  $pixmap->show;
  # and put it in a window.
  $widget->add ($pixmap);


this is MUCH easier in gtk2-perl --- Gtk::Pixmap's replacement in gtk2-perl is Gtk2::Image, and Gtk::Gdk::Pixmap is for all intents and purposes replaced by Gtk2::Gdk::Pixbuf, which can be loaded from a file with a single function call.

  $image = Gtk2::Image->new_from_file ($filename);
  $image->show;
  $widget->add ($image);


I just can't figure out how to get these two tasks working. $window->set_decorations( "border" ) simply doesn't work,
complains about not being a Gdk object? How Come?

because a GtkWindow is not a GdkWindow --- it *contains* a GdkWindow. i think you want to do this:

$gtkwindow->window->set_decorations ('border');



 I'm not using Gtk2-Perl because these is no Reference such as Gtk1-perl's Gtk::reference or Gtk::object man-pages. Any hints?

personally i found Gtk::reference lacking --- it was only good if you already knew the C function to use and just needed to find the name of the perl method. it includes no actual text explaining the functions, and as such has extremely limited usefulness. that said, it was rather helpful to have for searching.

a file like Gtk::reference can be generated from the gtk2-perl source, but again, it will lack the helpful explanations that appear in the gtk+ API reference. we are very reluctant to write full documentation because of the duplication of effort that would be involved.

however, let me reiterate a standing invitation and call for help: we need documentation and documenters. this includes anyone who is willing to attempt to figure out how to autogenerate API reference documentation for the perl bindings.

--
muppet <scott at asofyet dot org>




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