Ejemplo n.º 1
0
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(600, 300);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $box = new GtkVBox();
     // Adiciona o textview do resultado
     $this->widgets['txtResult'] = Fabula::GtkTextView();
     $box->pack_start(Fabula::GtkViewPort($this->widgets['txtResult']), TRUE, TRUE);
     // Adiciona o textview dos comandos
     $this->widgets['txtCommands'] = Fabula::GtkEntry();
     $box->pack_start($this->widgets['txtCommands'], FALSE, FALSE);
     $this->widgets['txtCommands']->grab_focus();
     // Connecta o entry de comandos para capturar o botão enter
     $this->widgets['txtCommands']->connect("key-press-event", array($this, "txtCommands_onkeypress"));
     // Inicia o pipe
     $this->pipe = Fabula::PipeIO("/bin/sh", array());
     $this->pipe->set_callback("stdout", array($this, "on_pipe_io_stdout"));
     $this->pipe->run();
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($box);
     $this->frmDemo_onload();
 }
Ejemplo n.º 2
0
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(180, 180);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $fix = new GtkFixed();
     // Calendar
     $fix->put(Fabula::GtkLabel("Calendario"), 8, 8);
     $this->widgets['txtCalendar'] = Fabula::GtkEntry();
     $this->widgets['txtCalendar']->set_calendar(TRUE);
     $fix->put($this->widgets['txtCalendar'], 8, 24);
     // Mask
     $fix->put(Fabula::GtkLabel("Mascara"), 8, 52);
     $this->widgets['txtCalendar'] = Fabula::GtkEntry();
     $this->widgets['txtCalendar']->set_mask("(99) 9999-9999");
     $fix->put($this->widgets['txtCalendar'], 8, 68);
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($fix);
     $this->frmDemo_onload();
 }