예제 #1
0
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(200, 200);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $box = new GtkVBox();
     // Cria o video
     $this->widgets['vdoDemo'] = Fabula::GtkVideo();
     $this->widgets['vdoDemo']->set_auto_scalable(TRUE);
     $this->widgets['vdoDemo']->connect("button-press-event", array($this, "vdoDemo_button_pressed"));
     $this->widgets['vdoDemo']->connect("video-changed", array($this, "vdoDemo_onchange"));
     $this->widgets['vdoDemo']->connect("video-closed", array($this, "vdoDemo_onclose"));
     $box->pack_start($this->widgets['vdoDemo'], TRUE, TRUE);
     // Cria o progressbar
     $this->widgets['sclDemo'] = GtkHScale::new_with_range(0, 100, 1);
     $this->widgets['sclDemo']->set_draw_value(FALSE);
     $this->widgets['sclDemo']->connect("button-release-event", array($this, "sclDemo_button_pressed"));
     $box->pack_start($this->widgets['sclDemo'], FALSE, FALSE);
     // Cria o box dos botões
     $this->widgets['hbox'] = new GtkHBox();
     $box->pack_start($this->widgets['hbox'], FALSE, FALSE);
     // Cria o label do tempo
     $this->widgets['lblTime'] = Fabula::GtkLabel("");
     $this->widgets['lblTime']->set_alignment(1, 0.5);
     $this->widgets['hbox']->pack_end($this->widgets['lblTime']);
     // Adiciona os botões
     $this->widgets['btnOpen'] = Fabula::GtkButton(NULL, array($this, "btnOpen_click"));
     $this->widgets['btnOpen']->set_image(GtkImage::new_from_stock(Gtk::STOCK_OPEN, Gtk::ICON_SIZE_BUTTON));
     $this->widgets['hbox']->pack_start($this->widgets['btnOpen'], FALSE, FALSE);
     $this->widgets['btnPlay'] = Fabula::GtkButton(NULL, array($this, "btnPlay_click"));
     $this->widgets['btnPlay']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_PLAY, Gtk::ICON_SIZE_BUTTON));
     $this->widgets['hbox']->pack_start($this->widgets['btnPlay'], FALSE, FALSE);
     $this->widgets['btnPause'] = Fabula::GtkButton(NULL, array($this, "btnPause_click"));
     $this->widgets['btnPause']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_PAUSE, Gtk::ICON_SIZE_BUTTON));
     $this->widgets['hbox']->pack_start($this->widgets['btnPause'], FALSE, FALSE);
     $this->widgets['btnStop'] = Fabula::GtkButton(NULL, array($this, "btnStop_click"));
     $this->widgets['btnStop']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_STOP, Gtk::ICON_SIZE_BUTTON));
     $this->widgets['hbox']->pack_start($this->widgets['btnStop'], FALSE, FALSE);
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($box);
     $this->frmDemo_onload();
 }