Webhosting and cheap domain registration service
  

 Home

GtkToolbar
Prev GtkToolbar Constructor Next

GtkToolbar Constructor

Creates a new toolbar instance.

Example 43. A detachable toolbar

<?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();
?>

Prev Home Next
GtkToolbar Up GtkToolbar::add

 

  

Network sites:

Cheap domain registrar's cheap domain registration service

$8.95 domain registration : Buy domain name or register domain name 

 
 
Quotes:
Every person, all the events of your life are there because you have drawn them there. What you choose to do with them is up to you.Don't be dismayed at goodbyes. A farewell is necessary before you can meet again. And meeting again, after moments or lifetimes, is certain for those who are friends.  
 
 

Disclaimer: This documentation is provided only for the benefits of our webhosting customers.
For authoritative source of the documentation, please refer to http://gtk.php.net/docs.php