PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Jonathan Gotti   Menu Icon   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: sample of use
Class: Menu Icon
Create menu with optional icons using PHP-GTK
Author: By
Last change: removed part regarding menu editable as it's another class
Date: 18 years ago
Size: 1,898 bytes


Class file image Download
if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN')

$w = &new gtkwindow();

// We realize the window to get the gdkwindow needed to
// create Xpm if we want to display icons in our menu
$gdkwindow = $w->window;

// We also create a gtkaccelgroup to manage accelkeys
// the class menu will attempt to create its own if none is given at creation time
$accelgroup = &new gtkaccelgroup();

// So we declare the menu and add it to the window
$menu = &new menu($gdkwindow,$accelgroup);

// We now can add entrys to the menu
// first the file menu
// Second we want a open file option in the file menu
//we also want a separator in the menu file
$menu->add_menu_item('quit','file','_quit','shutdown','img/exit.xpm'); # you can now pass $xpmdatas or array(gdkpixmap,gdkkbitmask) instead of a file as image
//You can add check menu item too by setting is_checkmenuitem patameter to TRUE.

# now add an entry with a beautifull right click menu
$box = &new gtkvbox();
$entry = &new gtkentry();