Ejemplo n.º 1
0
function alert($msg)
{
    // note 1
    $dialog = new GtkDialog('Alert', null, Gtk::DIALOG_MODAL);
    // create a new dialog
    $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
    $top_area = $dialog->vbox;
    // note 2
    $top_area->pack_start($hbox = new GtkHBox());
    // note 3
    $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG);
    // note 4
    $hbox->pack_start($stock, 0, 0);
    // stuff in the icon
    $hbox->pack_start(new GtkLabel($msg));
    // and the msg
    $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK);
    // note 5
    $dialog->set_has_separator(false);
    // don't display the set_has_separator
    $dialog->show_all();
    // show the dialog
    $dialog->run();
    // the dialog in action
    $dialog->destroy();
    // done. close the dialog box.
}
Ejemplo n.º 2
0
 function GetDate()
 {
     $dialog = new GtkDialog('Get Date', null, Gtk::DIALOG_MODAL);
     $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $top_area = $dialog->vbox;
     //setlocale(LC_ALL, 'english');
     $top_area->pack_start($hbox = new GtkHBox());
     // set up the calendar
     $this->calendar = new GtkCalendar();
     $top_area->pack_start($this->calendar, 0, 0);
     // add an OK button
     $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK);
     $this->dialog = $dialog;
     $dialog->set_has_separator(false);
     $dialog->show_all();
     $dialog->run();
     $dialog->destroy();
 }
Ejemplo n.º 3
0
function alert($msg)
{
    $dialog = new GtkDialog('Alert', null, Gtk::DIALOG_MODAL);
    $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
    $top_area = $dialog->vbox;
    $top_area->pack_start($hbox = new GtkHBox());
    $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG);
    $hbox->pack_start($stock, 0, 0);
    $hbox->pack_start(new GtkLabel($msg));
    $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK);
    $dialog->set_has_separator(false);
    $dialog->show_all();
    $dialog->run();
    $dialog->destroy();
}
Ejemplo n.º 4
0
<?php

$dialog = new GtkDialog();
$dialog->connect_simple('destroy', array('Gtk', 'main_quit'));
$dialog->set_size_request(400, 150);
// display title
$title = new GtkLabel("Set Default Button - Part 1\n" . "using set_default_response");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 40);
$title->set_justify(Gtk::JUSTIFY_CENTER);
$alignment = new GtkAlignment(0.5, 0, 0, 0);
$alignment->add($title);
$dialog->vbox->pack_start($alignment, 0, 0);
$dialog->vbox->pack_start(new GtkLabel(), 0, 0);
$dialog->add_buttons(array('button 1', 100, 'button 2', 101, 'button 3', 102));
$dialog->set_default_response(101);
// note 2
$dialog->set_has_separator(0);
$dialog->show_all();
$response = $dialog->run();
echo "response = {$response}\n";