function add_row($table, $row, $label_text, $options) { $label = new GtkLabel($label_text); $label->set_use_underline(true); $label->set_alignment(0, 1); $table->attach($label, 0, 1, $row, $row + 1, Gtk::EXPAND + Gtk::FILL, 0, 0, 0); $option_menu = $this->create_option_menu($options); $label->set_mnemonic_widget($option_menu); $this->size_group->add_widget($option_menu); $table->attach($option_menu, 1, 2, $row, $row + 1, 0, 0, 0, 0); }
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(); }