Ejemplo n.º 1
0
 function __construct($Parent, $operacao = 'i', $CodPerfil = null)
 {
     parent::__construct($operacao == 'i' ? 'Perfis - Incluir' : 'Perfis - Alterar', 800, 600, 'perfis.png');
     $this->Parent = $Parent;
     $this->operacao = $operacao;
     $this->CodPerfil = $CodPerfil;
     $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Perfil';
     $GLOBALS['XMONEY_FIELD_ID'] = $CodPerfil ? $CodPerfil : -1;
     // Id
     $this->pack_start($hbox = new GtkHBox(), false);
     if ($operacao == 'a') {
         $hbox->pack_start($id = new GtkLabel(), false);
         $id->set_markup(' Id.: <b>' . $CodPerfil . '</b>');
     }
     // nome
     $this->pack_start($hbox = new GtkHBox(), false);
     $hbox->pack_start(new GtkLabel(' Nome: '), false);
     $hbox->pack_start($this->nome = new AEntry(true, true, 'Tb_Perfis', 'Nome'));
     // descricao
     $hbox->pack_start(new GtkLabel(latin1(' Descrição: ')), false);
     $hbox->pack_start($this->descricao = new AEntry(true, true, 'Tb_Perfis', 'Descricao'));
     // Expandir e Sel. Todos
     $this->pack_start($hbox = new GtkHBox(), false);
     $hbox->pack_start($this->expandir = new GtkCheckButton('Expandir'), false);
     $this->expandir->connect('toggled', array($this, 'expandir_toggled'));
     $hbox->pack_start($check = new GtkCheckButton('Sel. Todos'), false);
     $check->connect('toggled', array($this, 'sel_todos_toggled'));
     // progresso
     $hbox->pack_start($this->progresso = new GtkProgressBar());
     // Permissoes
     $this->pack_start($frame = new GtkFrame(latin1(' Permissões ')));
     $frame->set_border_width(5);
     $frame->add($scroll_wnd = new GtkScrolledWindow());
     $scroll_wnd->set_border_width(5);
     $scroll_wnd->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     $scroll_wnd->add_with_viewport($this->lista = new GtkVBox());
     // ok
     $this->pack_start($hbbox = new GtkHButtonBox(), false);
     $hbbox->set_layout(Gtk::BUTTONBOX_END);
     $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false);
     $this->ok->connect('clicked', array($this, 'ok_clicked'));
     // cancelar
     $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false);
     $this->cancelar->connect('clicked', array($this, 'cancelar_clicked'));
     $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0);
     $this->children_show_all();
     $this->nome->set_focus();
 }
Ejemplo n.º 2
0
 function __create_box()
 {
     $box = new GtkVBox();
     $box->pack_start(new GtkLabel('Double click with the mouse on a file, or select by key and press return'), false);
     $paned = new GtkHPaned();
     $paned->set_position(200);
     //filename, markup-filename, fullpath, is_dir, preview image
     $mFile = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_BOOLEAN, GdkPixbuf::gtype);
     $mFile->set_sort_column_id(0, Gtk::SORT_ASCENDING);
     $vFile = new GtkTreeView($mFile);
     $col = new GtkTreeViewColumn('Image', new GtkCellRendererPixbuf(), 'pixbuf', 4);
     $text = new GtkCellRendererText();
     $col->pack_start($text);
     $col->add_attribute($text, 'markup', 1);
     $vFile->append_column($col);
     $vFile->set_headers_visible(false);
     $vFile->connect('key-press-event', array($this, 'onPressFile'));
     $vFile->connect('button-press-event', array($this, 'onPressFile'));
     /*
         GtkIconView has some problems with text that are too long
           and missing icons
             $vFile = new GtkIconView();
             $vFile->set_model($mFile);
             $vFile->set_columns(1);
             $vFile->set_pixbuf_column(3);
             $vFile->set_text_column(0);
             $vFile->set_item_width(100);
     */
     $this->loadFiles($mFile, getcwd());
     $scrwndFiles = new GtkScrolledWindow();
     $scrwndFiles->add($vFile);
     $scrwndFiles->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
     $vboxFile = new GtkVBox();
     $vboxFile->pack_start($scrwndFiles);
     $chkImg = new GtkCheckbutton('Load preview images');
     $chkImg->set_active(true);
     $chkImg->connect('toggled', array($this, 'onCheckPreview'));
     $vboxFile->pack_start($chkImg, false);
     $paned->add1($vboxFile);
     $this->img = new GtkImage();
     $scrwndImg = new GtkScrolledWindow();
     $scrwndImg->add_with_viewport($this->img);
     $scrwndImg->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
     $paned->add2($scrwndImg);
     $box->pack_end($paned);
     return $box;
 }
