/**
  * @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"));
     $fix = new GtkFixed();
     // Cria o dialogo
     $file = Fabula::GtkFileChooserDialog("Abrir", $this->widgets['frmDemo'], FALSE);
     $file->set_select_multiple(TRUE);
     // Inicia o dialogo
     $files = $file->run();
     // Mostra no terminal os arquivos selecionados
     var_dump($files);
     // Mostra no terminal o diretorio
     echo $file->get_filepath();
     // Demo da utilização auto e filtro
     // Cria os filtros
     $filters = array(array("name" => "Videos AVI", "mime_type" => "video/x-msvideo"), array("name" => "Videos 3GP", "pattern" => "*.3gp"), array("name" => "Todos Videos", "mime_type" => "video/*"));
     $file = Fabula::GtkFileChooserDialog("Abrir", $this->widgets['frmDemo'], TRUE, Gtk::FILE_CHOOSER_ACTION_OPEN, $filters);
     // Mostra no terminal os arquivos selecionados
     var_dump($file->get_filenames());
     // Mostra no terminal o diretorio
     echo $file->get_filepath();
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($fix);
     $this->frmDemo_onload();
 }
示例#2
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();
 }
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(800, 350);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     // Cria o editor
     $source = Fabula::GtkSourceEditor();
     // Carrega o arquivo
     $source->load_file(__FILE__);
     // Risco para marcar a coluna
     $source->set_margin(80);
     $source->set_show_margin(TRUE);
     // Mostra o numero da linha
     $source->set_show_line_numbers(TRUE);
     // Habilita o uso de marcadores
     $source->set_show_line_markers(TRUE);
     // Tamanho do tab
     $source->set_tabs_width(8);
     // Ao quebrar a linha, manter posição ou voltar ao inicio da linha
     $source->set_auto_indent(TRUE);
     // Marcar a linha selecionada
     $source->set_highlight_current_line(TRUE);
     // Inicia a aplicação
     $this->widgets['frmDemo']->add(Fabula::GtkViewPort($source));
     $this->frmDemo_onload();
 }
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     $vbox = new GtkVBox();
     // Adiciona o menu
     $this->widgets['mnuBar'] = Fabula::GtkMenuBar();
     $vbox->pack_start($this->widgets['mnuBar'], FALSE, FALSE);
     // Arquivo
     $mnuFile = $this->widgets['mnuBar']->append_menu("_Arquivo");
     $mnuImportar = $mnuFile->append_menu("Importar");
     $mnuFile->append_item("Exportar");
     $mnuFile->append_separator();
     $mnuFile->append_item("Sair", array($this, "sair_onclick"));
     // Importar
     $mnuImportar->append_item("Arquivo 1");
     $mnuImportar->append_item("Arquivo 2");
     // Ajuda
     $mnuHelp = $this->widgets['mnuBar']->append_menu("Aju_da");
     $mnuHelp->append_item("Ajuda");
     $mnuHelp->append_item("Site na Web");
     $mnuHelp->append_separator();
     $mnuHelp->append_item("Sobre");
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(500, 500);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $this->widgets['frmDemo']->add($vbox);
     $vbox->pack_start(new GtkFixed(), TRUE, TRUE);
     // Inicia a aplicação
     $this->frmDemo_onload();
 }
 /**
  * Cria um novo menu
  * 
  * @name append_menu($title)
  * @param string $title Texto do item
  * @return GtkMenu
  */
 public function append_menu($title)
 {
     // Cria o item
     $menuitem = Fabula::GtkMenuItem($title);
     // Adiciona o item ao menubar
     $this->append($menuitem);
     // Cria o menu
     $menu = Fabula::GtkMenu();
     // Adiciona o menu ao item
     $menuitem->set_submenu($menu);
     // Retorna o menu
     return $menu;
 }
示例#6
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();
 }
示例#7
0
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria o splash
     $this->widgets['frmSplash'] = Fabula::GtkWindow();
     $GtkFixed = $this->widgets['frmSplash']->set_splash_image("GtkWindow.png");
     // Simula um processamento qualquer
     for ($i = 0; $i <= 900000; $i++) {
         Fabula::DoEvents();
         sleep(0.5);
     }
     // Esconde e destroy o splash
     $this->widgets['frmSplash']->hide();
     unset($this->widgets['frmSplash']);
     // Cria a janela principal
     $this->widgets['frmDemo'] = Fabula::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"));
     $fix = new GtkFixed();
     // Inicia a aplicação
     $this->widgets['frmDemo']->add($fix);
     $this->frmDemo_onload();
 }
 /**
  * @name __construct()
  * @return Demo
  */
 public function __construct()
 {
     // Cria a janela
     $this->widgets['frmDemo'] = new GtkWindow();
     $this->widgets['frmDemo']->set_size_request(280, 280);
     $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
     $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload"));
     $box = new GtkVBox();
     // Toolbar
     $this->widgets['tlbDemo'] = Fabula::GtkToolbar();
     $box->pack_start($this->widgets['tlbDemo'], FALSE, FALSE);
     // Adiciona o evento click
     $this->widgets['tlbDemo']->connect("clicked", array($this, "tlbDemo_onclick"));
     // Menu
     $menu = Fabula::GtkMenu();
     $menu->append_item("Link 1");
     $menu->append_item("Link 2");
     $menu->append_item("Link 3");
     $btnMySQL = $this->widgets['tlbDemo']->append_menu_from_stock($menu, Gtk::STOCK_ADD, NULL, "Novo");
     // Botão do stock
     $this->widgets['tlbDemo']->append_button_from_stock(Gtk::STOCK_OPEN, NULL, "Abrir");
     // Botão da imagem
     $this->widgets['tlbDemo']->append_button_from_image("GtkToolbar.png", "MySQL", "MySQL");
     // Toggle
     $this->widgets['tlbDemo']->append_toggle_from_stock(Gtk::STOCK_CONNECT, NULL, "Conectar");
     // Container
     $scale = new GtkVScale();
     $scale->set_range(0, 100);
     $scale->set_draw_value(FALSE);
     $scale->set_size_request(28, 150);
     $btnContainer = $this->widgets['tlbDemo']->append_container_from_stock($scale, "button-release-event", Gtk::STOCK_ABOUT, NULL, "Container");
     // Inicia a aplicação
     $box->pack_start(Fabula::GtkTextView());
     $this->widgets['frmDemo']->add($box);
     $this->frmDemo_onload();
 }
