GTK constants

GTK+ uses a lot of constants. In PHP-GTK 1, they were defined in global scope and you could access them via

echo GTK_WIN_POS_CENTER;
If you execute that code with PHP-GTK 2, the following error will be thrown:

PHP Notice:  Use of undefined constant GTK_WIN_POS_CENTER -
assumed 'GTK_WIN_POS_CENTER' in /path/to/file.php on line 23

The problem is that the original value is no longer used (GTK_WIN_POS_CENTER resolves to the integer 1 in PHP-GTK 1). The string literal itself, "GTK_WIN_POS_CENTER", is all PHP-GTK 2 sees - which is likely to break your code.

Static class constants are supported in PHP 5, so the decision was made not to pollute the global namespace with PHP-GTK constants any more. They are defined in the classes Gtk, Gdk and others.

In short, all you have to do (in most cases) is replace the first underscore _ with two colons: so that GTK_WIN_POS_CENTER under PHP-GTK 1 becomes Gtk::WIN_POS_CENTER under PHP-GTK 2.

Also, note the new coding style. Only the first letter should be uppercased in Gtk, Gdk, Pango and Atk constants throughout the officially distributed PHP-GTK 2 documentation and code, reflecting their new status as class constants rather than globals.