Ejemplo n.º 3
0
 function append($page)
 {
     $this->remove_background();
     $page->Parent = $this;
     $page->Owner = $this->Owner;
     // Icone + Rotulo
     $guide = new GtkHBox();
     if ($page->Icon) {
         $guide->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $page->Icon), false);
     }
     $guide->pack_start(new GtkLabel(' ' . $page->Title . ' '));
     // Fechar
     $guide->pack_start($close = new GtkButton());
     $close->set_image(GtkImage::new_from_stock(Gtk::STOCK_CLOSE, Gtk::ICON_SIZE_BUTTON));
     $guide->show_all();
     // Guia
     $menu_item = new GtkHBox();
     if ($page->Icon) {
         $menu_item->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $page->Icon), false);
     }
     $menu_item->pack_start(new GtkLabel(' ' . $page->Title . ' '));
     $menu_item->show_all();
     $scroll = new GtkScrolledWindow();
     $scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
     $scroll->add_with_viewport($page);
     $scroll->show_all();
     $current = $this->append_page_menu($scroll, $guide, $menu_item);
     $this->set_current_page($current);
     // Close signal
     if ($this->background) {
         $close->connect('clicked', array($this, 'xmoney_close_clicked'), $current);
     } else {
         $close->connect('clicked', array($this, 'close_button'), $current);
     }
     return $current;
 }
Ejemplo n.º 4
0
 function __create_dbox()
 {
     $vbox = new GtkVBox(false, 5);
     $vbox->set_spacing(2);
     $this->m_ssdata = array();
     for ($i = 0; $i <= 14; $i++) {
         $this->m_ssdata[$i] = array();
         $this->m_ssdata[$i]['Img1'] = GtkImage::new_from_file("./img/11-1.gif");
         $this->m_ssdata[$i]['Img2'] = GtkImage::new_from_file("./img/9.gif");
         $this->m_ssdata[$i]['paned'] = new GtkTable(1, 2, false);
         $this->m_ssdata[$i]['paned']->attach($this->m_ssdata[$i]['Img1'], 0, 1, 1, 2);
         $this->m_ssdata[$i]['paned']->attach($this->m_ssdata[$i]['Img2'], 1, 2, 1, 2);
         $this->m_ssdata[$i]['paned']->set_col_spacings(1);
         $this->m_ssdata[$i]['paned']->set_row_spacings(1);
         //$this->m_ssdata[$i]['paned'] = new GtkHPaned();
         //$this->m_ssdata[$i]['paned']->add1($this->m_ssdata[$i]['Img1']);
         //$this->m_ssdata[$i]['paned']->add2($this->m_ssdata[$i]['Img2']);
         //$this->m_ssdata[$i]['paned']->set_position(45);
         $vbox->pack_start($this->m_ssdata[$i]['paned'], false, false, 0);
         $this->m_ssdata[$i]['name'] = new GtkLabel();
         $this->m_ssdata[$i]['name']->set_markup("Name: \nZacki");
         $vbox->pack_start($this->m_ssdata[$i]['name']);
         $this->m_ssdata[$i]['level'] = new GtkLabel();
         $this->m_ssdata[$i]['level']->set_markup("Level: 70");
         $vbox->pack_start($this->m_ssdata[$i]['level']);
         $this->m_ssdata[$i]['ping'] = new GtkLabel();
         $this->m_ssdata[$i]['ping']->set_markup("Ping: 70");
         $vbox->pack_start($this->m_ssdata[$i]['ping']);
         $this->m_ssdata[$i]['map'] = new GtkLabel();
         $this->m_ssdata[$i]['map']->set_markup("Zone: \nXZ");
         $vbox->pack_start($this->m_ssdata[$i]['map']);
         $this->m_ssdata[$i]['end'] = new GtkLabel();
         $this->m_ssdata[$i]['end']->set_markup("-----");
         $vbox->pack_start($this->m_ssdata[$i]['end']);
     }
     $scrolled = new GtkScrolledWindow();
     $scrolled->add_with_viewport($vbox);
     $scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
     $this->m_ssdata_clear();
     return $scrolled;
 }
Ejemplo n.º 5
0
 /**
  * Add a child to the scroll
  * @param  $object A gtk widget 
  */
 function add(GtkWidget $object)
 {
     parent::add_with_viewport($object);
 }
