Пример #1
0
function delete_event()
{
    return false;
}
/*
 * Create a new top-level window and connect the signals to the appropriate
 * functions. Note that all constructors must be assigned by reference.
 */
$window = new GtkWindow();
$window->connect_object('destroy', array('gtk', 'main_quit'));
$window->connect('delete-event', 'delete_event');
/*
 * Create a button and connect its 'clicked' signal to destroy() function.
 */
$button = new GtkButton('Close');
$button->connect_object('clicked', array('gtk', 'main_quit'));
/*
 * Create a vertical layout box.
 */
$box = new GtkVBox(false, 10);
$box->set_border_width(10);
/*
 * Create a list widget and populate it with month names.
 */
$list = new GtkList();
$list->set_selection_mode(GTK_SELECTION_BROWSE);
foreach (range(1, 12) as $month_num) {
    $items[] = new GtkListItem(strftime('%B', mktime(0, 0, 0, $month_num)));
}
$list->append_items($items);
/*
Пример #2
0
 /**
  * Create the suite entry and related widgets.
  *
  * The suite entry has some supporting components such as a
  * label, the show passed check box and the run button. All
  * of these items are packed into two nested boxes.
  *
  * @access private
  * @param  none
  * @return &object A box that contains all of the suite entry pieces.
  */
 function &_createSuiteEntry()
 {
     // Create the outermost box.
     $outerBox = new GtkVBox();
     // Create the suite label, box, and field.
     $suiteLabel = new GtkLabel('Test class name:');
     $suiteBox = new GtkHBox();
     $this->suiteField = new GtkEntry();
     $this->suiteField->set_text($suiteName != NULL ? $suiteName : '');
     // Create the button the user will use to start the test.
     $runButton = new GtkButton('Run');
     $runButton->connect_object('clicked', array(&$this, 'run'));
     // Create the check box that lets the user show only failures.
     $this->showPassed = new GtkCheckButton('Show passed tests');
     // Add the components to their respective boxes.
     $suiteLabel->set_alignment(0, 0);
     $outerBox->pack_start($suiteLabel);
     $outerBox->pack_start($suiteBox);
     $outerBox->pack_start($this->showPassed);
     $suiteBox->pack_start($this->suiteField);
     $suiteBox->pack_start($runButton);
     return $outerBox;
 }