Website hosting and cheap domain registration services
  

 Home

GTK Classes
Prev GtkWindow Next

GtkWindow

Widget that provides windows for an application.

Object Hierarchy

GtkObject
`-- GtkWidget
       `-- GtkContainer
              `-- GtkBin
                     `-- GtkWindow

Description

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.

Constructor

GtkWindow ([ GtkWindowType type = GTK_WINDOW_TOPLEVEL ]);

-- Creates a new GtkWindow.

Methods

set_title()
  Sets window title.
set_wmclass()
  Sets window manager class and name.
set_policy()
  Sets window resizing policy. *deprecated in GTK2*
add_accel_group()
  Associates accelerator group with window.
remove_accel_group()
  Removes associated accelerator group from window.
set_position()
  Sets screen position of window.
activate_focus()
  Activates child that currently has focus.
activate_default()
  Activates child currently set as default.
set_transient_for()
  Sets window as transient for the given parent.
set_default_size()
  Sets default window size.
set_modal()
  Toggles window modality.
set_focus()
  Gives child widget focus.
set_default()
  Sets child widget as default.

Signals

"set-focus"
  Emitted when set_focus() is called.


Prev Home Next
GtkWidget::parent Up GtkWindow Constructor

 

  

Network sites:

Domain registration - Domain registration and domain name transfer Cheap Domain Registrar - Buy domain name from $5.95/year 

 
 
 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://gtk.php.net/docs.php