Problem with ToolBar in PHP-GTK2
| From: | Daniel Braga | Date: | Wed, 08 Jun 2005 16:28:15 +0000 |
| Subject: | Problem with ToolBar in PHP-GTK2 | ||
| References: | 1 2 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1373@lists.php.net to get a copy of this message | ||
/* translated from portuguese by Google */
I am trying to create a ToolBar in the Php-gtk2. Until I obtain, but instead of 4 buttons alone he appears 3. I place stock_ids of the buttons that I need in an Array and later I cover the Array generating the buttons and placing them in another Array. The problem is that the first button never is placed in the Array. I do not know if I am making some wrong thing.
Somebody can give one help?
[ ]'s
Daniel Braga
<?php
class ToolBar extends GtkToolBar
{
var $buttons_id = array('gtk-new', 'gtk-media-pause', 'gtk-refresh', 'gtk-quit');
var $buttons = array();
function __construct()
{
parent::__construct();
}
function load_buttons()
{
foreach ($this->buttons_id as $stock_id) {
$this->buttons[$stock_id] = GtkToolButton::new_from_stock($stock_id);
}
}
function add_buttons()
{
foreach ($this->buttons as $button) {
parent::add($button);
}
}
static function get_toolbar()
{
$tool = &new ToolBar();
$tool->load_buttons();
$tool->add_buttons();
return $tool;
}
}
$window = new GtkWindow();
$window->connect_object('destroy', array('gtk','main_quit'));
$toolbar = ToolBar::get_toolbar();
$window->add($toolbar);
$window->show_all();
Gtk::main();
?>