OxyScripts.com
Menu spacer Home Tutorials Articles Code Forums irc.freenode.net #oxyscripts
Main (PHP)
Home Forums PHP News PHP Tutorials Articles PHP Code Snippets Contact Us Sysadmin Resources Books Template Shop
3rd Party Streams
SlashDot PHPDeveloper.org PHP.Net
Resources
PHP Manual MySQL Manual Smarty Manual PEAR Manual PHP-GTK Manual Symfony Manual
Code Snippets
Authentication Database Graphics HTTP Miscellaneous Time/Date
Affiliates
Scripts TutorialMan TutorialGuide CodingForums.com PHP Scripts Cheap Web Hosting Affordable Web Hosting Dreamweaver Templates

Search This Site :     PHP Function Reference :
 
GtkLayout Constructor

GtkLayout Constructor

GtkLayout ( GtkAdjustment hadjustment , GtkAdjustment vadjustment );

The following example is based on the GTK+ test file testgtk.c. Unix users will not need to use the callback function in order to achieve scrolling, but it shouldn't do any harm to run it as it stands. Win32 users will find that the labels are redrawn and the buttons are not, giving a somewhat psychedelic effect. To redraw both types of object under win32, replace the callback function with:

Example 21. Forcing a GtkLayout to redraw

<?php

dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));

/* callback that forces a redraw of simple child widgets */
function exposure($adj, $layout) {
  $layout->queue_draw();
}

/* set up a window and size it to be smaller than the intended layout */
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->set_title('Layout');
$window->set_usize(200, 200);
$window->connect_object('destroy', array('gtk', 'main_quit'));

/* create and add the scrolled window to the main window */
$scrolledwindow = &new GtkScrolledWindow();
$window->add($scrolledwindow);

/* create and add the layout widget to the scrolled window */
$layout = &new GtkLayout(null, null);
$scrolledwindow->add($layout);

/* set the layout to be bigger than the windows that contain it */
$x = gdk::screen_width();
$y = gdk::screen_height();
$layout->set_size($x, $y);

/* get the adjustment objects and connect them to the callback.  This
   part should not be necessary under *nix systems */
$hadj = $scrolledwindow->get_hadjustment();
$vadj = $scrolledwindow->get_vadjustment();
$hadj->connect('value-changed', 'exposure', $layout);
$vadj->connect('value-changed', 'exposure', $layout);

/* populate the layout with a mixture of buttons and labels */
for ($i=0 ; $i < round($y/100); $i++)  {
  for ($j=0 ; $j < round($x/100); $j++)  {
    $buf =sprintf('Button %d, %d', $i, $j);
    if (($i + $j) % 2) $button = &new GtkButton($buf);
    else $button = &new GtkLabel($buf);
    $layout->put($button, $j*100, $i*100);
  }
}

/* display everything and run the main loop */
$layout->show_all();
$window->show_all();

gtk::main();

?>

 
   Print this page

Top Sponsor
Symantec\'s Norton SystemWorks 2006
Sponsors
CA
Sponsors
AdWords Dominator 125*125
Advertisting

Affiliates
VertexTemplates PHPFreaks CodeWalkers StarGeek DevScripts CGI & PHP Scripts PHP CMS

Shopping Rebates   Sell It 4 You   Flash Page Counters   Get Insured
GPS Tracking Service   Charity Donate Info   Web Site Hosting   VOIP Service

Privacy Policy | Links | Site Map | Advertising

All content on OxyScripts.com is (©)2002-2007

 
Powered by Adrastea - Version 1.0.0. Copyright © Rune Solutions, 2004-2005