<?php
// Create a GtkNotebook with several pages out of order.
$notebook =& new GtkNotebook;
for ($i = 0; $i < 6; $i++) {
$frame =& new GtkFrame('Page ' . $i);
$frame->set_data('intended_position', $i);
// Add the pages out of order.
if ($i % 2) {
$notebook->prepend_page($frame, new GtkLabel('Tab ' . $i));
}
}
// Reorder the pages.
$pages =& $notebook->children();
// Can't use foreach because it makes a copy.
for ($page =& reset($pages); $page !== false; $page =& next($pages)) {
$notebook->reorder_child($page, $page->get_data('intended_position');
}
?>
|