Пример #1
0
 /**
  * 画窗体方法
  */
 public function draw()
 {
     $this->set_default_size(200, 200);
     $this->set_title("24计算器");
     $mesg = new GtkLabel('Please input 4 integer(0-99):');
     $this->chalkboard = new GtkLabel();
     $this->inputs = $inputs = array(new GtkEntry(), new GtkEntry(), new GtkEntry(), new GtkEntry());
     /**
      * container
      */
     $table = new GtkTable(4, 1, 0);
     $layout = array('left' => 0, 'right' => 1, 'top' => 0, 'bottom' => 1);
     $vBox = new GtkVBox(false, true);
     $vBox->pack_start($mesg);
     foreach ($inputs as $input) {
         $input->set_max_length(2);
         $table->attach($input, $layout['left'], $layout['right'], $layout['top']++, $layout['bottom']++);
     }
     $vBox->pack_start($table);
     $button = new GtkButton("Calculate");
     $button->connect("clicked", array($this, "calculate"));
     $vBox->pack_start($this->chalkboard);
     $vBox->pack_start($button, true, false);
     $this->add($vBox);
 }
Пример #2
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;
     /* / */
 }
Пример #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;
 }
Пример #4
0
 function __create_box()
 {
     $this->infobar = new GtkInfoBar();
     $this->messagelabel = new GtkLabel('Default shows an Info message');
     $contentarea = $this->infobar->get_content_area();
     $contentarea->add($this->messagelabel);
     $this->infobar->add_button(GTK::STOCK_OK, GTK::RESPONSE_OK);
     $this->infobar->connect_simple('response', array($this->infobar, 'hide'));
     $vbox = new GtkVBox(false);
     $button = new GtkButton('_Create Error Message');
     $button->connect('clicked', array($this, 'create_error'));
     $vbox->pack_start($button, false, false, 0);
     $vbox->pack_start(new GtkHSeparator(), false, false, 0);
     $vbox->pack_start($this->infobar, false, false, 0);
     return $vbox;
 }
Пример #5
0
 function __construct($parent = null)
 {
     parent::__construct();
     if ($parent) {
         $this->set_screen($parent->get_screen());
     } else {
         $this->connect_simple('destroy', array('gtk', 'main_quit'));
     }
     $this->set_title("Pomm");
     $this->set_position(Gtk::WIN_POS_CENTER);
     $this->set_default_size(850 + 100, 600 + 50);
     $this->set_border_width(0);
     $this->set_resizable(false);
     $pin = new GtkHPaned();
     $pin->set_position(784);
     $vbox = new GtkVBox(false, 5);
     $this->add($vbox);
     $vbox->set_border_width(5);
     $pin->add1($this->__create_box());
     $pin->add2($this->__create_dbox());
     $vbox->pack_start($pin);
     $button = new GtkButton('Update');
     $button->connect('clicked', array($this, '__update'));
     $button2 = new GtkButton('Filter');
     $button2->connect('clicked', array($this, 'string_find'));
     $button3 = new GtkButton("LIST");
     $button3->connect('clicked', array($this, 'set_mode_stat'));
     $bbox = new GtkHBox(false, 5);
     $bbox->pack_start($button);
     $bbox->pack_start($button2);
     $bbox->pack_start($button3);
     $this->sinfo = new GtkLabel();
     $this->sinfo->set_markup('x:0 y:0 obj:0');
     $paned = new GtkHPaned();
     $paned->set_position(65 * 3);
     $paned->add1($bbox);
     $paned->add2($this->sinfo);
     $vbox->pack_end($paned, false, false, 0);
     //$this->set_icon_from_file("./img/4-1.gif");
     $this->show_all();
 }
