Menu Problem
| From: | Francisco barrio | Date: | Wed, 02 Mar 2005 22:34:04 +0000 |
| Subject: | Menu Problem | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5567@lists.php.net to get a copy of this message | ||
Hi Folks.. i have a problem and im really lost. :(
after i create a menu.. i cannot add nothing down (like a frame or anything)
BTW it only works with the php_gtk from cweiske.de (it happends with other php too) any thoughts ?
Thanks in advice.
Francisco
here its the code:
<?php
dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));
Class PictureButton extends GtkButton {
function PictureButton ($text, $image_name, $window, $orientation, $tt_text) {
$this->GtkButton();
list($pixmap, $mask) = Gdk::pixmap_create_from_xpm($window->window,null,$image_name);
$button_image = &new GtkPixmap($pixmap, $mask);
switch ($orientation) {
case VERT:
$button_box = &new GtkVBox();
break;
case HORZ:
$button_box = &new GtkHBox(false,1);
break;
default:
$button_box = &new GtkHBox();
$this->set_relief(GTK_RELIEF_NONE);
break;
}
//$button_label = &new GtkLabel($text);
$button_box->pack_start($button_image,false,false,1);
//$button_box->pack_start($button_label);
$this->add($button_box);
}
}
$window = &new GtkWindow();
$window->set_title("Menu Principal");
$window->set_uposition((gdk::screen_width()/4), gdk::screen_height()/4);
$window->set_usize(400, 400);
$window->connect_object('destroy', array('gtk', 'main_quit'));
//$window->realize();
$box = &new GtkVBox();
$window->add($box);
$menubar = &new GtkMenuBar();
$menubar->set_shadow_type(3);
$box->pack_start($menubar, false, false, 0);
$header1 = &new GtkMenuItem("Menu");
$menubar->append($header1);
$header2 = &new GtkMenuItem("Ayuda");
$header2->right_justify();
$menubar->append($header2);
$filemenu = &new GtkMenu();
$open = &new GtkMenuItem("Configuracion");
$filemenu->append($open);
//$filemenu2 = &new GtkMenu();
$openx = &new GtkMenuItem("English");
$filemenu->append($openx);
$separator = &new GtkMenuItem();
$separator->set_sensitive(false);
$filemenu->append($separator);
$exit = &new GtkMenuItem("Salir");
$exit->connect_object("activate", array("gtk", "main_quit"));
$filemenu->append($exit);
$header1->set_submenu($filemenu);
//// this doesnt work
$box1 = &new GtkHBox();
$window->add($box1);
$frame = &new GtkFrame(' | Menu Principal | ');
$box1->pack_start($frame,false);
$frame->set_usize(200, 200);
// create the container with 3 rows and 2 columns
$container = &new GtkTable(3,2);
$container->set_col_spacing(100);
$a_button = &new GtkButton('#');
$container->attach($a_button,0,1,1,2,GTK_SHRINK, GTK_SHRINK, 3, 3);
$a_button->connect('clicked', 'btn_fn', $clist,'#');
$frame->add($container);
///////////////
$window->show_all();
gtk::main();
?>