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();
 }
Exemple #2
0
 /**
  * Show the table and all aggregated rows
  */
 public function show()
 {
     if ($this->showed === FALSE) {
         $i = 0;
         if ($this->rows) {
             foreach ($this->rows as $row) {
                 $c = 0;
                 if ($row->getCells()) {
                     foreach ($row->getCells() as $column) {
                         $properties = $column->getProperties();
                         $properties['colspan'] = isset($properties['colspan']) ? $properties['colspan'] - 1 : 0;
                         $hbox = new GtkHBox();
                         if (isset($properties['width'])) {
                             $hbox->set_size_request($properties['width'], -1);
                         }
                         $hbox->set_border_width(1);
                         $hbox->pack_start($column->getContent(), false, false);
                         $column->getContent()->show();
                         //$hbox->pack_start(new GtkHBox, true, true);
                         parent::attach($hbox, $c, $c + 1 + $properties['colspan'], $i, $i + 1, GTK::FILL, 0, 0, 0);
                         $c++;
                     }
                 }
                 $i++;
             }
         }
         $this->showed = TRUE;
     }
     parent::show();
 }
Exemple #3
0
 function on_delete_confirm()
 {
     $dialog = new GtkDialog('CAUTION!', $this, 0, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, Gtk::STOCK_CANCEL, Gtk::RESPONSE_CANCEL));
     $hbox = new GtkHBox(false, 8);
     $hbox->set_border_width(8);
     $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG);
     $confirm_text1 = new GtkLabel('Are you sure you want to proceed ?');
     $confirm_text2 = new GtkLabel('Note: This process is irreversible.');
     $confirm_text3 = new GtkLabel($this->selected_file);
     $confirm_text3->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#ff0000"));
     $vbox2 = new GtkVBox();
     $vbox2->pack_start($confirm_text1);
     $vbox2->pack_start($confirm_text2);
     $vbox2->pack_start($confirm_text3);
     $hbox->pack_start($stock, false, false, 0);
     $hbox->pack_start($vbox2, false, false, 0);
     $dialog->vbox->pack_start($hbox, false, false, 0);
     $dialog->show_all();
     $response = $dialog->run();
     if ($response == Gtk::RESPONSE_OK) {
         $resp = $this->delete_file();
         if ($resp) {
             $this->on_delete_successful();
             $this->selected_file = "";
             $this->file_label->set_text($this->file_label_default);
         } else {
             $this->selected_file = "";
             $this->file_label->set_text('Unable to delete the specified file.');
         }
     }
     $dialog->destroy();
 }
 /**
  * Append an item to the menu
  */
 public function append($item, $submenu)
 {
     $button = new GtkToggleButton();
     if (OS == 'WIN') {
         $hbox = new GtkHBox();
         $hbox->set_border_width(4);
         $hbox->pack_start(new GtkLabel($item->getLabel()));
         $button->add($hbox);
     } else {
         $button->set_label($item->getLabel());
     }
     $handler = $button->connect('clicked', array($this, 'onExecute'), $item, $submenu);
     $button->set_data('handler', $handler);
     $this->pack_start($button, FALSE, FALSE);
 }
 function __create_box()
 {
     $box = new GtkVBox();
     $frame_horiz = new GtkFrame("Horizontal Button Boxes");
     $box->pack_start($frame_horiz, true, true, 10);
     $vbox = new GtkVBox();
     $vbox->set_border_width(10);
     $frame_horiz->add($vbox);
     $vbox->pack_start($this->create_framedbox(true, "Spread", 40, Gtk::BUTTONBOX_SPREAD));
     $vbox->pack_start($this->create_framedbox(true, "Edge", 40, Gtk::BUTTONBOX_EDGE));
     $vbox->pack_start($this->create_framedbox(true, "Start", 40, Gtk::BUTTONBOX_START));
     $vbox->pack_start($this->create_framedbox(true, "End", 40, Gtk::BUTTONBOX_END));
     $frame_vert = new GtkFrame("Vertical Button Boxes");
     $box->pack_start($frame_vert, true, true, 10);
     $hbox = new GtkHBox();
     $hbox->set_border_width(10);
     $frame_vert->add($hbox);
     $hbox->pack_start($this->create_framedbox(false, "Spread", 40, Gtk::BUTTONBOX_SPREAD));
     $hbox->pack_start($this->create_framedbox(false, "Edge", 40, Gtk::BUTTONBOX_EDGE));
     $hbox->pack_start($this->create_framedbox(false, "Start", 40, Gtk::BUTTONBOX_START));
     $hbox->pack_start($this->create_framedbox(false, "End", 40, Gtk::BUTTONBOX_END));
     return $box;
 }