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(); }
/** * Define the widget's content * @param $value widget's content */ public function setValue($value) { parent::set_text($value); }
} /** * main application section */ //Create the login window $wnd = new GtkWindow(); $wnd->set_title('gource-php-gtk'); //Close the main loop when the window is destroyed $wnd->connect_simple('destroy', array('gtk', 'main_quit')); //Set up all the widgets we need //The second parameter says that the underscore should be parsed as underline //path $lblRepositoryPath = new GtkLabel('Repository Path', true); $txtRepositoryPath = new GtkEntry(); $settings = Settings::load(); $txtRepositoryPath->set_text($settings['last_repo_path']); //options //hide $chkOptionHideFiles = new GtkCheckButton('Hide Files', true); $chkOptionHideFilenames = new GtkCheckButton('Hide File Names', true); $chkOptionHideDirnames = new GtkCheckButton('Hide Directories', true); $chkOptionHideDates = new GtkCheckButton('Hide Dates', true); $chkOptionHideProgress = new GtkCheckButton('Hide Progress', true); $chkOptionHideBloom = new GtkCheckButton('Hide Bloom', true); $chkOptionHideMouse = new GtkCheckButton('Hide Mouse', true); $chkOptionHideTree = new GtkCheckButton('Hide Tree', true); $chkOptionHideUsers = new GtkCheckButton('Hide Users', true); $chkOptionHideUsernames = new GtkCheckButton('Hide Usernames', true); //general $chkOptionFullscreen = new GtkCheckButton('Fullscreen', true); $chkOptionMultiSampling = new GtkCheckButton('Multi Sampling', true);
/** * Changes the Entry contents without fire 'changed' signal * @param string $text the new text * @ignore-autocomplete on */ public function Set($text) { // turn off the signal parent::disconnect($this->handler); parent::set_text($text); // cursor to the end parent::select_region(-1, -1); // turn on the signal $this->handler = parent::connect_after('changed', array($this, 'onChanged')); }
/** * Método que seta o valor no campo * * @name __setMask($text) * @access private * @author Pablo Dall'Oglio * @param string $text Texto da mascará a ser setado */ public function __setMask($text) { // Desconectando o sinal changed parent::disconnect($this->__maskConnection); // Seta o texto do entry parent::set_text($text); // Posiciona o cursor no final do texto parent::select_region(-1, -1); // Reconecta changed $this->__maskConnection = parent::connect_after("changed", array($this, "__changeMask")); }