Re: pixmap insert in clist object

From: Date: Thu, 14 Mar 2002 02:38:13 +0000
Subject: Re: pixmap insert in clist object
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1520@lists.php.net to get a copy of this message
you need to load the pixmaps after the window has displayed - its one of those strange windowing things about allocating colour.. $ctree->connect('realize', 'prepare_pixmaps' ); $ctree->connect_after('realize', 'load_a_node' );
      
function load_a_node($ctree) { global $_pixmap; /* loads icon_closed.xpm and icon_open.xpm */ $this->widget->insert_node( NULL, NULL, array("some text"), 5, $_pixmap['icon_closed']['pixmap'], $_pixmap['icon_closed']['mask'], $_pixmap['icon_open']['pixmap'], $_pixmap['icon_open']['mask'], false, false); } /* load all the xpms from a subdirectory of this called xpm */ function prepare_pixmaps($widget) { global $_pixmap;
        $i=0;
        $fp = opendir(dirname(__FILE__)."/xpm");
        while (($file = readdir($fp)) != FALSE) {
           if (ereg("\.xpm$", $file)) {
             $icons[$i] = ereg_replace("\.xpm$","",$file);
           $i++;
         }
       }
       closedir($fp);
              for ($i=0;$i<count($this->icons);$i++) {
          $xpm = $this->icons[$i];
          list($_pixmap[$xpm]['pixmap'], $pixmap[$xpm]['mask']) =
               Gdk::pixmap_create_from_xpm($widget->window, NULL, APPDIR .'xpm/' . $xpm . '.xpm');
       }
} } César González Revilla wrote:
Hello all, ¿Could anybody paste any little example about how can be an image be loaded as a part of an array to insert into a clist object?. Thanks a lot.


« previous php.gtk.general (#1520) next »