cvs: php-gtk-doc /examples/reference/gtk/gtkmenu popup.phpw /manual/en/reference/gtk gtkmenu.xml
| From: | Christian Weiske | Date: | Thu, 23 Mar 2006 07:11:30 +0000 |
| Subject: | cvs: php-gtk-doc /examples/reference/gtk/gtkmenu popup.phpw /manual/en/reference/gtk gtkmenu.xml | ||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-1944@lists.php.net to get a copy of this message | ||
cweiske Thu Mar 23 07:11:30 2006 UTC
Added files:
/php-gtk-doc/examples/reference/gtk/gtkmenu popup.phpw
Modified files:
/php-gtk-doc/manual/en/reference/gtk gtkmenu.xml
Log:
Popup menu example
http://cvs.php.net/viewcvs.cgi/php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml?r1=1.4&r2=1.5&diff_format=u
Index: php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml
diff -u php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml:1.4
php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml:1.5
--- php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml:1.4 Tue Aug 2 11:01:45 2005
+++ php-gtk-doc/manual/en/reference/gtk/gtkmenu.xml Thu Mar 23 07:11:30 2006
@@ -191,14 +191,26 @@
<funcsynopsis>
<funcprototype>
<funcdef>void <function>popup</function></funcdef>
+ <!-- FIXME: parameters? -->
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
<shortdesc>
-
+ Pops up the menu
</shortdesc>
<desc>
-
+ <para>
+ Shows the menu as a popup menu at the current cursor position.
+ </para>
+ <example>
+ <title>A popup menu on right click</title>
+ <programlisting role="php">
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="&directory.examples;/reference/gtk/gtkmenu/popup.phpw"
parse="text">
+ <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
+ </xi:include>
+ </programlisting>
+ </example>
</desc>
</method>
http://cvs.php.net/viewcvs.cgi/php-gtk-doc/examples/reference/gtk/gtkmenu/popup.phpw?view=markup&rev=1.1
Index: php-gtk-doc/examples/reference/gtk/gtkmenu/popup.phpw
+++ php-gtk-doc/examples/reference/gtk/gtkmenu/popup.phpw
<?php
//Popup menu example:
// An empty window in which you can right-click
// to show a popup menu
//Setup this menu: Add two items that echo something
// to the console when clicked
$menu = new GtkMenu();
$echo1 = new GtkMenuItem('Echo 1');
$echo1->connect_simple('activate', 'doEcho', 'echo1');
$menu->append($echo1);
$echo2 = new GtkMenuItem('Echo 2');
$echo2->connect_simple('activate', 'doEcho', 'echo2');
$menu->append($echo2);
//The menu is not shown, but this here is necessary
// to let it show when using popup()
$menu->show_all();
//This funciton is used as a callback and just echoes the parameter
function doEcho($message) {
echo $message . "\r\n";
}
//The function used as callback for the popup
function doPopup($window, $event, $menu)
{
//Check if it was the right mouse button (button 3)
if ($event->button == 3) {
//popup the menu
$menu->popup();
}
}
//Create a normal window
$wnd = new GtkWindow();
//Normally, the window doesn't receive the button press events.
// As we need them here, we force the window to accept and
// distribute them to our callbacks
$wnd->set_events($wnd->get_events() | Gdk::BUTTON_PRESS_MASK);
//Connect a callback to the butt press event
$wnd->connect('button-press-event', 'doPopup', $menu);
//Standard stuff
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->show_all();
Gtk::main();
?>