<?php
if( !extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
function toolbarClicked( $objButton, $strType)
{
echo 'clicked ' . $strType . "\r\n";
}
$window = &new GtkWindow();
$window->set_title( 'toolbar test');
$window->set_default_size( 400, 70);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$vbox = &new GtkVBox();
$systemimage = array(
'13 13 5 2',
' c None s None',
'. c topShadowColor m white c lightblue',
'X s iconColor1 m black c black',
'o s bottomShadowColor m black c #646464646464',
'O s selectColor m white c red',
" ",
" . . . ",
" . . X X X o o ",
" . X X X X X X X o ",
" . X X X X X X X o ",
" . X X X X O X X X X o ",
" . X X X O O O X X X o ",
" . X X X X O X X X X o ",
" . X X X X X X X o ",
" . X X X X X X X o ",
" o o X X X o o ",
" o o o ",
" "
);
$window->realize();
list($pixmap, $mask) = Gdk::pixmap_create_from_xpm_d($window->window, null, $systemimage);
$pixmapwid = &new GtkPixmap($pixmap, $mask);
$toolbar = &new GtkToolbar( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
$toolbar->set_button_relief( GTK_RELIEF_NONE);
$toolbar->set_space_style( GTK_TOOLBAR_SPACE_LINE);
$toolbar->append_item( 'new', 'Creates a new document', "Closes the active document\r\nand creates an empty new one",
null, 'toolbarClicked', 'new' );
$toolbar->append_item( 'open', 'Opens an existing document', null, null, 'toolbarClicked', 'open' );
$toolbar->append_space();
$toolbar->append_item( 'save', 'Saves the document', 'Saves the document on the harddisk', $pixmapwid, 'toolbarClicked', 'save' );
$toolbar->append_item( 'saveas', 'Saves the document with another filename', null, null, 'toolbarClicked', 'saveas' );
$handlebox = &new GtkHandleBox();
$handlebox->add( $toolbar);
$vbox->pack_start_defaults( $handlebox);
$label = &new GtkLabel( 'I should be below the toolbar');
$vbox->pack_start_defaults( $label);
$window->add( $vbox);
$window->show_all();
gtk::main();
?>
|