Re: [PHP-GTK] position at the bottom
[email protected] ("Joris Kluivers") Mon, 6 Aug 2001 22:50:12 +0200
| Newsgroups | php.gtk |
|---|---|
| Message-ID | <015701c11eb9$63a18f80$2201a8c0@WORKGROUP> |
Ok, i changed the script,
like you said the buttons and menu are placed correctly, but when i resize
the window, the button at the bottom and the menu at the top resize too. How
can i keep them in shape
Joris
// the script, sorry for the dutch comments
<?php
// Download de juiste module
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
dl('php_gtk.dll');
else
dl('php_gtk.so');
// De gtk functies
// Deze functie sluit de applicatie
function destroy()
{
print("Bye");
Gtk::main_quit();
}
// Maak het window
$window = &new GtkWindow();
// voeg de destroy functie toe
$window->connect('destroy','destroy');
// menubox = een fixed object
$menubox = &new GtkVBox();
// de close button
$button = &new GtkButton('Close');
$button->connect('clicked', 'destroy');
// maak de menu bar met inhoud
$menubar = &new GtkMenuBar();
$menuitems = Array('file','test2','test3');
$menus = Array();
$menus[0] = Array('New','Open','Save','Save As', 'Exit');
$menus[1] = Array('test2.1','test2.2','test2.3');
$menus[2] = Array('test3.1','test3.2','test3.3');
for($i=0;$i<sizeof($menuitems);$i++)
{
$tempitem = &new GtkMenuItem($menuitems[$i]);
$tempsubmenu = &new GtkMenu();
$tempsubmenu->set_title($menuitems[$i]);
// add a tearof item
$tearoff = &new GtkTearoffMenuItem();
$tempsubmenu->append($tearoff);
for($j=0; $j<sizeof($menus[$i]); $j++)
{
$tempsubitem = &new GtkMenuItem($menus[$i][$j]);
$tempsubmenu->append($tempsubitem);
}
$tempsubmenu->show_all();
$tempitem->set_submenu($tempsubmenu);
$menubar->append($tempitem);
}
$menubar->set_shadow_type(GTK_SHADOW_NONE);
$menubar->show_all();
// voeg de menubar toe aan de menubox
$menubox->pack_start($menubar);
// voeg een scheiding aan in box
$separator = &new GtkHSeparator();
$menubox->pack_start($separator);
$newbox = &new GtkHBox();
$menubox->pack_start($newbox);
$separator2 = &new GtkHSeparator();
$menubox->pack_start($separator2);
// voeg de button toe aan de box
$menubox->pack_end($button);
/*/ voeg een status bar toe
$status = &new GtkStatusbar();
$status_context = $status->get_context_id('statusid');
//$status->push($status_context,'Waiting for User ...');
$content->add($status);
$status->show(); */
$window->add($menubox);
// laat alles zien
$window->show_all();
// ga naar de main loop om de signalen te onderscheppen
Gtk::main();
?>