GtkWindow is the widget providing the windows
for an application. There are three different types, defined by the
programmer during construction - toplevel, dialog or popup.
Toplevel windows contain the standard window decorations
minimize, maximize and
close. Of these, the first two exhibit the expected
default behaviour; this is pre-set within the GDK source, and cannot
currently be altered from within PHP-GTK. The close
button is not pre-set in same way, in that its emission of the
"destroy" signal can be
overridden by connecting a function to the window's
"delete-event" signal and
having that function return true. Note that the
main window's "destroy" signal
should be connected, directly or otherwise, to a function that will quit
the GTK main loop.
A dialog window is not the same thing as a
GtkDialog, but is simply a normal toplevel
window with the maximize function disabled. Both
dialog and popup windows are designed to be used when a message to the
user requires a response, and should be used in conjunction with the
set_transient_for() and
set_modal() methods.
A popup window lacks any window decoration, so needs an
alternative means of closure. This could triggered by a timer, an
event, or a widget capable of user interaction.
Note that both the window decorations and the associated functions
described above are provided by the underlying system's window manager,
and could possibly vary or be absent.
A GtkWindow object is derived from
GtkBin, and can therefore only have one child
widget added to it directly. To add more children it is necessary to
make that child a container that can hold mulitple children. See
GtkBox.
There is no clean way to maximize a window in php-gtk 1. You only can use the following workaround:
$window->set_usize(gdk::screen_width(),gdk::screen_height());
|
This leads to the problem that the size of task bars are not
respected; so you shouldn't do that. For Windows you can use an API call:
dl("php_w32api.dll");
$api =& new win32;
define('SW_MAXIMIZE',3);
define('SW_MINIMIZE',6);
//register windows functions
$api->registerfunction("long GetLastError Alias GetError () From kernel32.dll");
$api->registerfunction("long FindWindow (string &ClassName, string &WindowName) From user32.dll");
$api->registerfunction("long ShowWindow (long hWnd, long nCmdShow) From user32.dll");
$window =& new GtkWindow();
$window->set_title('PHP Test');
$window->show();
$class_string = 'gdkWindowToplevel';
$title_string = 'PHP Test';
if(!$sw = $api->FindWindow($class_string,$title_string)){
$error = $api->getError();
echo ' Oops FindWindow error: '.$error."\n";
}else{
$api->ShowWindow($sw,SW_MAXIMIZE);
}
|
You still have to take care only to call these functions when
the php-gtk application is running on Windows.
If you need to set the window cursor, you should have look at GdkWindow.