Ejemplo n.º 1
0
 /**
  * Constructor method
  * @param $label Frame label
  */
 public function __construct($width = NULL, $height = NULL)
 {
     parent::__construct();
     if ($width and $height) {
         parent::set_size_request($width, $height);
     }
 }
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(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();
 }
Ejemplo n.º 3
0
 /**
  * Define the PageNavigation's width
  * @param $width PageNavigation's width
  */
 public function setWidth($width)
 {
     $this->width = $width;
     parent::set_size_request($this->width, -1);
 }
Ejemplo n.º 4
0
$window = new GtkWindow();
$window->set_size_request(400, 300);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$vbox2 = new GtkVBox();
// note 1
$vbox2->pack_start(new GtkLabel("This frame of size 200x200"));
$vbox2->pack_start(new GtkLabel("will always stay stay centered"));
$vbox2->pack_start(new GtkLabel("no matter how you resize the app"));
$eventbox = new GtkEventBox();
// note 2
$eventbox->add($vbox2);
$eventbox->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#CCFF99"));
$frame_200_200 = new GtkFrame();
// note 3
$frame_200_200->set_size_request(200, 200);
$frame_200_200->add($eventbox);
$hbox = new GtkHBox();
// note 4
$hbox->pack_start(new GtkHBox());
$hbox->pack_start($frame_200_200, 0);
$hbox->pack_start(new GtkHBox());
$vbox = new GtkVBox();
// note 5
$vbox->pack_start(new GtkHBox());
$vbox->pack_start($hbox, 0);
$vbox->pack_start(new GtkHBox());
$window->add($vbox);
// note 6
$window->show_all();
Gtk::main();