function on_interactive_dialog_clicked($button)
 {
     $dialog = new GtkDialog('Interactive Dialog', $this, 0, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, '_Non-stock button', Gtk::RESPONSE_CANCEL));
     $hbox = new GtkHBox(false, 8);
     $hbox->set_border_width(8);
     $dialog->vbox->pack_start($hbox, false, false, 0);
     $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG);
     $hbox->pack_start($stock, false, false, 0);
     $table = new GtkTable(2, 2);
     $table->set_row_spacings(4);
     $table->set_col_spacings(4);
     $hbox->pack_start($table, true, true, 0);
     $label = new GtkLabel('Entry _1');
     $label->set_use_underline(true);
     $table->attach($label, 0, 1, 0, 1);
     $local_entry1 = new GtkEntry();
     $local_entry1->set_text($this->entry1->get_text());
     $table->attach($local_entry1, 1, 2, 0, 1);
     $label->set_mnemonic_widget($local_entry1);
     $label = new GtkLabel('Entry _2');
     $label->set_use_underline(true);
     $table->attach($label, 0, 1, 1, 2);
     $local_entry2 = new GtkEntry();
     $local_entry2->set_text($this->entry2->get_text());
     $table->attach($local_entry2, 1, 2, 1, 2);
     $label->set_mnemonic_widget($local_entry2);
     $dialog->show_all();
     $response = $dialog->run();
     if ($response == Gtk::RESPONSE_OK) {
         $this->entry1->set_text($local_entry1->get_text());
         $this->entry2->set_text($local_entry2->get_text());
     }
     $dialog->destroy();
 }
Esempio n. 2
0
 function __create_box()
 {
     $vbox = new GtkVBox(false, 5);
     $vbox->set_border_width(5);
     $this->size_group = new GtkSizeGroup(gtk::SIZE_GROUP_HORIZONTAL);
     $frame = new GtkFrame('Color options');
     $vbox->pack_start($frame, true, true, 0);
     $table = new GtkTable(2, 2, false);
     $table->set_border_width(5);
     $table->set_row_spacings(5);
     $table->set_col_spacings(10);
     $frame->add($table);
     $color_options = array('Red', 'Green', 'Blue');
     $this->add_row($table, 0, '_Foreground', $color_options);
     $this->add_row($table, 1, '_Background', $color_options);
     $frame = new GtkFrame('Line options');
     $vbox->pack_start($frame, true, true, 0);
     $table = new GtkTable(2, 2, false);
     $table->set_border_width(5);
     $table->set_row_spacings(5);
     $table->set_col_spacings(10);
     $frame->add($table);
     $dash_options = array('Solid', 'Dashed', 'Dotted');
     $end_options = array('Square', 'Round', 'Arrow');
     $this->add_row($table, 0, '_Dashing', $dash_options);
     $this->add_row($table, 1, '_Line ends', $end_options);
     $check_button = new GtkCheckButton('_Enable grouping');
     $check_button->set_use_underline(true);
     $vbox->pack_start($check_button, false, false, 0);
     $check_button->set_active(true);
     $check_button->connect('toggled', array($this, 'on_toggle_grouping'));
     return $vbox;
 }