示例#9
0
 /**
  * Método click do btnPlay
  * 
  * @name btnPlay_click
  */
 public function btnPlay_click()
 {
     $ret = $this->widgets['vdoDemo']->play();
     // Verifica se iniciou
     if ($ret == FALSE) {
         Fabula::GtkMessageDialog($this->widgets['frmDemo'], Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, "O video precisa de um arquivo pra ser iniciado!", TRUE);
     }
 }
示例#10
0
 /**
  * Método do click do botão btnSelected
  * 
  * @name btnSelected_onClick
  */
 public function btnSelected_onClick()
 {
     // Busca o valor da primeira coluna
     $values = $this->widgets['trvDemo']->get_selected_values();
     // Mostra o alerta com os valores
     Fabula::Alert("Coluna 1: " . $values[0] . "\n" . "Coluna 2: " . $values[1] . "", "Alerta");
 }
示例#11
0
 /**
  * Método para salvar a imagem
  * 
  * @name btnSave_onclick()
  */
 public function btnSave_onclick()
 {
     $image = $this->widgets['webcam']->get_image();
     $result = Fabula::GtkFileChooserDialog("Abrir", $this->widgets['frmDemo'], TRUE, Gtk::FILE_CHOOSER_ACTION_SAVE);
     $path = $result->get_filenames();
     if ($path[0] !== FALSE) {
         copy($image, $path[0]);
     }
 }
 /**
  * Método que carrega o treeview
  * 
  * @name __load_trvDemo()
  */
 private function __load_trvDemo()
 {
     // Cria o objeto do tipo PDO
     $db = Fabula::ADOdbConnection("pdo");
     // Conecta ao banco
     $db->Connect("sqlite:ADOdbConnection.sqlite");
     // Executa a query
     $query = "SELECT * FROM mos_clients";
     $result = $db->Execute($query);
     // Percorre os registro
     while (!$result->EOF) {
         // Adiciona a linha
         $this->widgets['trvDemo']->add_row(array($result->fields[0], $result->fields['name']));
         // Move para o proximo registro
         $result->MoveNext();
     }
     /*
      * 
      * MySQL SAMPLE
      * 
      * // Cria o objeto do tipo PDO
      * $db = NewADOConnection("mysql");
      * 
      * // Conecta ao banco
      * $db->Connect("localhost", "root", "", "databasetest").
      * 
      * // Executa a query
      * $query = "SELECT * FROM mos_clients";
      * $result = $db->Execute($query);
      * 
      * // Percorre os registro
      * while (!$result->EOF)
      * {
      * 		// Adiciona a linha
      * 		$this->widgets['trvDemo']->add_row(
      *  		array($result->fields[0], $result->fields['name'])
      * 		);
      * 
      * 		// Move para o proximo registro
      * 		$result->MoveNext(); 
      * }
      * 
      */
 }
 /**
  * Método click do botão Demo 2
  * 
  * @name btnDemo2_onclick()
  */
 public function btnDemo2_onclick()
 {
     // Inicia o dialogo auto run
     $dialog = Fabula::GtkMessageDialog($this->widgets['frmDemo'], Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, "Este é um alerta simples!", TRUE);
     // Mostra a saida
     echo "ok\n";
 }
 /**
  * Inicia o video
  *
  * @name play
  * @return boolean
  */
 public function play()
 {
     // Verifica se o video ja foi iniciado
     if ($this->video_state == -1) {
         // Verifica se existe arquivo
         if (!file_exists($this->render_file)) {
             return FALSE;
         }
         // Verifica se o caminho do render existe
         if (!file_exists($this->render_path)) {
             echo "Não foi possivle encontrar " . $this->render_path;
             return FALSE;
         }
         // Adiciona os ultimos parametros
         $options = array_merge($this->render_options, array("-slave", "-quiet", "-menu", "-wid", $this->socket->get_id(), escapeshellarg($this->render_file)));
         // Cria o pipe
         $this->pipe = Fabula::PipeIO($this->render_path, $options);
         // Cria o callback do stdout
         $this->pipe->set_callback("stdout", array($this, "stdout"));
         // Cria o callback do final do video
         $this->pipe->set_callback("hup", array($this, "io_hup"));
         // Inicia o video
         $this->pipe->run();
         // Muda o estado do video
         $this->video_state = 1;
         // Adiciona o timeout
         $this->video_changed_timeout = Gtk::timeout_add(500, array($this, "video_changed"));
         // Retorna verdadeiro
         return TRUE;
     } else {
         // Retorna a falha
         return FALSE;
     }
 }