Пример #6
0
 function __create_box()
 {
     $mvbox = new GtkVBox(false);
     $frame = new GtkFrame('Dialogs');
     $vbox = new GtkVBox(false, 8);
     $vbox->set_border_width(8);
     $frame->add($vbox);
     # Standard message dialog
     $hbox = new GtkHBox(false, 8);
     $vbox->pack_start($hbox);
     $button = new GtkButton('_Message Dialog');
     $button->connect('clicked', array($this, 'on_message_dialog_clicked'));
     $hbox->pack_start($button, false, false, 0);
     $vbox->pack_start(new GtkHSeparator(), false, false, 0);
     # Interactive dialog
     $hbox = new GtkHBox(false, 8);
     $vbox->pack_start($hbox, false, false, 0);
     $vbox2 = new GtkVBox();
     $button = new GtkButton('_Interactive Dialog');
     $button->connect('clicked', array($this, 'on_interactive_dialog_clicked'));
     $hbox->pack_start($vbox2, false, false, 0);
     $vbox2->pack_start($button, false, false, 0);
     $table = new GtkTable(2, 2);
     $table->set_row_spacings(4);
     $table->set_col_spacings(4);
     $hbox->pack_start($table, false, false, 0);
     $label = new GtkLabel('Entry _1');
     $label->set_use_underline(true);
     $table->attach($label, 0, 1, 0, 1);
     $this->entry1 = new GtkEntry();
     $table->attach($this->entry1, 1, 2, 0, 1);
     $label->set_mnemonic_widget($this->entry1);
     $label = new GtkLabel('Entry _2');
     $label->set_use_underline(true);
     $table->attach($label, 0, 1, 1, 2);
     $this->entry2 = new GtkEntry();
     $table->attach($this->entry2, 1, 2, 1, 2);
     $label->set_mnemonic_widget($this->entry2);
     return $frame;
 }
Пример #7
0
 function __construct($parent = null)
 {
     parent::__construct();
     $this->selected_file = "";
     $this->hash_label_default = "Open a file (Ctrl+O)  OR  Type a sentence (Ctrl+T)";
     $this->set_size_request(400, 60);
     $this->connect_simple('destroy', array('gtk', 'main_quit'));
     $this->set_title(__CLASS__);
     $this->set_position(Gtk::WIN_POS_CENTER);
     $this->add($vbox = new GtkVBox());
     $accel_group = new GtkAccelGroup();
     $this->add_accel_group($accel_group);
     $menu_definition = array('_File' => array('_Open|O', '_Type|T', '<hr>', 'E_xit'), '_Help' => array('_About|H'));
     // define menu definition
     $this->menu = new Menu($vbox, $menu_definition, $accel_group);
     // display title
     $button = new GtkButton('_Get Hash');
     $button->connect('clicked', array($this, 'calculate'));
     $this->hash_label = new GtkLabel($this->hash_label_default);
     $vbox->pack_start($hbox = new GtkHBox());
     $hbox->pack_start($this->hash_label);
     $hbox->pack_start($button, false, false, 0);
     $this->show_all();
 }
