示例#1
0
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(400, 400);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $fix = new GtkFixed();
     // Cria o objeto webcam
     $this->widgets['webcam'] = Fabula::GtkWebCam();
     $this->widgets['webcam']->set_size(320, 240);
     $this->widgets['webcam']->set_quality(65);
     $this->widgets['webcam']->set_device("/dev/video0");
     // Inicia a captura
     $this->widgets['btnStartStop'] = new GtkButton("Iniciar");
     $this->widgets['btnStartStop']->connect_simple("clicked", array($this, "btnStartStop_onclick"));
     $fix->put($this->widgets['btnStartStop'], 8, 265);
     // Salva a imagem
     $this->widgets['btnSave'] = new GtkButton("Salvar");
     $this->widgets['btnSave']->connect_simple("clicked", array($this, "btnSave_onclick"));
     $fix->put($this->widgets['btnSave'], 8, 300);
     // Adiciona o frame da webcam
     $frame = new GtkFrame();
     $frame->add($this->widgets['webcam']);
     $frame->set_size_request(331, 251);
     $fix->put($frame, 8, 8);
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($fix);
     $this->frmDemo_onload();
 }