Ejemplo n.º 6
0
 function __construct($Parent, $InfoLinha)
 {
     parent::__construct('Contas a Receber - Baixar', 800, 480, 'contas_receber.png');
     $this->Parent = $Parent;
     $this->InfoLinha = $InfoLinha;
     // info
     $this->pack_start($hbox = new GtkHBox(), false);
     $hbox->pack_start(GtkImage::new_from_stock(Gtk::STOCK_GO_DOWN, Gtk::ICON_SIZE_DIALOG), false);
     $hbox->pack_start($label = new GtkLabel(), false);
     $label->set_markup('<b> Todos os totais devem estar preenchidos! </b>');
     $hbox->pack_start($frame = new GtkFrame(latin1(' Informações ')));
     $frame->add($vbox = new GtkVBox());
     $vbox->set_border_width(5);
     // banco
     $vbox->pack_start($this->banco = new TBancos($this));
     // tipo de despesa
     $vbox->pack_start($this->despesa = new TTipoDespesa($this));
     // forma pgto
     $vbox->pack_start($this->forma_pgto = new TFormaPgto($this));
     // Contas
     $this->pack_start($frame = new GtkFrame(' Contas a Receber '));
     $frame->add($scroll = new GtkScrolledWindow());
     $scroll->set_border_width(5);
     $scroll->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     $scroll->add_with_viewport($vbox = new GtkVBox());
     $vbox->pack_start($this->lista = new GtkTable(count($InfoLinha) + 1, 8, false), false);
     $this->lista->attach($label = new GtkLabel(), 0, 1, 0, 1);
     $label->set_markup('<b>Id</b>');
     $this->lista->attach($label = new GtkLabel(), 1, 2, 0, 1);
     $label->set_markup('<b>Fornecedor</b>');
     $this->lista->attach($label = new GtkLabel(), 2, 3, 0, 1);
     $label->set_markup('<b>Num. do Doc.</b>');
     $this->lista->attach($label = new GtkLabel(), 3, 4, 0, 1);
     $label->set_markup('<b>Valor em R$</b>');
     $this->lista->attach($label = new GtkLabel(), 4, 5, 0, 1);
     $label->set_markup('<b>Juros em R$</b>');
     $this->lista->attach($label = new GtkLabel(), 5, 6, 0, 1);
     $label->set_markup('<b>Desconto em R$</b>');
     $this->lista->attach($label = new GtkLabel(), 6, 7, 0, 1);
     $label->set_markup('<b>Total em R$</b>');
     $this->lista->attach($label = new GtkLabel(), 7, 8, 0, 1);
     $label->set_markup('<b>' . latin1('Anotações') . '</b>');
     $vbox->pack_start(new GtkEventBox());
     // Valores R$
     $this->pack_start($frame = new GtkFrame(' Valores em R$ '), false);
     $frame->add($vbox = new GtkVBox());
     // Valor das Contas
     $vbox->pack_start($this->lbl_valor_contas = new GtkLabel());
     // Valor dos Juros
     $vbox->pack_start($this->lbl_valor_juros = new GtkLabel());
     // Valor das Descontos
     $vbox->pack_start($this->lbl_valor_descontos = new GtkLabel());
     // ok
     $this->pack_start($hbbox = new GtkHButtonBox(), false);
     $hbbox->set_layout(Gtk::BUTTONBOX_END);
     $hbbox->pack_start($this->ok = GtkButton::new_from_stock('gtk-ok'), false);
     $this->ok->connect('clicked', array($this, 'ok_clicked'));
     // cancelar
     $hbbox->pack_start($this->cancelar = GtkButton::new_from_stock('gtk-cancel'), false);
     $this->cancelar->connect('clicked', array($this, 'cancelar_clicked'));
     $this->cancelar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0);
     $this->children_show_all();
 }
Ejemplo n.º 7
0
/*
 * Create a list widget and populate it with month names.
 */
$list = new GtkList();
$list->set_selection_mode(GTK_SELECTION_BROWSE);
foreach (range(1, 12) as $month_num) {
    $items[] = new GtkListItem(strftime('%B', mktime(0, 0, 0, $month_num)));
}
$list->append_items($items);
/*
 * Create a scrolled window and add the list widget to it - this provides
 * automatic scrollbars.
 */
$scrolled_window = new GtkScrolledWindow();
$scrolled_window->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
$scrolled_window->add_with_viewport($list);
/*
 * Add scrolled window and button to the vertical layout box.
 */
$box->pack_start($scrolled_window);
$box->pack_start($button, false);
/*
 * Add layout box to the window, set window attributes and show everything.
 */
$window->add($box);
$window->set_title('PHP Rules!');
$window->set_name('MainWindow');
$window->set_usize(150, 200);
$window->show_all();
/* Run the main loop. */
Gtk::main();
Ejemplo n.º 8
0
 function demo_selected($selection)
 {
     list($model, $iter) = $selection->get_selected();
     if (!$iter) {
         return;
     }
     $info = $model->get_value($iter, 0);
     $text = $info->classname . "\r\n\r\n" . $info->description;
     //  [JSJ]: I get a too many arguements error using this form, so changed to the later form
     //  Seems silly we would require the strlen() anyway as PHP should be storing that in the zval already anyway
     //	$this->description_buffer->set_text($text, strlen($text));
     $this->description_buffer->set_text($text);
     //source code highlighting
     $this->highlightSource($info->file, $this->highlighting);
     $children = $this->demobox->get_children();
     if (!empty($children)) {
         $this->demobox->remove($children[0]);
     }
     $classname = $info->classname;
     if ($classname) {
         $scroll_demo = new GtkScrolledWindow();
         $scroll_demo->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
         $obj = new $classname();
         $subobj = $obj->__create_box();
         $scroll_demo->add_with_viewport($subobj);
         $this->demobox->add($scroll_demo);
         $this->demobox->show_all();
     }
 }