Пример #8
0
$hbox5->pack_start($chplus = new GtkButton('_CH+'));
$hbox5->pack_start($chminus = new GtkButton('CH-'));
$chplus->connect('clicked', 'chplus');
$chminus->connect('clicked', 'chminus');
$vbox->pack_start($hbox6 = new GtkHBox(), 0, 0);
$hbox6->pack_start(new GtkLabel('ODM'));
$hbox6->pack_start($G["odm"] = new GtkLabel('0'));
$hbox6->pack_start($oplus = new GtkButton('_O+'));
$hbox6->pack_start($ominus = new GtkButton('O-'));
$oplus->connect('clicked', 'oplus');
$ominus->connect('clicked', 'ominus');
$vbox->pack_start($hbox2 = new GtkHBox(), 0, 0);
$hbox2->pack_start($G["disk"] = new GtkButton('_DISK'));
$hbox2->pack_start($G["nest"] = new GtkButton('_NEST'));
$hbox2->pack_start($potvrd = new GtkButton('OK'));
$potvrd->connect('clicked', 'potvrd');
$G["disk"]->connect('clicked', 'disk_toggle');
$G["nest"]->connect('clicked', 'nest_toggle');
function exportcsv()
{
    global $G;
    $beh = $G["beh"]->get_label();
    echo "exportujem csv\n";
    echo $beh . "\n";
    $G['abeh'] = $beh;
    #var_export($G["vysledky"][$beh]);
    $par = $G["behy"][$beh];
    #var_export($par);
    $vv = $G["vysledky"][$beh];
    foreach ($vv as $k => $v) {
        if ($v[3] == "DIS" || $v[3] == 100) {
Пример #9
0
// Set up the combobox
$combobox->set_model($model);
// note 1
$cellRenderer = new GtkCellRendererText();
// note 2
$combobox->pack_start($cellRenderer);
$combobox->set_attributes($cellRenderer, 'text', 0);
// note 3
// Stuff the choices in the model
foreach ($list as $choice) {
    $model->append(array($choice));
}
// Set up a hbox to contain the combobox as well as the Submit button
$hbox->pack_start($combobox, 0, 0);
$hbox->pack_start(new GtkLabel('  '), 0, 0);
$hbox->pack_start($button = new GtkButton('Submit'), 0, 0);
$button->set_size_request(60, 24);
// Set up the event handler to respond to button click
$button->connect('clicked', "on_button", $combobox);
// note 4
// The callback function that is called when user clicks the submit button
function on_button($button, $combobox)
{
    $model = $combobox->get_model();
    // note 5
    $selection = $model->get_value($combobox->get_active_iter(), 0);
    // note 6
    echo "You have selected: {$selection}!\n";
}
$window->show_all();
Gtk::main();
Пример #10
0
$window->add($vbox = new GtkVBox());
// display title
$title = new GtkLabel("Set up a simple yes/no dialog\n" . "Part 3 - set up button manually");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 40);
$title->set_justify(Gtk::JUSTIFY_CENTER);
$alignment = new GtkAlignment(0.5, 0, 0, 0);
$alignment->add($title);
$vbox->pack_start($alignment, 0, 0);
$vbox->pack_start(new GtkLabel(), 0, 0);
$vbox->pack_start($hbox = new GtkHBox(), 0);
$hbox->pack_start(new GtkLabel('Response: '), 0);
$hbox->pack_start($response = new GtkEntry(), 0);
$hbox->pack_start($button = new GtkButton('Get Yes/No Response'), 0);
$button->connect('clicked', 'on_click');
$window->show_all();
Gtk::main();
function on_click()
{
    setup_yes_no_dialog();
}
function setup_yes_no_dialog()
{
    $dialog = new GtkDialog();
    $dialog->set_title('Yes/No Dialog');
    $label = new GtkLabel("Do you like PHP-Gtk2?");
    $dialog->vbox->pack_start($label);
    $button_yes = GtkButton::new_from_stock(Gtk::STOCK_YES);
    // note 1
    $button_no = GtkButton::new_from_stock(Gtk::STOCK_NO);
Пример #11
0
// display title
$title = new GtkLabel("Search for text in GtkTextView - Part 1\n");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 60);
$title->set_justify(Gtk::JUSTIFY_CENTER);
$alignment = new GtkAlignment(0.5, 0, 0, 0);
$alignment->add($title);
$vbox->pack_start($alignment, 0, 0);
$vbox->pack_start(new GtkLabel(), 0, 0);
$hbox = new GtkHBox();
$hbox->pack_start(new GtkLabel("Search string: "), 0);
$hbox->pack_start($entry = new GtkEntry(), 0);
$hbox->pack_start($button_search = new GtkButton('Search'), 0);
$vbox->pack_start($hbox, 0);
$button_search->connect('clicked', 'on_search_button', $entry);
// note 1
// Create a new buffer and a new view to show the buffer.
$buffer = new GtkTextBuffer();
$view = new GtkTextView();
$view->set_buffer($buffer);
$view->modify_font(new PangoFontDescription("Verdana italic 14"));
$view->set_wrap_mode(Gtk::WRAP_WORD);
$scrolled_win = new GtkScrolledWindow();
$scrolled_win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
$vbox->pack_start($scrolled_win);
$scrolled_win->add($view);
$window->show_all();
Gtk::main();
function on_search_button($widget, $entry)
{
Пример #12
0
    print "Hello World!\n";
    $window->destroy();
}
/*
 * Create a new top-level window and connect the signals to the appropriate
 * functions. Note that all constructors must be assigned by reference.
 */
$window = new GtkWindow();
$window->connect('destroy', 'destroy');
$window->connect('delete-event', 'delete_event');
$window->set_border_width(10);
/*
 * Create a button, connect its clicked signal to hello() function and add
 * the button to the window.
 */
$button = new GtkButton('Hello World!');
$button->connect('clicked', 'hello');
/*
 * Create a new tooltips object and use it to set a tooltip for the button.
 */
$tt = new GtkTooltips();
$tt->set_delay(200);
$tt->set_tip($button, 'Prints "Hello World!"', '');
$tt->enable();
$window->add($button);
/*
 * Show the window and all its child widgets.
 */
$window->show_all();
/* Run the main loop. */
Gtk::main();
Пример #13
0
 private function window()
 {
     //create window
     $this->set_title("calculator GUI");
     $this->set_default_size(350, 350);
     $this->connect_simple('destroy', array('gtk', 'main_quit'));
     //create vbox
     $vbox = new GtkVBox();
     //create entry box
     $this->entry = new GtkEntry();
     $this->entry->set_size_request(100, 100);
     //create button
     $btn1 = new GtkButton();
     $btn2 = new GtkButton();
     $btn3 = new GtkButton();
     $btnsin = new GtkButton();
     $btncos = new GtkButton();
     $btn4 = new GtkButton();
     $btn5 = new GtkButton();
     $btn6 = new GtkButton();
     $btnt2 = new GtkButton();
     $btnrad = new GtkButton();
     $btn7 = new GtkButton();
     $btn8 = new GtkButton();
     $btn9 = new GtkButton();
     $btn0 = new GtkButton();
     $btndot = new GtkButton();
     $btnpercent = new GtkButton();
     $btnplus = new GtkButton();
     $btntan = new GtkButton();
     $btncot = new GtkButton();
     $btnminus = new GtkButton();
     $btndiv = new GtkButton();
     $btnmulti = new GtkButton();
     $btnequal = new GtkButton();
     $btnref = GtkButton::new_from_stock(Gtk::STOCK_REFRESH);
     $btnback = GtkButton::new_from_stock(Gtk::STOCK_CLEAR);
     //set button value
     $btn1->set_label('1');
     $btn1->connect('clicked', array($this, 'click1'));
     $btn2->set_label('2');
     $btn2->connect('clicked', array($this, 'click2'));
     $btn3->set_label('3');
     $btn3->connect('clicked', array($this, 'click3'));
     $btn4->set_label('4');
     $btn4->connect('clicked', array($this, 'click4'));
     $btn5->set_label('5');
     $btn5->connect('clicked', array($this, 'click5'));
     $btn6->set_label('6');
     $btn6->connect('clicked', array($this, 'click6'));
     $btn7->set_label('7');
     $btn7->connect('clicked', array($this, 'click7'));
     $btn8->set_label('8');
     $btn8->connect('clicked', array($this, 'click8'));
     $btn9->set_label('9');
     $btn9->connect('clicked', array($this, 'click9'));
     $btn0->set_label('0');
     $btn0->connect('clicked', array($this, 'click0'));
     $btndot->set_label('.');
     $btndot->connect('clicked', array($this, 'clickdot'));
     $btnpercent->set_label('%');
     $btnpercent->connect('clicked', array($this, 'clickpercent'));
     $btnplus->set_label('+');
     $btnplus->connect('clicked', array($this, 'clickplus'));
     $btnminus->set_label('-');
     $btnminus->connect('clicked', array($this, 'clickminus'));
     $btndiv->set_label('/');
     $btndiv->connect('clicked', array($this, 'clickdiv'));
     $btnmulti->set_label('*');
     $btnmulti->connect('clicked', array($this, 'clickmulti'));
     $btnequal->set_label('=');
     $btnequal->connect('clicked', array($this, 'clickequal'));
     $btnt2->set_label('^2');
     //$btnt2->connect('clicked',array($this,'clickt2'));
     //$btnrad->set_label('v--');
     $btnrad->connect('clicked', array($this, 'clickrad'));
     $btnsin->set_label('sin');
     $btnsin->connect('clicked', array($this, 'clicksin'));
     $btncos->set_label('cos');
     $btncos->connect('clicked', array($this, 'clickcos'));
     $btntan->set_label('tan');
     $btntan->connect('clicked', array($this, 'clicktan'));
     $btncot->set_label('cot');
     $btncot->connect('clicked', array($this, 'clickcot'));
     //create table
     $tbl = new GtkTable(4, 6, true);
     //set button on table
     $tbl->attach($btn7, 0, 1, 0, 1);
     $tbl->attach($btn8, 1, 2, 0, 1);
     $tbl->attach($btn9, 2, 3, 0, 1);
     $tbl->attach($btnmulti, 3, 4, 0, 1);
     $tbl->attach($btnref, 4, 5, 0, 1);
     $tbl->attach($btnback, 5, 6, 0, 1);
     $tbl->attach($btn4, 0, 1, 1, 2);
     $tbl->attach($btn5, 1, 2, 1, 2);
     $tbl->attach($btn6, 2, 3, 1, 2);
     $tbl->attach($btndiv, 3, 4, 1, 2);
     $tbl->attach($btnpercent, 4, 5, 1, 2);
     $tbl->attach($btnt2, 5, 6, 1, 2);
     $tbl->attach($btn1, 0, 1, 2, 3);
     $tbl->attach($btn2, 1, 2, 2, 3);
     $tbl->attach($btn3, 2, 3, 2, 3);
     $tbl->attach($btnminus, 3, 4, 2, 3);
     $tbl->attach($btnsin, 4, 5, 2, 3);
     $tbl->attach($btncos, 5, 6, 2, 3);
     $tbl->attach($btn0, 0, 1, 3, 4);
     $tbl->attach($btndot, 1, 2, 3, 4);
     $tbl->attach($btnequal, 2, 3, 3, 4);
     $tbl->attach($btnplus, 3, 4, 3, 4);
     $tbl->attach($btntan, 4, 5, 3, 4);
     $tbl->attach($btncot, 5, 6, 3, 4);
     //add to vbox
     $vbox->pack_start($this->entry, true, true, 0);
     $vbox->pack_end($tbl, true, true, 0);
     //add to window
     $this->add($vbox);
     $this->show_all();
 }
Пример #14
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;
 }
Пример #15
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();
 }
