CodeSnippets.HelloGtk2 3.0 KB

123456789101112131415
  1. version=pmwiki-1.0.5
  2. newline=²
  3. text=Just another Hello World for Gtk2 showing the methods available for the GtkWindow.²²[[include:Main/CodeTable]]²<?php²/* Author: Martin Fasani [ www.movil.be ]*/²if (!class_exists('gtk')) {² die("Please load the php-gtk2 module in your php.ini\r\n");²}²$gtk = new gtk();²²$wnd = new GtkWindow();²$wnd->set_title('Hello world');²$wnd->set_size_request( 400, 650 );²²$wnd->connect_simple('destroy', array('gtk', 'main_quit'));²// Let's get class methods²$gtkmain_methods=get_class_methods(get_class($gtk) );²$gtkwin_methods=get_class_methods(get_class($wnd) );²$out = "HELLO PHP-GTK2. This is version ".$gtk->get_version();²$out.= "\n\nThis are Gtk methods:\n";²foreach ($gtkmain_methods as $name => $value) {² $out.= "$name : $value\n";²}²$out.="\n\nThis are GtkWindow methods:\n";²foreach ($gtkwin_methods as $name => $value) {² $out.= "$name : $value\n";²}²²$sw = & new GtkScrolledWindow();²²$lblHello = new GtkLabel($out);²$sw->add_with_viewport($lblHello);²$wnd->add($sw);²$wnd->show_all();²²Gtk::main();²?>²[[include:Main/CodeTableEnd]]
  4. time=1147965833
  5. diff:1147965305:1147965305:=1,32c1²< Just another Hello World for Gtk2 showing the methods available for the GtkWindow.²< ²< [[include:Main/CodeTable]]²< <?php²< /* Author: Martin Fasani [ www.movil.be ]*/²< if (!class_exists('gtk')) {²< die("Please load the php-gtk2 module in your php.ini\r\n");²< }²< ²< $wnd = new GtkWindow();²< $wnd->set_title('Hello world');²< $wnd->set_size_request( 400, 150 );²< ²< $wnd->connect_simple('destroy', array('gtk', 'main_quit'));²< ²< $classvars=get_class_methods(get_class($wnd) );²< ²< $out= "HELLO PHP-GTK2. This are GtkWindow methods:\n";²< foreach ($classvars as $name => $value) {²< $out.= "$name : $value\n";²< }²< ²< $sw = & new GtkScrolledWindow();²< ²< $lblHello = new GtkLabel($out);²< $sw->add_with_viewport($lblHello);²< $wnd->add($sw);²< $wnd->show_all();²< ²< Gtk::main();²< ?>²< [[include:Main/CodeTableEnd]]²\ No newline at end of file²---²> Describe HelloGtk2 here.²\ No newline at end of file²
  6. author=Martin Fasani
  7. author:1147965305=Martin Fasani
  8. host:1147965305=80.36.215.119
  9. name=CodeSnippets.HelloGtk2
  10. host=80.36.215.119
  11. agent=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060427 Debian/1.7.13-0ubuntu5.10
  12. rev=2
  13. diff:1147965833:1147965305:=9d8²< $gtk = new gtk();²13c12²< $wnd->set_size_request( 400, 650 );²---²> $wnd->set_size_request( 400, 150 );²16,25c15,19²< // Let's get class methods²< $gtkmain_methods=get_class_methods(get_class($gtk) );²< $gtkwin_methods=get_class_methods(get_class($wnd) );²< $out = "HELLO PHP-GTK2. This is version ".$gtk->get_version();²< $out.= "\n\nThis are Gtk methods:\n";²< foreach ($gtkmain_methods as $name => $value) {²< $out.= "$name : $value\n";²< }²< $out.="\n\nThis are GtkWindow methods:\n";²< foreach ($gtkwin_methods as $name => $value) {²---²> ²> $classvars=get_class_methods(get_class($wnd) );²> ²> $out= "HELLO PHP-GTK2. This are GtkWindow methods:\n";²> foreach ($classvars as $name => $value) {²
  14. author:1147965833=Martin Fasani
  15. host:1147965833=80.36.215.119