cvs: php-gtk-doc /en/userguide/chapters acknowledgements.xml install.xml installget.xml installunix.xml installusage.xml installwin32.xml intro.xml
introgtk.xml introphp.xml introphpgtk.xml signals.xml widgets.xml
| From: | Steph | Date: | Thu, 01 May 2003 17:45:33 +0000 |
| Subject: | cvs: php-gtk-doc /en/userguide/chapters acknowledgements.xml install.xml installget.xml installunix.xml installusage.xml installwin32.xml intro.xml introgtk.xml introphp.xml introphpgtk.xml signals.xml widgets.xml |
||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-647@lists.php.net to get a copy of this message | ||
sfox Thu May 1 13:45:33 2003 EDT
Added files:
/php-gtk-doc/en/userguide/chapters acknowledgements.xml
installget.xml installunix.xml
installusage.xml
installwin32.xml introgtk.xml
introphp.xml introphpgtk.xml
Removed files:
/php-gtk-doc/en/userguide/chapters install.xml intro.xml
Modified files:
/php-gtk-doc/en/userguide/chapters signals.xml widgets.xml
Log:
I hate CVS. Altering contents of /chapters because moving them up into userguide will be even
more confusing.
Index: php-gtk-doc/en/userguide/chapters/signals.xml diff -u php-gtk-doc/en/userguide/chapters/signals.xml:1.12 php-gtk-doc/en/userguide/chapters/signals.xml:1.13 --- php-gtk-doc/en/userguide/chapters/signals.xml:1.12 Tue Feb 26 19:09:16 2002 +++ php-gtk-doc/en/userguide/chapters/signals.xml Thu May 1 13:45:33 2003 @@ -1,3 +1,593 @@ +<<<<<<< signals.xml +<?xml version="1.0" encoding="ISO-8859-1" ?> +<chapter id="signals"> + <title>Signals and Callbacks</title> + <sect1 id="signals.intro"></sect1> + + <sect1 id="signals.whatare"> + <title>What are Signals?</title> + <simpara> + <emphasis>Signals are notifications emitted by + <link linkend="widgets.whatare">widgets</link>.</emphasis> + </simpara> + <simpara> + When programming Graphical User Interfaces (<acronym>GUI</acronym>), + it is often necessary to respond to actions performed by the user or + initiated within the program itself. <acronym>GNOME</acronym> + and <acronym>GTK+</acronym> do this via the use of signals. Signals are + used to let the program know that something happened. This might be, for + example, a user clicking on a <classname>GtkButton</classname>, + or a change being made to a <classname>GtkAdjustment</classname> value. + </simpara> + <simpara> + A program may, for instance, cause <classname>GtkAdjustment</classname> + to emit its <signalname>value-changed</signalname> signal when a widget + changes one of its adjustment values. This particular signal is used both + internally and externally in <classname>GtkAdjustment</classname>, so that + it is not always necessary to write that signal into your code for, say, a + <classname>GtkProgressBar</classname> to use it. A more obvious situation + may occur when a user clicks on an instance of + <classname>GtkButton</classname>, causing the button widget to emit the + <signalname>clicked</signalname> signal. As a programmer, you can set up + <link linkend="callbacks.whatare">callbacks</link> to react to any + signal emitted by a widget. + </simpara> + </sect1> + + <sect1 id="callbacks.whatare"> + <title>What are Callbacks?</title> + <simpara> + <emphasis> + Callbacks are functions that are invoked when + <link linkend="signals.whatare">signals</link> are emitted by + <link linkend="widgets.whatare">widgets</link>. + </emphasis> + </simpara> + <simpara> + Callbacks are functions that are set up by the programmer to react to + signals emitted by widgets. You specify the function that should be + called by <link linkend="signals.connection">connecting</link> the + function to the signal. + </simpara> + <simpara> + The callback is also known as the signal handler function. This can be + either the widget's <literal>default handler</literal> or a + <literal>user-defined handler</literal>, that is, a function written by + the programmer. + </simpara> + </sect1> + + <sect1 id="signals.inheritance"> + <title>Signal Inheritance</title> + <simpara> + Signals are inherited by objects, just as methods are. A widget can + emit any signals that its ancestor objects have defined, as well as its + own specific signals. + </simpara> + <simpara> + In cases where the signal is not relevant to the widget but is nonetheless + inherited by it, there will be no error message when the signal is called + - but equally, there will be no obvious means for the widget to emit that + particular signal. + </simpara> + </sect1> + + <sect1 id="signals.connection"> + <title>Connecting Signals</title> + + <sect2 id="signals.connection.simple"> + <title>Simple Connections</title> + <simpara> + To react to a signal you must connect to it by specifying a callback + function for PHP-GTK to call when that signal is emitted. + </simpara> + <simpara> + Connecting a function to a signal is achieved by calling the + <function class="GtkObject">connect()</function> method of the object. + </simpara> + <simpara> + The function that you register as the callback for a signal must have the + correct prototype. You can find what the prototype should be from the + <link linkend="reference">reference</link> section of this manual. + </simpara> + <simpara> + For example, if you wanted to connect to the + <signalname>clicked</signalname> signal of an instance of + <classname>GtkButton</classname> you should define a function that + accepts one parameter, which will be the button that was clicked. + </simpara> + <para> + The code below shows how you might create a window, add a button to it, + wait for it to be clicked and then, when it is clicked, open a new + <classname>GtkWindow</classname> containing a message. + <example> + <title>Signals and Callbacks</title> + <programlisting role="php"> + +function shutdown() +{ + print("Shutting down...\n"); + gtk::main_quit(); +} + +function you_clicked($button) +{ + $window = &new GtkWindow(); + $label = &new GtkLabel("You clicked the button"); + $window->add($label); + $window->connect("destroy","shutdown"); + $window->show_all(); + return false; +} + +$window = &new GtkWindow(); +$window->connect("destroy", "shutdown"); +$window->set_border_width(10); + +$button = &new GtkButton("Click Me!!"); +$button->connect("clicked", "you_clicked"); +$window->add($button); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + <para> + The important part here is where we call + <informalexample> + <programlisting role="php">$button->connect();</programlisting> + </informalexample> + The connect method here registers the <literal>you_clicked()</literal> + function as the callback that will be invoked when the + <signalname>clicked</signalname> signal is emitted by the + <classname>GtkButton</classname> widget. We also register the + <literal>shutdown()</literal> function as the handler for the + <signalname>destroy</signalname> signal for both windows so that we + can shut down the application properly. + </para> + </sect2> + + <sect2 id="signals.connection.multiple"> + <title>Multiple Connections</title> + <simpara> + With PHP-GTK you can register more than one function to be invoked when + a signal is emitted by a widget. This allows you to set up a whole set + of functions to be called in response to an expected action. + </simpara> + <para> + When more than one function is connected to a signal, the functions are + called in the order in which they were registered when that signal is + emitted. + <example> + <title>Signal Callback Order</title> + <programlisting role="php"> + +function first($button) +{ + print "First function has been called\n"; +} + +function second($button) +{ + print "Second function has been called\n"; +} + +$window = &new GtkWindow(); +$window->connect_object("destroy", array("gtk", +"main_quit")); + +$button = &new GtkButton("Click Me!!"); +$button->connect("clicked","first"); +$button->connect("clicked","second"); +$window->add($button); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + In the above example we connect two functions to a button's + <signalname>clicked</signalname> signal. The first call to the + <function class="GtkObject">connect()</function> method connects the + <signalname>clicked</signalname> signal to the <literal>first()</literal> + function, the second call connects the <signalname>clicked</signalname> + signal to the <literal>second()</literal> function. + </para> + <para> + The output from this program would be: + <programlisting> +First function has been called. +Second function has been called. + </programlisting> + </para> + </sect2> + </sect1> + + <sect1 id="signals.custom.params"> + <title>Using Custom Parameters</title> + <sect2 id="signals.custom.data"> + <title>Passing Custom Data as a Parameter</title> + <simpara> + When <link linkend="signals.connection">connecting</link> signals, + it is possible to add an extra custom parameter to the callback. This + is useful for passing the object you want to perform an action on, to + your callback function. + </simpara> + <simpara> + For example, when a button is pressed we might want to destroy the parent + instance of <classname>GtkWindow</classname> that that instance of + <classname>GtkButton</classname> has been + <function class="gtkcontainer">add</function>ed to. + </simpara> + <simpara> + You can do this by including an optional third parameter to the + <function class="GtkObject">connect()</function> call. This will then be + passed to your signal handler function as the final callback parameter. + </simpara> + <para> + <example> + <title> + Using Custom Parameters with the + <function class="GtkObject">connect()</function> method. + </title> + <programlisting role="php"> + +function button_clicked($button, $window) +{ + $window->destroy(); + gtk::main_quit(); +} + +$window = &new GtkWindow(); + +$button = &new GtkButton("exit"); +$button->connect("clicked","button_clicked", $window); + +$window->add($button); +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + In the above code you can see that we pass not only the + <literal>$button</literal> variable, an instance of + <classname>GtkButton</classname>, to the <signalname>clicked</signalname> + callback but also the <literal>$window</literal> variable, an instance + of the <classname>GtkWindow</classname> class. This allows us to call + the <function class="GtkObject">destroy()</function> method on the window. + </para> + <note> + <simpara> + You can have as many custom parameters as you want. + </simpara> + </note> + <para> + By passing the <literal>$button</literal> variable as our calling object + parameter and the <literal>$window</literal> variable as our custom + parameter, we could use this same callback for more than one + <classname>GtkButton</classname> on more than one + <classname>GtkWindow</classname>. Note that the names given to the + parameters within the callback are irrelevant outside the callback + function; PHP-GTK picks up on the positions of the parameters in the + connect* method calls and passes these to the variables listed in the + callback declaration as an array, so that any instance of a connection + using the same parameter structure can use that same callback. This is + demonstrated in the code below using a single custom parameter, but is + equally true for more than one. + <example> + <title>Using the same callback for more than one window</title> + <programlisting role="php"> + +function button_clicked($button, $window) +{ + $window->set_title("titled"); +} + +$window1 = &new GtkWindow(); +$window1->connect_object("destroy", array("gtk", +"main_quit")); +$window2 = &new GtkWindow(); +$window2->connect_object("destroy", array("gtk", +"main_quit")); + +$button1 = &new GtkButton("click me"); +$button2 = &new GtkButton("or me"); + +$button1->connect("clicked", "button_clicked", +$window1); +$button2->connect("clicked", "button_clicked", +$window2); + +$window1->add($button1); +$window2->add($button2); + +$window1->show_all(); +$window2->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + </sect2> + + <sect2 id="signals.connect.object"> + <title>Using the connect_object* methods</title> + <para> + Both <function class="GtkObject">connect_object()</function> and + <function class="GtkObject">connect_object_after()</function> allow you + to pass an object other than the calling object as the first parameter + to your callback function. This is mainly used for calling static + PHP-GTK functions, as in (for example) the + <function>gtk::main_quit()</function> function: + <example> + <title> + Using the <function class="GtkObject">connect_object()</function> + method to specify a built-in function as callback. + </title> + <programlisting role="php"> + +$window = &new GtkWindow(); +$window->connect_object("destroy", array("gtk", +"main_quit")); +$window->show(); + +gtk::main(); + </programlisting> + </example> + This could be called on any static function or method by using the + <literal>gtkobject::method</literal> syntax expressed as an array. + </para> + <para> + It also means you can have a single callback for multiple signals. For + example; you might create a window containing (within the necessary + container widgets) a <classname>GtkMenuBar</classname>, a + <classname>GtkToolbar</classname> and a <classname>GtkButton</classname>. + When <literal>Exit</literal> is chosen by the user through any of these + widgets, a shutdown function could be invoked by passing the instance of + <classname>GtkWindow</classname> as its first parameter, allowing the + window to be destroyed from any of those connections. The callback + function and the connections in this instance would look like this: + <example> + <title> + Using the <function class="GtkObject">connect_object()</function> + method to pass another object as first parameter. + </title> + <programlisting role="php"> + +function destroy_window($window) +{ + $window->destroy(); + gtk::main_quit(); +} + +$exit_button->connect_object("clicked", +"destroy_window", $window); + + </programlisting> + </example> + </para> + <para> + The connect_after* methods allow callbacks to be "run after" + the default signal handler for that signal. This can be useful + in some situations; for example, where you want to destroy only one of + several windows in a given circumstance. However, connect_after* methods + will only work when a signal has been created in the GTK source with a + <literal>GTK_RUN_LAST</literal> flag. The + <signalname>destroy</signalname> signal and all the + <literal>'event'</literal> signals have this flag; beyond that, + the only way to check is to either test the signal within PHP-GTK or + read the GTK source. + <example> + <title>Using the + <function class="GtkObject">connect_after()</function> method. + </title> + <programlisting role="php"> + +function quit_routine($window) +{ + print("Shutting down...\n"); + gtk::main_quit(); +} + +$window1 = &new GtkWindow(); +$window1->set_title("Quit the main loop"); +$window1->connect("destroy", "quit_routine"); + +$window2 = &new GtkWindow(); +$window2->set_title("Destroy this window"); +$window2->connect_after("destroy", "quit_routine"); + +$window1->show(); +$window2->show(); + +gtk::main(); + </programlisting> + </example> + </para> + <simpara> + See also: <classname>GtkObject</classname>, + <function class="GtkObject">connect_after()</function> + <function class="GtkObject">connect_object()</function> and + <function class="GtkObject">connect_object_after()</function>. + </simpara> + </sect2> + </sect1> + + <sect1 id="signals.events"> + <title>Signals and Events</title> + <simpara> + <emphasis>GTK Signals, GDK Events.</emphasis> + </simpara> + <simpara> + Signals are not events, and events are not signals. A signal is a message + emitted by an instance of a <classname>GtkObject</classname> in response + to some predetermined element in its environment, e.g. an action by the + end user, or an instruction from a function or method. Signals are always + programmed into the code, either internally within GTK or externally by + the PHP-GTK programmer. + </simpara> + <simpara> + Events, on the other hand, are a continual stream of impulses + communicating messages concerning environmental changes in the underlying + windowing system. The GTK main loop is made up of this stream of events, + among other things. + </simpara> + <note> + <simpara> + It is not possible to connect a callback function to a + <classname>GdkEvent</classname> directly. + </simpara> + </note> + <simpara> + Any widget having its own <classname>GdkWindow</classname> may capture + events that are relevant to it. Widgets lacking a + <classname>GdkWindow</classname> - those created with the + <literal>GTK_NO_WINDOW</literal> flag - cannot do so, unless they are + housed within a <classname>GtkEventBox</classname> - a widget created for + this specific purpose. There are occasions when it is useful to be able + to capture events; one obvious example would be the creation of an instance + of <classname>GtkToolTips</classname> which is triggered when its subject + widget captures the <literal>GDK_ENTER_NOTIFY</literal> event and + destroyed when the same widget captures the + <literal>GDK_LEAVE_NOTIFY</literal> event. + </simpara> + <simpara> + Although it is not possible to use an event to trigger a callback in the + same way as a signal, there are a series of signals derived from + <classname>GtkWidget</classname> collectively known as + <literal>'event' signals</literal>. These are effectively ways + of describing an event in terms of a signal, allowing callbacks to be + indirectly triggered through a captured occurrence of most of the + <enumname>GdkEventTypes</enumname>. The + <classname>GtkTooltips</classname> object itself uses the + <function class="GktObject">connect_object()</function> method and the + generic <signalname>event</signalname> signal in order to monitor its + subject widget. + </simpara> + <para> + The concept of events is not an easy one to grasp. Please copy, paste + and run the following script in order to see the flow of events over a + widget in action. + <example> + <title>Demonstration of the flow of events across a + <classname>GtkButton</classname> + </title> + <programlisting role="php"> + +dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" : +"so")) || +die("Can't load php_gtk module!\n"); + +function show_event_type($button, $event, $text) +{ + $event_type = $event->type; + $insert = $text->get_length(); + $text->freeze(); + switch($event_type) { + case 2: + $text->insert_text("GDK_EXPOSE\n", $insert); + break; + case 3: + $text->insert_text("GDK_MOTION_NOTIFY\n", $insert); + break; + case 4: + $text->insert_text("GDK_BUTTON_PRESS\n", $insert); + break; + case 5: + $text->insert_text("GDK_2BUTTON_PRESS\n", $insert); + $button->hide(); + break; + case 7: + $text->insert_text("GDK_BUTTON_RELEASE\n", $insert); + break; + case 8: + $text->insert_text("GDK_KEY_PRESS\n", $insert); + break; + case 9: + $text->insert_text("GDK_KEY_RELEASE\n", $insert); + break; + case 10: + $text->insert_text("GDK_ENTER_NOTIFY\n", $insert); + break; + case 11: + $text->insert_text("GDK_LEAVE_NOTIFY\n", $insert); + break; + case 12: + $text->insert_text("GDK_FOCUS_CHANGE\n", $insert); + break; + case 14: + $text->insert_text("GDK_MAP\n", $insert); + break; + case 15: + $text->insert_text("GDK_UNMAP\n", $insert); + $button->destroy(); + $text->insert_text( +"\n* GDK EVENTS AND GTK SIGNALS - background stream vs foreground +messaging * +\n +* Most GdkEventTypes have counterpart GTK signals, known as 'event' + signals, implemented in GtkWidget. The types on your screen are there + because the GtkButton was programmed to emit the generic 'event' signal + each time it captured one of the stream of GDK events that makes up the + GTK main loop. In each case, the captured GdkEvent was passed as a + callback parameter so that its enumerated type value could be determined + within the signal handler function. Scroll down to see the series of event + values captured during your recent interaction with the GtkButton widget. * +\n +* Please note that the majority of GTK signals do NOT correspond to GDK + events in this or any other way! For example, the signal connection + \$button->connect('pressed', 'whatever'); + has no relationship to the GDK_BUTTON_PRESS event it generates, which + refers to mouse-button activity and not to the GtkButton 'pressed' signal. * +\n", 0); + break; + } + $text->thaw(); + return false; +} + +$window = &new GtkWindow(); +$window->set_position(GTK_WIN_POS_CENTER); +$window->set_default_size((gdk::screen_width()/1.5), +(gdk::screen_height()-20)); +$window->connect_object("destroy", array("gtk", +"main_quit")); +$window->realize(); + +$box = &new GtkVBox(false, 5); +$window->add($box); +$scrlwin = &new GtkScrolledWindow(); +$box->pack_start($scrlwin, true, true, 0); +$text = &new GtkText(); +$scrlwin->add($text); + +$button = &new GtkButton("Double-click here for information.."); +$button->add_events(GDK_ALL_EVENTS_MASK); +$button->connect("event", "show_event_type", $text); +$box->pack_end($button, false, false, 5); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + </sect1> + +</chapter> + +<!-- + * Local variables: + * tab-width: 1 + * c-basic-offset: 1 + * fileformat=unix + * End: + * vim600: et sw=1 ts=1 tw=78 fdm=indent + * vim<600: et sw=1 ts=1 tw=78 +--> +======= <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="gtk.signals"> <title>Signals and Callbacks</title> @@ -585,3 +1175,4 @@ * vim600: et sw=1 ts=1 tw=78 fdm=indent * vim<600: et sw=1 ts=1 tw=78 --> +>>>>>>> 1.12 Index: php-gtk-doc/en/userguide/chapters/widgets.xml diff -u php-gtk-doc/en/userguide/chapters/widgets.xml:1.7 php-gtk-doc/en/userguide/chapters/widgets.xml:1.8 --- php-gtk-doc/en/userguide/chapters/widgets.xml:1.7 Fri Feb 1 07:27:30 2002 +++ php-gtk-doc/en/userguide/chapters/widgets.xml Thu May 1 13:45:33 2003 @@ -1,10 +1,23 @@ +<<<<<<< widgets.xml +<?xml version="1.0" encoding="ISO-8859-1" ?> +<chapter id="widgets"> +======= <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="gtk.widgets"> +>>>>>>> 1.7 <title>Widgets and Containers</title> + <sect1 id="widgets.intro"></sect1> - <sect1 id="gtk.widgets.intro"> - <title>Introduction</title> + <sect1 id="widgets.whatare"> + <title>What are Widgets?</title> <simpara> +<<<<<<< widgets.xml + <literal>widget</literal> is a term used in the world of X for any user + interface. A widget can be a text box, label, frame, window or any other + GUI component. GTK widgets are all derived from the abstract base class + <classname>GtkWidget</classname>, and inherit the methods, signals and + properties implemented therein. +======= This chapter will explain some of the concepts behind GTK+ and how you can use them. </simpara> @@ -18,6 +31,7 @@ GUI component. GTK widgets are all derived from the abstract base class <classname>GtkWidget</classname>, and inherit the methods, signals and properties implemented therein. +>>>>>>> 1.7 </simpara> <simpara> From a programming point of view a widget has five parts to its life cycle: @@ -35,8 +49,13 @@ <simpara>Placement</simpara> <simpara> This is the step of adding a widget to a +<<<<<<< widgets.xml + <link linkend="containers.whatare">container</link>. This is + achieved most straightforwardly in PHP-GTK by using the syntax +======= <link linkend="gtk.containers.whatare">container</link>. This is achieved most straightforwardly in PHP-GTK by using the syntax +>>>>>>> 1.7 <literal>$container->add($widget);</literal> </simpara> </listitem> @@ -73,9 +92,25 @@ </para> </sect1> +<<<<<<< widgets.xml + <sect1 id="containers.whatare"> + <title>What are Containers?</title> +======= <sect1 id="gtk.containers.whatare"> <title>What are Containers?</title> +>>>>>>> 1.7 <simpara> +<<<<<<< widgets.xml + A container is simply a <link linkend="widgets.whatare">widget</link> + that is able to contain another widget. The vast majority of widgets fall + into this class; obvious examples include <classname>GtkWindow</classname>, + <classname>GtkTable</classname> and <classname>GtkBox</classname>. Other + than this property they are exactly the same as any other widget, and may + be added to other containers as well as supporting child widgets of their + own. They are derived from the <classname>GtkContainer</classname> base + class, which is itself derived from the <classname>GtkWidget</classname> + class. +======= A container is simply a <link linkend="gtk.widgets.whatare">widget</link> that is able to contain another widget. The vast majority of widgets fall into this class; obvious examples include <classname>GtkWindow</classname>, @@ -85,6 +120,7 @@ own. They are derived from the <classname>GtkContainer</classname> base class, which is itself derived from the <classname>GtkWidget</classname> class. +>>>>>>> 1.7 </simpara> </sect1> Index: php-gtk-doc/en/userguide/chapters/acknowledgements.xml +++ php-gtk-doc/en/userguide/chapters/acknowledgements.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="acknowledgements"> <title>Acknowledgements</title> <simpara> The person I would like to thank most is &link.jhenstridge;, the author of PyGTK (Python GTK+ Bindings). His help and advice have proved invaluable during the development of this extension, and a fair amount of the source code is based on or inspired by what he has developed for PyGTK. </simpara> <simpara> I would also like to thank the PHP Team for making such a great language, and the GTK+ Team for developing what has to be the best C-based GUI toolkit. </simpara> <simpara> <author> <firstname>Andrei</firstname><surname>Zmievski</surname> </author> - <literal>Feb 2001</literal> </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installget.xml +++ php-gtk-doc/en/userguide/chapters/installget.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installget"> <title>Getting The Latest Version</title> <simpara> PHP-GTK &version.phpgtk; source and the binaries for Windows can be found at <ulink url="&url.phpgtk;">&url.phpgtk;</ulink>. Source users will also need to check out the latest version of PHP from CVS - see <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink>. </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installunix.xml +++ php-gtk-doc/en/userguide/chapters/installunix.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installunix"> <title>Installing PHP-GTK Under Unix</title> <para> Debian users can now download a PHP-GTK binary from <ulink url="&url.debian;">&url.debian;</ulink>. </para> <para> PHP GTK depends on a number of packages, which need to be installed before starting the PHP-GTK installation: <itemizedlist> <listitem> <para> PHP version &version.php; or later </para> </listitem> <listitem> <para> The GTK+ libraries, available from <ulink url="&url.gtk.download;">&url.gtk.download;</ulink>, or you can use the packaged versions for your system, e.g. <literal>gtk</literal> and <literal>gtk-devel</literal> </para> </listitem> <listitem> <simpara> libtool, automake and autoconf. The combination of libtool 1.4.2, automake 1.4 and autoconf 2.13 is known to work; mileage may vary with other version combinations. </simpara> </listitem> <listitem> <para> For the optional extras, download <ulink url="&url.gtkhtml;">GtkHTML libraries</ulink>, <ulink url="&url.scintilla;">GtkScintilla libraries</ulink> and <ulink url="&url.pixbuf;">Gdk-Pixbuf libraries</ulink>. Again, these may be available packaged on your system, just ensure that you also install the development package. GtkHTML, notably, has a number of sub-dependencies, e.g. <literal>GAL</literal>, that can also be obtained from the <ulink url="&url.gnome.ftp;">Gnome ftp site</ulink>. </para> </listitem> </itemizedlist> </para> <para> We suggest you get the latest source from <ulink url="&url.phpgtk;">&url.phpgtk;</ulink> or from anonymous CVS <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink>. </para> <para> Run the <command>./buildconf</command> script that is inside the distribution. This will set up the necessary files and create the <literal>configure</literal> script. Next, run <command>./configure</command>. This will check that you have a correct version of GTK+ 1.2.x (1.2.6 or above, available from <ulink url="&url.gtk.download;">&url.gtk.download;</ulink>) and other files required for compilation, and will then create the needed Makefiles. </para> <simpara> <command>./configure</command> can also be used to build the extra widgets, e.g. <command>./configure --enable-scintilla --enable-gtkhtml</command>. To list all the available options use <command>./configure --help</command>. Remember that each extra widget may have a number of dependencies that need to be available for the build to be successful. </simpara> <simpara> Finally, run <command>make</command> to compile the extension. Some source files are generated from .defs files by the code generator. If you see messages like <literal>"Could not write..."</literal>, it means that the listed GTK+ objects or features are not yet supported. If the compilation is successful, run <command>make install</command> to install the extension into your default PHP extension directory (usually <filename>/usr/local/lib/php/extensions</filename>). </simpara> <para> Troubleshooting: common problems from <command>./configure</command> or <command>make</command> <itemizedlist> <listitem> <simpara> <literal>./ltconfig: ltconfig : No such file or directory, configure: error: libtool configure failed</literal> is caused by not having one of libtool, automake or autoconf installed. </simpara> </listitem> <listitem> <simpara> <literal>./aclocal.m4:813: error: m4_defn: undefined: _m4_divert_diversion</literal> is caused by an incompatible version of autoconf, see the recommended versions above. </simpara> </listitem> <listitem> <para> <literal>php_gtk+.c:33: parse error before `TSRMLS_DC'</literal> is caused by either an old version of php being found by the build system or trying to build php-gtk with an old version of PHP - please upgrade to PHP version &version.php; to fix this. </para> </listitem> <listitem> <simpara> <literal>gen_gtk.c:1: parse error before '<'</literal> is caused by an error occurring in the generator. Usually this error is resolved by adding the line <literal>ini_set("memory_limit", "32M");</literal> to the first line of <filename>generator/generator.php</filename>. You will need to remove all the <filename>gen_*</filename> files from all directories after changing this. </simpara> </listitem> <listitem> <simpara> <literal>checking for gnome-config... Unknown library `gtkhtml'</literal> (from <command>./configure</command>) is due to an old or unavailable development header file - if you installed by rpm or a similar package system you will need the <literal>-devel</literal> packages </simpara> </listitem> <listitem> <simpara> <literal>Unable to find -lgal</literal> or similar message is caused by a missing <literal>gal-devel</literal> or similar library. Usually this will be a sub dependancy of some of the more complex widgets, like gtkhtml. </simpara> </listitem> </itemizedlist> </para> <simpara> To test the extension, try running the example scripts in the <filename>test/</filename> directory. These also provide demonstrations of some of the ways in which PHP-GTK and its extensions can be used. </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installusage.xml +++ php-gtk-doc/en/userguide/chapters/installusage.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installusage"> <title>How to use PHP-GTK</title> <simpara> PHP-GTK applications can be started from the command line (or a batch file) with this syntax: <command>C:\php4\php -q C:\path\to\php-gtk\script.php</command> </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installwin32.xml +++ php-gtk-doc/en/userguide/chapters/installwin32.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installwin32"> <title>Installing PHP-GTK Under Windows</title> <sect1 id="installwin32.intro"></sect1> <sect1 id="install.win32.binaries"> <title>Downloading PHP-GTK</title> <para> Download PHP-GTK &version.phpgtk; win32 binaries from <ulink url="&url.phpgtk;">&url.phpgtk;</ulink>. You may also want to check out the latest sources from php.net's CVS server. See <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink> for more information. </para> </sect1> <sect1 id="install.win32.binary.package-layout"> <title>Layout of the Binary Distribution</title> <para> The binary distribution of PHP-GTK contains this structure: <itemizedlist> <listitem> <para> <filename>\php4</filename> -> PHP dev and PHP-GTK &version.phpgtk; binary files </para> </listitem> <listitem> <simpara> <filename>\winnt</filename> -> the default php.ini file </simpara> </listitem> <listitem> <simpara> <filename>\winnt\system32</filename> -> GTK+ binaries used by the extension </simpara> </listitem> <listitem> <simpara> <filename>\test</filename> -> a few samples to demonstrate PHP-GTK usage </simpara> </listitem> <listitem> <simpara> <filename>README.TXT</filename> </simpara> </listitem> </itemizedlist> </para> </sect1> <sect1 id="install.win32.howto"> <title>How to install</title> <orderedlist> <listitem> <simpara> If this is a new installation you should create <filename>C:\php4</filename> and copy the files under <filename>\php4</filename> to this directory. If you have an existing PHP installation (for example, with Apache) or intend to have one, you will need to put your <filename>php.ini</filename> file in here too. The files that are in this folder by default are PHP or PHP-GTK-related and will all need to be updated from time to time. Note that <filename>C:\php4</filename> is the default directory and that if you install PHP-GTK anywhere else, you will need to specify the full path as your extension_dir in the copy of <filename>php.ini</filename> that is being used by PHP. </simpara> </listitem> <listitem> <simpara> Copy the contents of <filename>\winnt\system32</filename> to your system32 directory. On Windows NT and Windows 2000 that is <filename>C:\winnt\system32</filename>. On Windows 95/98 that can be <filename>C:\Windows\system</filename> or <filename>C:\Windows\system32</filename>, take your pick. This group of files is GTK-related and will not need to be updated until PHP-GTK2 is released. </simpara> </listitem> <listitem> <simpara> Copy the contents of <filename>\test</filename> to the location where you want to run your scripts (e.g. <filename>C:\php4\test</filename>). </simpara> </listitem> </orderedlist> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introgtk.xml +++ php-gtk-doc/en/userguide/chapters/introgtk.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introgtk"> <title>What is GTK+?</title> <sect1 id="gtk.intro"></sect1> <sect1 id="intro.whatis.gtk.history"> <title>A History of GTK+</title> <para> GTK+ was originally developed for <ulink url="&url.gimp;">GIMP</ulink>, the <ulink url="&url.gnu;">GNU</ulink> Image Manipulation Program. GTK+ stands for the GIMP Tool Kit. GTK+ has grown from these beginnings and is now used as a central part of <ulink url="&url.gnome;">Gnome</ulink>, the GNU Projects desktop environment. GTK+ has also been ported to BeOS and Win32, making it the perfect choice to use as the basis for a PHP extension, keeping PHP as cross-platform as possible and allowing the creation of windowed applications in PHP for Linux, BeOS and Windows. </para> </sect1> <sect1 id="intro.whatis.gtk.whatitdoes"> <title>What does GTK+ do?</title> <simpara> GTK+ is a set of libraries written in C to create graphical user interfaces. It has an object oriented architecture developed in three libraries: </simpara> <para> <itemizedlist> <listitem> <simpara> <emphasis>GLib</emphasis> </simpara> <simpara> provides various tools for use when programming with GTK+. </simpara> </listitem> <listitem> <simpara> <emphasis>GDK</emphasis> </simpara> <simpara> abstracts the low-level window drawing functions. </simpara> </listitem> <listitem> <simpara> <emphasis>GTK</emphasis> </simpara> <simpara> provides a set of widgets for use when creating your GUI. </simpara> </listitem> </itemizedlist> </para> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introphp.xml +++ php-gtk-doc/en/userguide/chapters/introphp.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introphp"> <title>What is PHP?</title> <sect1 id="php.intro"></sect1> <sect1 id="intro.whatis.php.history"> <title>A History of PHP</title> <simpara> <ulink url="&url.php;">PHP</ulink> started life and is still primarily used as a server-side HTML-embedded scripting language. </simpara> <simpara> PHP, known originally as Personal Home Pages, was first conceived in the autumn of 1994 by Rasmus Lerdorf. He wrote it as a way to track visitors to his online CV. The first version was released in early 1995, by which time Rasmus had found that by making the project open-source, people would fix his bugs. The first version was very straightforward and had a simple parser which recognised a few special macros and provided some of the utilities which were in common usage on homepages back then. </simpara> <simpara> The parser was rewritten in mid-1995 and renamed PHP/FI version 2. The "FI" in this version stood for the Form Interpreter which Rasmus had added to PHP to cope with the growing needs of webpages. mSQL support was also added at this time. PHP/FI underwent massive growth, and other people started to contribute code to it regularly. </simpara> <simpara> In mid-1997 Zeev Suraski and Andi Gutmans rewrote the main parser, and PHP shifted from being Rasmus' own to a more group orientated project. This formed the basis for PHP3, now named PHP: Hypertext Preprocessor - a recursive acronym. </simpara> <simpara> The latest version, PHP4, is another rewrite by Suraski and Gutmans and is based around the <ulink url="&url.zend;">Zend</ulink> engine. PHP now has over two hundred regular contributors working on various parts of the project. It has a massive amount of third party extension modules, supports all popular servers natively, and has inbuilt MySql and ODBC support. </simpara> <simpara> The latest statistics show that PHP is now in use on over 5.5 million domains, and has had a steady usage growth rate over the past year. It is far and away the single most popular Apache module; to give this some perspective, Apache currently holds nearly 60% of the market share of Internet webservers, whereas IIS servers (natively supporting ASP) hold less than half that proportion of the market. (Figures taken from <ulink url="&url.stats;">&url.stats;</ulink> March 2001.) </simpara> </sect1> <sect1 id="intro.whatis.php.whatdoes"> <title>What does PHP do?</title> <simpara> PHP is a general purpose language. It is normally put to use as an html-embedded scripting language for use on the web, but it can also be used as a shell scripting language or even as a language to write windowed applications, in the form of PHP-GTK. </simpara> <simpara> Due to PHP's open-source nature, if there is something you can't currently do in PHP itself there is nothing stopping you from writing a PHP module or extension in C code to extend its functionality so that you can do what you want from within PHP itself. This is made possible through the well-documented API which is available to all. </simpara> <para> PHP4 has two main parts to it: <itemizedlist> <listitem> <simpara> <emphasis>The Zend Engine</emphasis> </simpara> <simpara> is the part of the PHP package that keeps track of the requests, processes scripting files, and handles variables and resources. Its homepage can be found at <ulink url="&url.zend;">&url.zend;</ulink>. </simpara> </listitem> <listitem> <simpara> <emphasis>PHP</emphasis> </simpara> <simpara> implements 90% of the functionality seen by the end user. It provides a wide range of modules such as MySQL, ODBC and XML support. </simpara> </listitem> </itemizedlist> </para> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introphpgtk.xml +++ php-gtk-doc/en/userguide/chapters/introphpgtk.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introphpgtk"> <title>What is PHP-GTK?</title> <simpara> PHP-GTK is a <ulink url="&url.php;">PHP</ulink> extension that enables you to write client-side, cross-platform GUI applications. This is the first extension for <ulink url="&url.php;">PHP</ulink> of its kind, and was written in part to prove that <ulink url="&url.php;">PHP</ulink> is a capable general-purpose language that is suited to more than just the web application environment. </simpara> <simpara> This extension will <emphasis>not</emphasis> allow you to display GTK+ applications in a web browser. It is intended for creating standalone GUI applications. </simpara> </chapter>
Index: php-gtk-doc/en/userguide/chapters/signals.xml diff -u php-gtk-doc/en/userguide/chapters/signals.xml:1.12 php-gtk-doc/en/userguide/chapters/signals.xml:1.13 --- php-gtk-doc/en/userguide/chapters/signals.xml:1.12 Tue Feb 26 19:09:16 2002 +++ php-gtk-doc/en/userguide/chapters/signals.xml Thu May 1 13:45:33 2003 @@ -1,3 +1,593 @@ +<<<<<<< signals.xml +<?xml version="1.0" encoding="ISO-8859-1" ?> +<chapter id="signals"> + <title>Signals and Callbacks</title> + <sect1 id="signals.intro"></sect1> + + <sect1 id="signals.whatare"> + <title>What are Signals?</title> + <simpara> + <emphasis>Signals are notifications emitted by + <link linkend="widgets.whatare">widgets</link>.</emphasis> + </simpara> + <simpara> + When programming Graphical User Interfaces (<acronym>GUI</acronym>), + it is often necessary to respond to actions performed by the user or + initiated within the program itself. <acronym>GNOME</acronym> + and <acronym>GTK+</acronym> do this via the use of signals. Signals are + used to let the program know that something happened. This might be, for + example, a user clicking on a <classname>GtkButton</classname>, + or a change being made to a <classname>GtkAdjustment</classname> value. + </simpara> + <simpara> + A program may, for instance, cause <classname>GtkAdjustment</classname> + to emit its <signalname>value-changed</signalname> signal when a widget + changes one of its adjustment values. This particular signal is used both + internally and externally in <classname>GtkAdjustment</classname>, so that + it is not always necessary to write that signal into your code for, say, a + <classname>GtkProgressBar</classname> to use it. A more obvious situation + may occur when a user clicks on an instance of + <classname>GtkButton</classname>, causing the button widget to emit the + <signalname>clicked</signalname> signal. As a programmer, you can set up + <link linkend="callbacks.whatare">callbacks</link> to react to any + signal emitted by a widget. + </simpara> + </sect1> + + <sect1 id="callbacks.whatare"> + <title>What are Callbacks?</title> + <simpara> + <emphasis> + Callbacks are functions that are invoked when + <link linkend="signals.whatare">signals</link> are emitted by + <link linkend="widgets.whatare">widgets</link>. + </emphasis> + </simpara> + <simpara> + Callbacks are functions that are set up by the programmer to react to + signals emitted by widgets. You specify the function that should be + called by <link linkend="signals.connection">connecting</link> the + function to the signal. + </simpara> + <simpara> + The callback is also known as the signal handler function. This can be + either the widget's <literal>default handler</literal> or a + <literal>user-defined handler</literal>, that is, a function written by + the programmer. + </simpara> + </sect1> + + <sect1 id="signals.inheritance"> + <title>Signal Inheritance</title> + <simpara> + Signals are inherited by objects, just as methods are. A widget can + emit any signals that its ancestor objects have defined, as well as its + own specific signals. + </simpara> + <simpara> + In cases where the signal is not relevant to the widget but is nonetheless + inherited by it, there will be no error message when the signal is called + - but equally, there will be no obvious means for the widget to emit that + particular signal. + </simpara> + </sect1> + + <sect1 id="signals.connection"> + <title>Connecting Signals</title> + + <sect2 id="signals.connection.simple"> + <title>Simple Connections</title> + <simpara> + To react to a signal you must connect to it by specifying a callback + function for PHP-GTK to call when that signal is emitted. + </simpara> + <simpara> + Connecting a function to a signal is achieved by calling the + <function class="GtkObject">connect()</function> method of the object. + </simpara> + <simpara> + The function that you register as the callback for a signal must have the + correct prototype. You can find what the prototype should be from the + <link linkend="reference">reference</link> section of this manual. + </simpara> + <simpara> + For example, if you wanted to connect to the + <signalname>clicked</signalname> signal of an instance of + <classname>GtkButton</classname> you should define a function that + accepts one parameter, which will be the button that was clicked. + </simpara> + <para> + The code below shows how you might create a window, add a button to it, + wait for it to be clicked and then, when it is clicked, open a new + <classname>GtkWindow</classname> containing a message. + <example> + <title>Signals and Callbacks</title> + <programlisting role="php"> + +function shutdown() +{ + print("Shutting down...\n"); + gtk::main_quit(); +} + +function you_clicked($button) +{ + $window = &new GtkWindow(); + $label = &new GtkLabel("You clicked the button"); + $window->add($label); + $window->connect("destroy","shutdown"); + $window->show_all(); + return false; +} + +$window = &new GtkWindow(); +$window->connect("destroy", "shutdown"); +$window->set_border_width(10); + +$button = &new GtkButton("Click Me!!"); +$button->connect("clicked", "you_clicked"); +$window->add($button); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + <para> + The important part here is where we call + <informalexample> + <programlisting role="php">$button->connect();</programlisting> + </informalexample> + The connect method here registers the <literal>you_clicked()</literal> + function as the callback that will be invoked when the + <signalname>clicked</signalname> signal is emitted by the + <classname>GtkButton</classname> widget. We also register the + <literal>shutdown()</literal> function as the handler for the + <signalname>destroy</signalname> signal for both windows so that we + can shut down the application properly. + </para> + </sect2> + + <sect2 id="signals.connection.multiple"> + <title>Multiple Connections</title> + <simpara> + With PHP-GTK you can register more than one function to be invoked when + a signal is emitted by a widget. This allows you to set up a whole set + of functions to be called in response to an expected action. + </simpara> + <para> + When more than one function is connected to a signal, the functions are + called in the order in which they were registered when that signal is + emitted. + <example> + <title>Signal Callback Order</title> + <programlisting role="php"> + +function first($button) +{ + print "First function has been called\n"; +} + +function second($button) +{ + print "Second function has been called\n"; +} + +$window = &new GtkWindow(); +$window->connect_object("destroy", array("gtk", +"main_quit")); + +$button = &new GtkButton("Click Me!!"); +$button->connect("clicked","first"); +$button->connect("clicked","second"); +$window->add($button); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + In the above example we connect two functions to a button's + <signalname>clicked</signalname> signal. The first call to the + <function class="GtkObject">connect()</function> method connects the + <signalname>clicked</signalname> signal to the <literal>first()</literal> + function, the second call connects the <signalname>clicked</signalname> + signal to the <literal>second()</literal> function. + </para> + <para> + The output from this program would be: + <programlisting> +First function has been called. +Second function has been called. + </programlisting> + </para> + </sect2> + </sect1> + + <sect1 id="signals.custom.params"> + <title>Using Custom Parameters</title> + <sect2 id="signals.custom.data"> + <title>Passing Custom Data as a Parameter</title> + <simpara> + When <link linkend="signals.connection">connecting</link> signals, + it is possible to add an extra custom parameter to the callback. This + is useful for passing the object you want to perform an action on, to + your callback function. + </simpara> + <simpara> + For example, when a button is pressed we might want to destroy the parent + instance of <classname>GtkWindow</classname> that that instance of + <classname>GtkButton</classname> has been + <function class="gtkcontainer">add</function>ed to. + </simpara> + <simpara> + You can do this by including an optional third parameter to the + <function class="GtkObject">connect()</function> call. This will then be + passed to your signal handler function as the final callback parameter. + </simpara> + <para> + <example> + <title> + Using Custom Parameters with the + <function class="GtkObject">connect()</function> method. + </title> + <programlisting role="php"> + +function button_clicked($button, $window) +{ + $window->destroy(); + gtk::main_quit(); +} + +$window = &new GtkWindow(); + +$button = &new GtkButton("exit"); +$button->connect("clicked","button_clicked", $window); + +$window->add($button); +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + In the above code you can see that we pass not only the + <literal>$button</literal> variable, an instance of + <classname>GtkButton</classname>, to the <signalname>clicked</signalname> + callback but also the <literal>$window</literal> variable, an instance + of the <classname>GtkWindow</classname> class. This allows us to call + the <function class="GtkObject">destroy()</function> method on the window. + </para> + <note> + <simpara> + You can have as many custom parameters as you want. + </simpara> + </note> + <para> + By passing the <literal>$button</literal> variable as our calling object + parameter and the <literal>$window</literal> variable as our custom + parameter, we could use this same callback for more than one + <classname>GtkButton</classname> on more than one + <classname>GtkWindow</classname>. Note that the names given to the + parameters within the callback are irrelevant outside the callback + function; PHP-GTK picks up on the positions of the parameters in the + connect* method calls and passes these to the variables listed in the + callback declaration as an array, so that any instance of a connection + using the same parameter structure can use that same callback. This is + demonstrated in the code below using a single custom parameter, but is + equally true for more than one. + <example> + <title>Using the same callback for more than one window</title> + <programlisting role="php"> + +function button_clicked($button, $window) +{ + $window->set_title("titled"); +} + +$window1 = &new GtkWindow(); +$window1->connect_object("destroy", array("gtk", +"main_quit")); +$window2 = &new GtkWindow(); +$window2->connect_object("destroy", array("gtk", +"main_quit")); + +$button1 = &new GtkButton("click me"); +$button2 = &new GtkButton("or me"); + +$button1->connect("clicked", "button_clicked", +$window1); +$button2->connect("clicked", "button_clicked", +$window2); + +$window1->add($button1); +$window2->add($button2); + +$window1->show_all(); +$window2->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + </sect2> + + <sect2 id="signals.connect.object"> + <title>Using the connect_object* methods</title> + <para> + Both <function class="GtkObject">connect_object()</function> and + <function class="GtkObject">connect_object_after()</function> allow you + to pass an object other than the calling object as the first parameter + to your callback function. This is mainly used for calling static + PHP-GTK functions, as in (for example) the + <function>gtk::main_quit()</function> function: + <example> + <title> + Using the <function class="GtkObject">connect_object()</function> + method to specify a built-in function as callback. + </title> + <programlisting role="php"> + +$window = &new GtkWindow(); +$window->connect_object("destroy", array("gtk", +"main_quit")); +$window->show(); + +gtk::main(); + </programlisting> + </example> + This could be called on any static function or method by using the + <literal>gtkobject::method</literal> syntax expressed as an array. + </para> + <para> + It also means you can have a single callback for multiple signals. For + example; you might create a window containing (within the necessary + container widgets) a <classname>GtkMenuBar</classname>, a + <classname>GtkToolbar</classname> and a <classname>GtkButton</classname>. + When <literal>Exit</literal> is chosen by the user through any of these + widgets, a shutdown function could be invoked by passing the instance of + <classname>GtkWindow</classname> as its first parameter, allowing the + window to be destroyed from any of those connections. The callback + function and the connections in this instance would look like this: + <example> + <title> + Using the <function class="GtkObject">connect_object()</function> + method to pass another object as first parameter. + </title> + <programlisting role="php"> + +function destroy_window($window) +{ + $window->destroy(); + gtk::main_quit(); +} + +$exit_button->connect_object("clicked", +"destroy_window", $window); + + </programlisting> + </example> + </para> + <para> + The connect_after* methods allow callbacks to be "run after" + the default signal handler for that signal. This can be useful + in some situations; for example, where you want to destroy only one of + several windows in a given circumstance. However, connect_after* methods + will only work when a signal has been created in the GTK source with a + <literal>GTK_RUN_LAST</literal> flag. The + <signalname>destroy</signalname> signal and all the + <literal>'event'</literal> signals have this flag; beyond that, + the only way to check is to either test the signal within PHP-GTK or + read the GTK source. + <example> + <title>Using the + <function class="GtkObject">connect_after()</function> method. + </title> + <programlisting role="php"> + +function quit_routine($window) +{ + print("Shutting down...\n"); + gtk::main_quit(); +} + +$window1 = &new GtkWindow(); +$window1->set_title("Quit the main loop"); +$window1->connect("destroy", "quit_routine"); + +$window2 = &new GtkWindow(); +$window2->set_title("Destroy this window"); +$window2->connect_after("destroy", "quit_routine"); + +$window1->show(); +$window2->show(); + +gtk::main(); + </programlisting> + </example> + </para> + <simpara> + See also: <classname>GtkObject</classname>, + <function class="GtkObject">connect_after()</function> + <function class="GtkObject">connect_object()</function> and + <function class="GtkObject">connect_object_after()</function>. + </simpara> + </sect2> + </sect1> + + <sect1 id="signals.events"> + <title>Signals and Events</title> + <simpara> + <emphasis>GTK Signals, GDK Events.</emphasis> + </simpara> + <simpara> + Signals are not events, and events are not signals. A signal is a message + emitted by an instance of a <classname>GtkObject</classname> in response + to some predetermined element in its environment, e.g. an action by the + end user, or an instruction from a function or method. Signals are always + programmed into the code, either internally within GTK or externally by + the PHP-GTK programmer. + </simpara> + <simpara> + Events, on the other hand, are a continual stream of impulses + communicating messages concerning environmental changes in the underlying + windowing system. The GTK main loop is made up of this stream of events, + among other things. + </simpara> + <note> + <simpara> + It is not possible to connect a callback function to a + <classname>GdkEvent</classname> directly. + </simpara> + </note> + <simpara> + Any widget having its own <classname>GdkWindow</classname> may capture + events that are relevant to it. Widgets lacking a + <classname>GdkWindow</classname> - those created with the + <literal>GTK_NO_WINDOW</literal> flag - cannot do so, unless they are + housed within a <classname>GtkEventBox</classname> - a widget created for + this specific purpose. There are occasions when it is useful to be able + to capture events; one obvious example would be the creation of an instance + of <classname>GtkToolTips</classname> which is triggered when its subject + widget captures the <literal>GDK_ENTER_NOTIFY</literal> event and + destroyed when the same widget captures the + <literal>GDK_LEAVE_NOTIFY</literal> event. + </simpara> + <simpara> + Although it is not possible to use an event to trigger a callback in the + same way as a signal, there are a series of signals derived from + <classname>GtkWidget</classname> collectively known as + <literal>'event' signals</literal>. These are effectively ways + of describing an event in terms of a signal, allowing callbacks to be + indirectly triggered through a captured occurrence of most of the + <enumname>GdkEventTypes</enumname>. The + <classname>GtkTooltips</classname> object itself uses the + <function class="GktObject">connect_object()</function> method and the + generic <signalname>event</signalname> signal in order to monitor its + subject widget. + </simpara> + <para> + The concept of events is not an easy one to grasp. Please copy, paste + and run the following script in order to see the flow of events over a + widget in action. + <example> + <title>Demonstration of the flow of events across a + <classname>GtkButton</classname> + </title> + <programlisting role="php"> + +dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" : +"so")) || +die("Can't load php_gtk module!\n"); + +function show_event_type($button, $event, $text) +{ + $event_type = $event->type; + $insert = $text->get_length(); + $text->freeze(); + switch($event_type) { + case 2: + $text->insert_text("GDK_EXPOSE\n", $insert); + break; + case 3: + $text->insert_text("GDK_MOTION_NOTIFY\n", $insert); + break; + case 4: + $text->insert_text("GDK_BUTTON_PRESS\n", $insert); + break; + case 5: + $text->insert_text("GDK_2BUTTON_PRESS\n", $insert); + $button->hide(); + break; + case 7: + $text->insert_text("GDK_BUTTON_RELEASE\n", $insert); + break; + case 8: + $text->insert_text("GDK_KEY_PRESS\n", $insert); + break; + case 9: + $text->insert_text("GDK_KEY_RELEASE\n", $insert); + break; + case 10: + $text->insert_text("GDK_ENTER_NOTIFY\n", $insert); + break; + case 11: + $text->insert_text("GDK_LEAVE_NOTIFY\n", $insert); + break; + case 12: + $text->insert_text("GDK_FOCUS_CHANGE\n", $insert); + break; + case 14: + $text->insert_text("GDK_MAP\n", $insert); + break; + case 15: + $text->insert_text("GDK_UNMAP\n", $insert); + $button->destroy(); + $text->insert_text( +"\n* GDK EVENTS AND GTK SIGNALS - background stream vs foreground +messaging * +\n +* Most GdkEventTypes have counterpart GTK signals, known as 'event' + signals, implemented in GtkWidget. The types on your screen are there + because the GtkButton was programmed to emit the generic 'event' signal + each time it captured one of the stream of GDK events that makes up the + GTK main loop. In each case, the captured GdkEvent was passed as a + callback parameter so that its enumerated type value could be determined + within the signal handler function. Scroll down to see the series of event + values captured during your recent interaction with the GtkButton widget. * +\n +* Please note that the majority of GTK signals do NOT correspond to GDK + events in this or any other way! For example, the signal connection + \$button->connect('pressed', 'whatever'); + has no relationship to the GDK_BUTTON_PRESS event it generates, which + refers to mouse-button activity and not to the GtkButton 'pressed' signal. * +\n", 0); + break; + } + $text->thaw(); + return false; +} + +$window = &new GtkWindow(); +$window->set_position(GTK_WIN_POS_CENTER); +$window->set_default_size((gdk::screen_width()/1.5), +(gdk::screen_height()-20)); +$window->connect_object("destroy", array("gtk", +"main_quit")); +$window->realize(); + +$box = &new GtkVBox(false, 5); +$window->add($box); +$scrlwin = &new GtkScrolledWindow(); +$box->pack_start($scrlwin, true, true, 0); +$text = &new GtkText(); +$scrlwin->add($text); + +$button = &new GtkButton("Double-click here for information.."); +$button->add_events(GDK_ALL_EVENTS_MASK); +$button->connect("event", "show_event_type", $text); +$box->pack_end($button, false, false, 5); + +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + </para> + </sect1> + +</chapter> + +<!-- + * Local variables: + * tab-width: 1 + * c-basic-offset: 1 + * fileformat=unix + * End: + * vim600: et sw=1 ts=1 tw=78 fdm=indent + * vim<600: et sw=1 ts=1 tw=78 +--> +======= <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="gtk.signals"> <title>Signals and Callbacks</title> @@ -585,3 +1175,4 @@ * vim600: et sw=1 ts=1 tw=78 fdm=indent * vim<600: et sw=1 ts=1 tw=78 --> +>>>>>>> 1.12 Index: php-gtk-doc/en/userguide/chapters/widgets.xml diff -u php-gtk-doc/en/userguide/chapters/widgets.xml:1.7 php-gtk-doc/en/userguide/chapters/widgets.xml:1.8 --- php-gtk-doc/en/userguide/chapters/widgets.xml:1.7 Fri Feb 1 07:27:30 2002 +++ php-gtk-doc/en/userguide/chapters/widgets.xml Thu May 1 13:45:33 2003 @@ -1,10 +1,23 @@ +<<<<<<< widgets.xml +<?xml version="1.0" encoding="ISO-8859-1" ?> +<chapter id="widgets"> +======= <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="gtk.widgets"> +>>>>>>> 1.7 <title>Widgets and Containers</title> + <sect1 id="widgets.intro"></sect1> - <sect1 id="gtk.widgets.intro"> - <title>Introduction</title> + <sect1 id="widgets.whatare"> + <title>What are Widgets?</title> <simpara> +<<<<<<< widgets.xml + <literal>widget</literal> is a term used in the world of X for any user + interface. A widget can be a text box, label, frame, window or any other + GUI component. GTK widgets are all derived from the abstract base class + <classname>GtkWidget</classname>, and inherit the methods, signals and + properties implemented therein. +======= This chapter will explain some of the concepts behind GTK+ and how you can use them. </simpara> @@ -18,6 +31,7 @@ GUI component. GTK widgets are all derived from the abstract base class <classname>GtkWidget</classname>, and inherit the methods, signals and properties implemented therein. +>>>>>>> 1.7 </simpara> <simpara> From a programming point of view a widget has five parts to its life cycle: @@ -35,8 +49,13 @@ <simpara>Placement</simpara> <simpara> This is the step of adding a widget to a +<<<<<<< widgets.xml + <link linkend="containers.whatare">container</link>. This is + achieved most straightforwardly in PHP-GTK by using the syntax +======= <link linkend="gtk.containers.whatare">container</link>. This is achieved most straightforwardly in PHP-GTK by using the syntax +>>>>>>> 1.7 <literal>$container->add($widget);</literal> </simpara> </listitem> @@ -73,9 +92,25 @@ </para> </sect1> +<<<<<<< widgets.xml + <sect1 id="containers.whatare"> + <title>What are Containers?</title> +======= <sect1 id="gtk.containers.whatare"> <title>What are Containers?</title> +>>>>>>> 1.7 <simpara> +<<<<<<< widgets.xml + A container is simply a <link linkend="widgets.whatare">widget</link> + that is able to contain another widget. The vast majority of widgets fall + into this class; obvious examples include <classname>GtkWindow</classname>, + <classname>GtkTable</classname> and <classname>GtkBox</classname>. Other + than this property they are exactly the same as any other widget, and may + be added to other containers as well as supporting child widgets of their + own. They are derived from the <classname>GtkContainer</classname> base + class, which is itself derived from the <classname>GtkWidget</classname> + class. +======= A container is simply a <link linkend="gtk.widgets.whatare">widget</link> that is able to contain another widget. The vast majority of widgets fall into this class; obvious examples include <classname>GtkWindow</classname>, @@ -85,6 +120,7 @@ own. They are derived from the <classname>GtkContainer</classname> base class, which is itself derived from the <classname>GtkWidget</classname> class. +>>>>>>> 1.7 </simpara> </sect1> Index: php-gtk-doc/en/userguide/chapters/acknowledgements.xml +++ php-gtk-doc/en/userguide/chapters/acknowledgements.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="acknowledgements"> <title>Acknowledgements</title> <simpara> The person I would like to thank most is &link.jhenstridge;, the author of PyGTK (Python GTK+ Bindings). His help and advice have proved invaluable during the development of this extension, and a fair amount of the source code is based on or inspired by what he has developed for PyGTK. </simpara> <simpara> I would also like to thank the PHP Team for making such a great language, and the GTK+ Team for developing what has to be the best C-based GUI toolkit. </simpara> <simpara> <author> <firstname>Andrei</firstname><surname>Zmievski</surname> </author> - <literal>Feb 2001</literal> </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installget.xml +++ php-gtk-doc/en/userguide/chapters/installget.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installget"> <title>Getting The Latest Version</title> <simpara> PHP-GTK &version.phpgtk; source and the binaries for Windows can be found at <ulink url="&url.phpgtk;">&url.phpgtk;</ulink>. Source users will also need to check out the latest version of PHP from CVS - see <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink>. </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installunix.xml +++ php-gtk-doc/en/userguide/chapters/installunix.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installunix"> <title>Installing PHP-GTK Under Unix</title> <para> Debian users can now download a PHP-GTK binary from <ulink url="&url.debian;">&url.debian;</ulink>. </para> <para> PHP GTK depends on a number of packages, which need to be installed before starting the PHP-GTK installation: <itemizedlist> <listitem> <para> PHP version &version.php; or later </para> </listitem> <listitem> <para> The GTK+ libraries, available from <ulink url="&url.gtk.download;">&url.gtk.download;</ulink>, or you can use the packaged versions for your system, e.g. <literal>gtk</literal> and <literal>gtk-devel</literal> </para> </listitem> <listitem> <simpara> libtool, automake and autoconf. The combination of libtool 1.4.2, automake 1.4 and autoconf 2.13 is known to work; mileage may vary with other version combinations. </simpara> </listitem> <listitem> <para> For the optional extras, download <ulink url="&url.gtkhtml;">GtkHTML libraries</ulink>, <ulink url="&url.scintilla;">GtkScintilla libraries</ulink> and <ulink url="&url.pixbuf;">Gdk-Pixbuf libraries</ulink>. Again, these may be available packaged on your system, just ensure that you also install the development package. GtkHTML, notably, has a number of sub-dependencies, e.g. <literal>GAL</literal>, that can also be obtained from the <ulink url="&url.gnome.ftp;">Gnome ftp site</ulink>. </para> </listitem> </itemizedlist> </para> <para> We suggest you get the latest source from <ulink url="&url.phpgtk;">&url.phpgtk;</ulink> or from anonymous CVS <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink>. </para> <para> Run the <command>./buildconf</command> script that is inside the distribution. This will set up the necessary files and create the <literal>configure</literal> script. Next, run <command>./configure</command>. This will check that you have a correct version of GTK+ 1.2.x (1.2.6 or above, available from <ulink url="&url.gtk.download;">&url.gtk.download;</ulink>) and other files required for compilation, and will then create the needed Makefiles. </para> <simpara> <command>./configure</command> can also be used to build the extra widgets, e.g. <command>./configure --enable-scintilla --enable-gtkhtml</command>. To list all the available options use <command>./configure --help</command>. Remember that each extra widget may have a number of dependencies that need to be available for the build to be successful. </simpara> <simpara> Finally, run <command>make</command> to compile the extension. Some source files are generated from .defs files by the code generator. If you see messages like <literal>"Could not write..."</literal>, it means that the listed GTK+ objects or features are not yet supported. If the compilation is successful, run <command>make install</command> to install the extension into your default PHP extension directory (usually <filename>/usr/local/lib/php/extensions</filename>). </simpara> <para> Troubleshooting: common problems from <command>./configure</command> or <command>make</command> <itemizedlist> <listitem> <simpara> <literal>./ltconfig: ltconfig : No such file or directory, configure: error: libtool configure failed</literal> is caused by not having one of libtool, automake or autoconf installed. </simpara> </listitem> <listitem> <simpara> <literal>./aclocal.m4:813: error: m4_defn: undefined: _m4_divert_diversion</literal> is caused by an incompatible version of autoconf, see the recommended versions above. </simpara> </listitem> <listitem> <para> <literal>php_gtk+.c:33: parse error before `TSRMLS_DC'</literal> is caused by either an old version of php being found by the build system or trying to build php-gtk with an old version of PHP - please upgrade to PHP version &version.php; to fix this. </para> </listitem> <listitem> <simpara> <literal>gen_gtk.c:1: parse error before '<'</literal> is caused by an error occurring in the generator. Usually this error is resolved by adding the line <literal>ini_set("memory_limit", "32M");</literal> to the first line of <filename>generator/generator.php</filename>. You will need to remove all the <filename>gen_*</filename> files from all directories after changing this. </simpara> </listitem> <listitem> <simpara> <literal>checking for gnome-config... Unknown library `gtkhtml'</literal> (from <command>./configure</command>) is due to an old or unavailable development header file - if you installed by rpm or a similar package system you will need the <literal>-devel</literal> packages </simpara> </listitem> <listitem> <simpara> <literal>Unable to find -lgal</literal> or similar message is caused by a missing <literal>gal-devel</literal> or similar library. Usually this will be a sub dependancy of some of the more complex widgets, like gtkhtml. </simpara> </listitem> </itemizedlist> </para> <simpara> To test the extension, try running the example scripts in the <filename>test/</filename> directory. These also provide demonstrations of some of the ways in which PHP-GTK and its extensions can be used. </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installusage.xml +++ php-gtk-doc/en/userguide/chapters/installusage.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installusage"> <title>How to use PHP-GTK</title> <simpara> PHP-GTK applications can be started from the command line (or a batch file) with this syntax: <command>C:\php4\php -q C:\path\to\php-gtk\script.php</command> </simpara> </chapter> Index: php-gtk-doc/en/userguide/chapters/installwin32.xml +++ php-gtk-doc/en/userguide/chapters/installwin32.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="installwin32"> <title>Installing PHP-GTK Under Windows</title> <sect1 id="installwin32.intro"></sect1> <sect1 id="install.win32.binaries"> <title>Downloading PHP-GTK</title> <para> Download PHP-GTK &version.phpgtk; win32 binaries from <ulink url="&url.phpgtk;">&url.phpgtk;</ulink>. You may also want to check out the latest sources from php.net's CVS server. See <ulink url="&url.php.anoncvs;">&url.php.anoncvs;</ulink> for more information. </para> </sect1> <sect1 id="install.win32.binary.package-layout"> <title>Layout of the Binary Distribution</title> <para> The binary distribution of PHP-GTK contains this structure: <itemizedlist> <listitem> <para> <filename>\php4</filename> -> PHP dev and PHP-GTK &version.phpgtk; binary files </para> </listitem> <listitem> <simpara> <filename>\winnt</filename> -> the default php.ini file </simpara> </listitem> <listitem> <simpara> <filename>\winnt\system32</filename> -> GTK+ binaries used by the extension </simpara> </listitem> <listitem> <simpara> <filename>\test</filename> -> a few samples to demonstrate PHP-GTK usage </simpara> </listitem> <listitem> <simpara> <filename>README.TXT</filename> </simpara> </listitem> </itemizedlist> </para> </sect1> <sect1 id="install.win32.howto"> <title>How to install</title> <orderedlist> <listitem> <simpara> If this is a new installation you should create <filename>C:\php4</filename> and copy the files under <filename>\php4</filename> to this directory. If you have an existing PHP installation (for example, with Apache) or intend to have one, you will need to put your <filename>php.ini</filename> file in here too. The files that are in this folder by default are PHP or PHP-GTK-related and will all need to be updated from time to time. Note that <filename>C:\php4</filename> is the default directory and that if you install PHP-GTK anywhere else, you will need to specify the full path as your extension_dir in the copy of <filename>php.ini</filename> that is being used by PHP. </simpara> </listitem> <listitem> <simpara> Copy the contents of <filename>\winnt\system32</filename> to your system32 directory. On Windows NT and Windows 2000 that is <filename>C:\winnt\system32</filename>. On Windows 95/98 that can be <filename>C:\Windows\system</filename> or <filename>C:\Windows\system32</filename>, take your pick. This group of files is GTK-related and will not need to be updated until PHP-GTK2 is released. </simpara> </listitem> <listitem> <simpara> Copy the contents of <filename>\test</filename> to the location where you want to run your scripts (e.g. <filename>C:\php4\test</filename>). </simpara> </listitem> </orderedlist> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introgtk.xml +++ php-gtk-doc/en/userguide/chapters/introgtk.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introgtk"> <title>What is GTK+?</title> <sect1 id="gtk.intro"></sect1> <sect1 id="intro.whatis.gtk.history"> <title>A History of GTK+</title> <para> GTK+ was originally developed for <ulink url="&url.gimp;">GIMP</ulink>, the <ulink url="&url.gnu;">GNU</ulink> Image Manipulation Program. GTK+ stands for the GIMP Tool Kit. GTK+ has grown from these beginnings and is now used as a central part of <ulink url="&url.gnome;">Gnome</ulink>, the GNU Projects desktop environment. GTK+ has also been ported to BeOS and Win32, making it the perfect choice to use as the basis for a PHP extension, keeping PHP as cross-platform as possible and allowing the creation of windowed applications in PHP for Linux, BeOS and Windows. </para> </sect1> <sect1 id="intro.whatis.gtk.whatitdoes"> <title>What does GTK+ do?</title> <simpara> GTK+ is a set of libraries written in C to create graphical user interfaces. It has an object oriented architecture developed in three libraries: </simpara> <para> <itemizedlist> <listitem> <simpara> <emphasis>GLib</emphasis> </simpara> <simpara> provides various tools for use when programming with GTK+. </simpara> </listitem> <listitem> <simpara> <emphasis>GDK</emphasis> </simpara> <simpara> abstracts the low-level window drawing functions. </simpara> </listitem> <listitem> <simpara> <emphasis>GTK</emphasis> </simpara> <simpara> provides a set of widgets for use when creating your GUI. </simpara> </listitem> </itemizedlist> </para> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introphp.xml +++ php-gtk-doc/en/userguide/chapters/introphp.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introphp"> <title>What is PHP?</title> <sect1 id="php.intro"></sect1> <sect1 id="intro.whatis.php.history"> <title>A History of PHP</title> <simpara> <ulink url="&url.php;">PHP</ulink> started life and is still primarily used as a server-side HTML-embedded scripting language. </simpara> <simpara> PHP, known originally as Personal Home Pages, was first conceived in the autumn of 1994 by Rasmus Lerdorf. He wrote it as a way to track visitors to his online CV. The first version was released in early 1995, by which time Rasmus had found that by making the project open-source, people would fix his bugs. The first version was very straightforward and had a simple parser which recognised a few special macros and provided some of the utilities which were in common usage on homepages back then. </simpara> <simpara> The parser was rewritten in mid-1995 and renamed PHP/FI version 2. The "FI" in this version stood for the Form Interpreter which Rasmus had added to PHP to cope with the growing needs of webpages. mSQL support was also added at this time. PHP/FI underwent massive growth, and other people started to contribute code to it regularly. </simpara> <simpara> In mid-1997 Zeev Suraski and Andi Gutmans rewrote the main parser, and PHP shifted from being Rasmus' own to a more group orientated project. This formed the basis for PHP3, now named PHP: Hypertext Preprocessor - a recursive acronym. </simpara> <simpara> The latest version, PHP4, is another rewrite by Suraski and Gutmans and is based around the <ulink url="&url.zend;">Zend</ulink> engine. PHP now has over two hundred regular contributors working on various parts of the project. It has a massive amount of third party extension modules, supports all popular servers natively, and has inbuilt MySql and ODBC support. </simpara> <simpara> The latest statistics show that PHP is now in use on over 5.5 million domains, and has had a steady usage growth rate over the past year. It is far and away the single most popular Apache module; to give this some perspective, Apache currently holds nearly 60% of the market share of Internet webservers, whereas IIS servers (natively supporting ASP) hold less than half that proportion of the market. (Figures taken from <ulink url="&url.stats;">&url.stats;</ulink> March 2001.) </simpara> </sect1> <sect1 id="intro.whatis.php.whatdoes"> <title>What does PHP do?</title> <simpara> PHP is a general purpose language. It is normally put to use as an html-embedded scripting language for use on the web, but it can also be used as a shell scripting language or even as a language to write windowed applications, in the form of PHP-GTK. </simpara> <simpara> Due to PHP's open-source nature, if there is something you can't currently do in PHP itself there is nothing stopping you from writing a PHP module or extension in C code to extend its functionality so that you can do what you want from within PHP itself. This is made possible through the well-documented API which is available to all. </simpara> <para> PHP4 has two main parts to it: <itemizedlist> <listitem> <simpara> <emphasis>The Zend Engine</emphasis> </simpara> <simpara> is the part of the PHP package that keeps track of the requests, processes scripting files, and handles variables and resources. Its homepage can be found at <ulink url="&url.zend;">&url.zend;</ulink>. </simpara> </listitem> <listitem> <simpara> <emphasis>PHP</emphasis> </simpara> <simpara> implements 90% of the functionality seen by the end user. It provides a wide range of modules such as MySQL, ODBC and XML support. </simpara> </listitem> </itemizedlist> </para> </sect1> </chapter> Index: php-gtk-doc/en/userguide/chapters/introphpgtk.xml +++ php-gtk-doc/en/userguide/chapters/introphpgtk.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <chapter id="introphpgtk"> <title>What is PHP-GTK?</title> <simpara> PHP-GTK is a <ulink url="&url.php;">PHP</ulink> extension that enables you to write client-side, cross-platform GUI applications. This is the first extension for <ulink url="&url.php;">PHP</ulink> of its kind, and was written in part to prove that <ulink url="&url.php;">PHP</ulink> is a capable general-purpose language that is suited to more than just the web application environment. </simpara> <simpara> This extension will <emphasis>not</emphasis> allow you to display GTK+ applications in a web browser. It is intended for creating standalone GUI applications. </simpara> </chapter>