Пример #16
0
$tipswindow = new GtkWindow(Gtk::WINDOW_POPUP);
$content = new GtkLabel('I feel pretty');
$tipswindow->add($content);
$content->show();
$text->set_tooltip_window($tipswindow);
$text->connect('query-tooltip', 'redboxtip');
// trigger tooltip query for the display on button press
$vbox->add($button = new GtkButton('Trigger Tooltip passing Display'));
$button->connect_simple('clicked', array('GtkTooltip', 'trigger_tooltip_query'), GdkDisplay::get_default());
$button->set_has_tooltip(true);
$button->connect('query-tooltip', 'texttip');
// trigger tooltip query for a display where the widget is on button press
$vbox->add($button = new GtkButton('Trigger Tooltip passing Widget'));
$button->connect_simple('clicked', array($label, 'trigger_tooltip_query'));
$button->set_has_tooltip(true);
$button->connect('query-tooltip', 'texttip');
/* Generic liststore for the next tests */
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_STRING, GdkPixbuf::gtype);
$store->append(array('foo', 'tip1', $window->render_icon(Gtk::STOCK_OPEN, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('bar', 'tip2', $window->render_icon(Gtk::STOCK_CLOSE, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('baz', 'tip3', $window->render_icon(Gtk::STOCK_SAVE, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('kitty', 'tip4', $window->render_icon(Gtk::STOCK_OK, Gtk::ICON_SIZE_DIALOG)));
// callback that tells us if we have an item at the spot
function checkcontext($widget, $x, $y, $keyboard_mode, $tooltip)
{
    $list = $widget->get_tooltip_context($x, $y, $keyboard_mode);
    if (!$list) {
        return false;
    }
    list($model, $path, $iter) = $list;
    $tooltip->set_text($model->get_value($iter, 1));