Esempio n. 1
0
 function __construct($required = false, $duplicated = false, $table = null, $field = null)
 {
     parent::__construct($required, $duplicated, $table, $field);
     $this->label->set_text(' Data: ');
     $this->entry->set_editable(false);
     $this->entry->set_max_length(10);
     /* max 99/99/9999 */
     $this->entry->set_width_chars(10);
     $this->entry->connect('changed', array($this, 'data_changed'));
     $this->eventbox->add($button = new GtkButton());
     $button->add(GtkImage::new_from_stock(Gtk::STOCK_PROPERTIES, Gtk::ICON_SIZE_BUTTON));
     $button->connect('clicked', array($this, 'prop_clicked'), $this->entry);
     $this->extra_key = 47;
     /* / */
 }
 /**
  * Cria um botão por uma imagem
  *
  * @name newButtonFromImage($image, $label=NULL)
  * @param $image (string): String com caminho do arquivo de imagem
  * @param $label (string): String com o nome do botão
  * @return $button (GtkButton): Retorna o botão criado
  * @deprecated
  */
 public function newButtonFromImage($image, $label = NULL)
 {
     // Criação do botão
     $button = new GtkButton();
     // Cria o container interno do botão
     $button_hbox = new GtkVBox();
     $button->add($button_hbox);
     // Carrega a imagem
     $img = GtkImage::new_from_file($image);
     $button_hbox->pack_start($img, 0, 0);
     // Verifica se possui label
     if ($label != NULL) {
         $button_hbox->pack_start(new GtkLabel($label), 0, 0);
     }
     // Retorna o botão
     return $button;
 }
Esempio n. 3
0
 function preenche_lista()
 {
     $db = new Database($this->Owner, true);
     if (!$db->link) {
         return;
     }
     // Secoes
     $sql = 'SELECT * FROM Tb_Secoes';
     if (!$db->multi_query($sql)) {
         return;
     }
     while ($line = $db->line()) {
         $CodSecao = $line['Cod_S_Secao'];
         $Imagem = $line['Imagem'];
         $Nome = $line['Nome'];
         $this->lista->pack_start($ptr = $this->secoes[$CodSecao] = new GtkExpander(''), false);
         $ptr->add(new GtkVBox());
         $ptr->set_label_widget($hbox = new GtkHBox());
         $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $Imagem), false);
         $hbox->pack_start($label = new GtkLabel());
         $label->set_markup('<b>' . $Nome . '</b>');
         $ptr->show_all();
     }
     // Menus
     $sql = 'SELECT * FROM Tb_Menus';
     if (!$db->multi_query($sql)) {
         return;
     }
     while ($line = $db->line()) {
         $CodMenu = $line['Cod_S_Menu'];
         $CodSecao = $line['Cod_S_Secao'];
         $Imagem = $line['Imagem'];
         $Nome = $line['Nome'];
         $Permissao = $line['Permissao'];
         $Classe = $line['Classe'];
         $this->secoes[$CodSecao]->child->pack_start($button = new GtkButton());
         $button->set_relief(Gtk::RELIEF_NONE);
         $button->add($hbox = new GtkHBox());
         $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $Imagem), false);
         $hbox->pack_start(new GtkLabel(' ' . $Nome . ' '));
         $button->show_all();
         $button->connect('clicked', array($this, 'button_clicked'), array($Permissao, $Classe));
     }
     // Ajuda
     $this->lista->pack_start($ptr = new GtkExpander(''), false);
     $ptr->set_label_widget($hbox = new GtkHBox());
     $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'ajuda.png'), false);
     $hbox->pack_start($label = new GtkLabel());
     $label->set_markup('<b>Ajuda</b>');
     $ptr->show_all();
     // Sobre
     $ptr->add($button = new GtkButton());
     $button->set_relief(Gtk::RELIEF_NONE);
     $button->add($hbox = new GtkHBox());
     $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'sobre.png'), false);
     $hbox->pack_start(new GtkLabel('Sobre'));
     $ptr->show_all();
     $button->connect('clicked', array($this, 'sobre_clicked'));
     return true;
 }
