示例#1
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();
 }