Пример #1
0
function setup_yes_no_dialog()
{
    $dialog = new GtkDialog();
    $dialog->vbox->pack_start($hbox = new GtkHBox());
    $hbox->pack_start(new GtkLabel('Phone Number: '), 0);
    $hbox->pack_start($phone = new GtkEntry(), 0);
    // note 1
    $dialog->vbox->pack_start($hbox2 = new GtkHBox());
    $button_ok = GtkButton::new_from_stock(Gtk::STOCK_OK);
    $button_ok->set_size_request(87, 33);
    $hbox2->pack_start(new GtkLabel());
    $hbox2->pack_start($button_ok, 0);
    $phone->connect('activate', 'on_enter', $button_ok);
    // note 2
    $button_ok->connect('clicked', 'on_ok_button', $dialog);
    $dialog->set_has_separator(false);
    $dialog->action_area->set_size_request(-1, 1);
    $dialog->show_all();
    $dialog->run();
    $dialog->destroy();
    global $response;
    $response->set_text($phone->get_text());
}
 /**
  * Método que seta o GtkEntry como calendario
  * 
  * @name set_calendar($value)
  * @param bool $value Valor booleano para habilitar ou não o calendario ao clicar no GtkEntry
  */
 public function set_calendar($value)
 {
     // Verifica se é calendario ou não
     if ($value) {
         // Faz as conexões do click do botão
         $this->__calendarConnection = parent::connect("button-release-event", array($this, "__openCalendar"));
     } else {
         // Desconecta o evento do click
         parent::disconnect($this->__calendarConnection);
     }
 }