Esempio n. 4
0
 function __construct()
 {
     parent::__construct(latin1('Lista de Preços'), 'lista_precos.png');
     $this->tipo = $tipo;
     $this->CodId = $CodId;
     // barra de ferramentas
     $this->pack_start($toolbar = new TToolbar(), false);
     $this->incluir = $toolbar->append_stock('gtk-add', 0, array($this, 'novo_clicked'));
     $this->alterar = $toolbar->append_stock('gtk-edit', 1, array($this, 'editar_clicked'));
     $this->excluir = $toolbar->append_stock('gtk-delete', 2, array($this, 'excluir_clicked'));
     /*
     if ($tipo == 'n')
     {
     }
     else
     {
     	switch ($tipo)
     	{
     	case 'cc': // Cotacao de Compra
     	{
     	    $lbl_anexo = 'na Cotacao de Compra';
     	    break;
     	}
     	case 'cv': // Cotacao de Venda
     	{
     	    $lbl_anexo = 'na Cotacao de Venda';
     	    break;
     	}
     	case 'pc': // Pedido de Compra
     	{
     	    $lbl_anexo = 'no Pedido de Compra';
     	    break;
     	}
     	case 'pv': // Pedido de Venda
     	{
     	    $lbl_anexo = 'no Pedido de Venda';
     	    break;
     	}
     	};
     	
     	$hbox->pack_start ($eventbox = new GtkEventBox);
     	$eventbox->add ($label = new GtkLabel);
     	$label->set_markup ('<b>Anexar os itens selecionados ' . $lbl_anexo . ': ' . $CodId . '</b>');
     }
     
     if ($tipo == 'n' || $tipo == 'cc')
     {
     	$hbox->pack_start ($this->cot_compra = new GtkButton ('Cot. Compra'), false);
     	$this->cot_compra->set_image (GtkImage::new_from_file (XMImage ('cotacao_compra.png')));
     	$this->cot_compra->connect ('clicked', array ($this, 'cotped_compra_venda_clicked'), 'cc');
     	// $this->incluir->add_accelerator ('clicked', $this->accel_group, Gdk::KEY_Insert, 0, 0);
     }
     
     if ($tipo == 'n' || $tipo == 'cv')
     {
     	$hbox->pack_start ($this->cot_venda = new GtkButton ('Cot. Venda'), false);
     	$this->cot_venda->set_image (GtkImage::new_from_file (XMImage ('cotacao_venda.png')));
     	$this->cot_venda->connect ('clicked', array ($this, 'cotped_compra_venda_clicked'), 'cv');
     	// $this->incluir->add_accelerator ('clicked', $this->accel_group, Gdk::KEY_Insert, 0, 0);
     }
     
     if ($tipo == 'n' || $tipo == 'pc')
     {
     	$hbox->pack_start ($this->ped_compra = new GtkButton ('Ped. Compra'), false);
     	$this->ped_compra->set_image (GtkImage::new_from_file (XMImage ('pedido_compra.png')));
     	$this->ped_compra->connect ('clicked', array ($this, 'cotped_compra_venda_clicked'), 'pc');
     	// $this->incluir->add_accelerator ('clicked', $this->accel_group, Gdk::KEY_Insert, 0, 0);
     }
     
     if ($tipo == 'n' || $tipo == 'pv')
     {
     	$hbox->pack_start ($this->ped_venda = new GtkButton ('Ped. Venda'), false);
     	$this->ped_venda->set_image (GtkImage::new_from_file (XMImage ('pedido_venda.png')));
     	$this->ped_venda->connect ('clicked', array ($this, 'cotped_compra_venda_clicked'), 'pv');
     	// $this->incluir->add_accelerator ('clicked', $this->accel_group, Gdk::KEY_Insert, 0, 0);
     }
     
     if ($tipo == 'n')
     {
     	$hbox->pack_start ($this->imprimir = GtkButton::new_from_stock ('gtk-print-preview'), false);
     	$this->imprimir->connect ('clicked', array ($this, 'imprimir_clicked'));
     	$this->imprimir->add_accelerator ('clicked', $this->accel_group, Gdk::KEY_p, Gdk::CONTROL_MASK, 0);
     }
     */
     // filtro
     $this->pack_start($this->filtro = new TFiltroListaPrecos(array($this, 'pega_dados')), false);
     // grid
     $this->pack_start($this->grid = new TGridListaPrecos($this));
     return;
     // cli / for
     $this->pack_start($hbox = new GtkHBox(), false);
     $hbox->pack_start($cli_for = new GtkButton(), false);
     $cli_for->add(GtkImage::new_from_stock('gtk-orientation-portrait', Gtk::ICON_SIZE_BUTTON));
     $cli_for->connect('clicked', array($this, 'cli_for_clicked'));
     $hbox->pack_start($this->box_cli_for = new GtkHBox());
     $cli_for->clicked();
 }