/** * 画窗体方法 */ 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); }
/** * Class Constructor * @param $name Name of the widget */ public function __construct($name) { parent::__construct($name); $this->widget = new GtkHBox(); parent::add($this->widget); $this->mask = 'yyyy-mm-dd'; // creates the entry field $this->entry = new TEntry($name); $this->entry->setSize(200); $this->setMask($this->mask); $this->widget->add($this->entry); // creates a button with a calendar image $button = new GtkButton(); $button->set_relief(GTK::RELIEF_NONE); $imagem = GtkImage::new_from_file('lib/adianti/images/tdate-gtk.png'); $button->set_image($imagem); $this->actionButton = $button; // define the button's callback $button->connect_simple('clicked', array($this, 'onCalendar')); $this->widget->add($button); // creates the calendar window $this->popWindow = new GtkWindow(Gtk::WINDOW_POPUP); // creates the calendar $this->calendar = new GtkCalendar(); // define the action when the user selects a date $this->calendar->connect_simple('day-selected-double-click', array($this, 'onSelectDate')); $this->month = new TCombo('tdate-month'); $this->month->addItems(array(TAdiantiCoreTranslator::translate('January'), TAdiantiCoreTranslator::translate('February'), TAdiantiCoreTranslator::translate('March'), TAdiantiCoreTranslator::translate('April'), TAdiantiCoreTranslator::translate('May'), TAdiantiCoreTranslator::translate('June'), TAdiantiCoreTranslator::translate('July'), TAdiantiCoreTranslator::translate('August'), TAdiantiCoreTranslator::translate('September'), TAdiantiCoreTranslator::translate('October'), TAdiantiCoreTranslator::translate('November'), TAdiantiCoreTranslator::translate('December'))); $this->month->setCallback(array($this, 'onChangeMonth')); $this->month->setSize(70); for ($n = date('Y') - 10; $n <= date('Y') + 10; $n++) { $years[$n] = $n; } $this->year = new TCombo('tdate-year'); $this->year->addItems($years); $this->year->setCallback(array($this, 'onChangeMonth')); $this->year->setSize(70); $hbox = new GtkHBox(); $hbox->pack_start($this->month); $hbox->pack_start($this->year); $bt_today = new GtkButton(TAdiantiCoreTranslator::translate('Today')); $bt_close = new GtkButton(TAdiantiCoreTranslator::translate('Close')); $bt_today->connect_simple('clicked', array($this, 'selectToday')); $inst = $this->popWindow; $bt_close->connect_simple('clicked', array($inst, 'hide')); $hbox2 = new GtkHBox(); $hbox2->pack_start($bt_today); $hbox2->pack_start($bt_close); $vbox = new GtkVBox(); $vbox->pack_start($hbox, FALSE, FALSE); $vbox->pack_start($this->calendar); $vbox->pack_start($hbox2, FALSE, FALSE); // shows the window $this->popWindow->add($vbox); }
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; /* / */ }
/** * Class Constructor * @param $name Name of the widget */ public function __construct($name) { parent::__construct($name); $this->widget = new GtkVBox(); parent::add($this->widget); $this->orientation = 'vertical'; $this->count = 0; $this->types = array(); $this->created = FALSE; $this->table_fields = new TTable(); $this->editing = FALSE; $this->widget->pack_start($this->table_fields, false, false); $this->view = new GtkTreeView(); $this->model = new GtkListStore(); $button_bar = new GtkHBox(); $add = GtkButton::new_from_stock(Gtk::STOCK_SAVE); $del = GtkButton::new_from_stock(Gtk::STOCK_DELETE); $can = GtkButton::new_from_stock(Gtk::STOCK_CANCEL); $add->connect_simple('clicked', array($this, 'onSave')); $del->connect_simple('clicked', array($this, 'onDelete')); $can->connect_simple('clicked', array($this, 'onCancel')); $button_bar->pack_start($add, FALSE, FALSE); $button_bar->pack_start($del, FALSE, FALSE); $button_bar->pack_start($can, FALSE, FALSE); $this->widget->pack_start($button_bar, false, false); $scroll = new GtkScrolledWindow(); $scroll->add($this->view); $scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $this->widget->pack_start($scroll, false, false); $this->view->set_size_request(400, 140); $this->height = 140; $this->view->connect_simple('button_release_event', array($this, 'onClick')); }
function __construct($Parent, $operacao = 'i', $CodTrans, $CodId = null) { parent::__construct($operacao == 'i' ? latin1('Novo endereço') : latin1('Alterar endereço'), null, null, 'enderecos.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodTrans = $CodTrans; $this->CodId = $CodId; // Id e Tipo $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $this->CodId . '</b>'); } $hbox->pack_start($this->tipo = new TTipoEndereco($this)); // endereco $this->pack_start($frame = new GtkFrame()); $frame->add($vbox = new GtkVBox()); $vbox->set_border_width(5); $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Endereco: '), false); $hbox->pack_start($this->endereco = new AEntry(true)); // cep $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('CEP: '), false); $hbox->pack_start($this->cep = new AEntry(true)); // bairro $hbox->pack_start(new GtkLabel('Bairro: '), false); $hbox->pack_start($this->bairro = new AEntry(true)); // cidade $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Cidade: '), false); $hbox->pack_start($this->cidade = new AEntry(true)); // estado $hbox->pack_start($this->estado = new TEstados($this)); // contato $this->pack_start($frame = new GtkFrame()); $frame->add($vbox = new GtkVBox()); $vbox->set_border_width(5); $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Contato: '), false); $hbox->pack_start($this->contato = new AEntry()); // fone $hbox->pack_start(new GtkLabel('Fone: '), false); $hbox->pack_start($this->fone = new AEntry()); // referencia $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel(latin1('Referência: ')), false); $hbox->pack_start($this->referencia = new AEntry()); // ok e cancelar $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')); $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->referencia->set_next_focus($this->ok); $this->children_show_all(); $this->endereco->set_focus(); }
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); // note 2 $button_yes->connect('clicked', 'on_ok_button', $dialog, 100); // note 3 $button_no->connect('clicked', 'on_ok_button', $dialog, 200); $hbox = new GtkHBox(); // note 4 $dialog->vbox->pack_start($hbox); $hbox->pack_start($button_yes); $hbox->pack_start($button_no); $dialog->set_has_separator(false); $dialog->action_area->set_size_request(-1, 1); $dialog->show_all(); $response_id = $dialog->run(); $dialog->destroy(); global $response; $response->set_text($response_id); // note 6 }
function __construct($Parent, $operacao = 'i', $CodForma = null) { parent::__construct($operacao == 'i' ? 'Formas de Pagamento - Incluir' : 'Formas de Pagamento - Alterar', null, null, 'formas_pgto.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodForma = $CodForma; $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Forma'; $GLOBALS['XMONEY_FIELD_ID'] = $CodForma ? $CodForma : -1; // Id $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $CodForma . '</b>'); } // tipo doc. $hbox->pack_start($this->tipo = new TTipoDoc($this)); // 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_Formas_Pgto', 'Nome')); // 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_next_focus($this->ok); $this->nome->set_focus(); }
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; }
function __construct($Parent, $CodId) { parent::__construct('Estornar Conta a Receber', 400, -1, 'contas_receber.png'); $this->Parent = $Parent; $this->CodId = $CodId; // Id. $this->pack_start($hbox = new GtkHBox()); $hbox->pack_start(GtkImage::new_from_stock(Gtk::STOCK_CANCEL, Gtk::ICON_SIZE_DIALOG), false); $hbox->pack_start($label = new GtkLabel(), false); $label->set_markup(' Cod. Id.: <b>' . $CodId . '</b>'); // anotacoes $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(latin1(' Anotações: ')), false); $hbox->pack_start($this->anotacoes = new AEntry(true)); // 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->anotacoes->focus_widget = $this->ok; $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->anotacoes->grab_focus(); }
function __construct($Parent, $operacao = 'i', $CodUnidade = null) { parent::__construct($operacao == 'i' ? 'Unidade de Estoque - Incluir' : 'Unidade de Estoque - Alterar', null, null, 'unid_estoques.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodUnidade = $CodUnidade; $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Unidade'; $GLOBALS['XMONEY_FIELD_ID'] = $CodUnidade ? $CodUnidade : -1; // Id $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $CodUnidade . '</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_Unid_Estoques', 'Nome')); // 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); // extra $this->children_show_all(); $this->nome->set_next_focus($this->ok); $this->nome->set_focus(); }
function setup_dialog() { $dialog = new GtkDialog(); $dialog->vbox->pack_start(new GtkLabel('Which platform are you using: ')); $radio0 = setup_radio(null, 'radio button 0', '100'); // note 1 $radio1 = setup_radio($radio0, 'Windows', 'win'); $radio2 = setup_radio($radio0, 'Mac', 'mac'); $radio3 = setup_radio($radio0, 'Linux', 'linux'); // pack them inside vbox $dialog->vbox->pack_start($radio1, 0, 0); // note 2 $dialog->vbox->pack_start($radio2, 0, 0); // note 2 $dialog->vbox->pack_start($radio3, 0, 0); // note 2 $dialog->vbox->pack_start($hbox2 = new GtkHBox()); $button_ok = GtkButton::new_from_stock(Gtk::STOCK_OK); $button_ok->set_size_request(87, 33); $hbox2->pack_start(new GtkLabel()); $hbox2->pack_start($button_ok, 0); $button_ok->connect('clicked', 'on_ok_button', $dialog); $dialog->set_has_separator(false); $dialog->action_area->set_size_request(-1, 1); $dialog->show_all(); global $selected_radio, $selected_radio_value; $selected_radio = $selected_radio_value = ''; $dialog->run(); $dialog->destroy(); global $response; $response->set_text("{$selected_radio} ({$selected_radio_value})"); // note 5 }
/** * Adiciona um botão no final do box apartir de um stockitem * * @name add_button_from_stock($stock_id) * @param GtkStockItem $stock_id Id do stock a ser adicionado * @return GtkButton */ public function add_button_from_stock($stock_id) { // Cria o botão $button = GtkButton::new_from_stock($stock_id); // Adiciona o botão parent::add($button); // Retorna o botão return $button; }
/** * Cria o FFWButton * * @name __construct($label="") * @param string $label Texto do botão * @param mixed $callback Função de callback * @return GtkButton */ public function __construct($label = "", $callback = NULL) { // Cria o botão parent::__construct($label); // Verifica o callback if ($callback !== NULL) { parent::connect_simple("clicked", $callback); } }
public function __construct() { parent::__construct(); parent::set_title('Incluir'); parent::connect_simple('destroy', array('Gtk', 'main_quit')); parent::set_default_size(400, 240); parent::set_border_width(10); parent::set_position(GTK::WIN_POS_CENTER); $vbox = new GtkVBox(); $this->labels['id'] = new GtkLabel('Código:'); $this->campos['id'] = new GtkEntry(); $this->campos['id']->set_size_request(80, -1); $this->labels['nome'] = new GtkLabel('Nome: '); $this->campos['nome'] = new GtkEntry(); $this->campos['nome']->set_size_request(240, -1); $this->labels['endereco'] = new GtkLabel('Endereço: '); $this->campos['endereco'] = new GtkEntry(); $this->campos['endereco']->set_size_request(240, -1); $this->labels['telefone'] = new GtkLabel('Telefone: '); $this->campos['telefone'] = new GtkEntry(); $this->campos['telefone']->set_size_request(140, -1); $this->labels['id_cidade'] = new GtkLabel('Cidade: '); $this->campos['id_cidade'] = GtkComboBox::new_text(); $this->campos['id_cidade']->set_size_request(240, -1); $this->campos['id_cidade']->insert_text(0, 'Porto Alegre'); $this->campos['id_cidade']->insert_text(1, 'São Paulo'); $this->campos['id_cidade']->insert_text(2, 'Rio de Janeiro'); $this->campos['id_cidade']->insert_text(3, 'Belo Horizonte'); foreach ($this->campos as $chave => $objeto) { $hbox = new GtkHBox(); $hbox->pack_start($this->labels[$chave], false, false); $hbox->pack_start($this->campos[$chave], false, false); $this->labels[$chave]->set_size_request(100, -1); $this->labels[$chave]->set_alignment(1, 0.5); // xAlign, yalign (0.5, 1) $vbox->pack_start($hbox, false, false); } $vbox->pack_start(new GtkHSeparator(), true, true); // cria uma caixa de botões $buttonbox = new GtkHButtonBox(); $buttonbox->set_layout(Gtk::BUTTONBOX_START); // cria um botão de salvar $botao = GtkButton::new_from_stock(Gtk::STOCK_SAVE); // conecta o botão ao método onSaveClick() $botao->connect_simple('clicked', array($this, 'onSaveClick')); $buttonbox->pack_start($botao, false, false); // cria um botão de fechar a aplicação $botao = GtkButton::new_from_stock(Gtk::STOCK_CLOSE); $botao->connect_simple('clicked', array('Gtk', 'main_quit')); $buttonbox->pack_start($botao, false, false); $vbox->pack_start($buttonbox, false, false); parent::add($vbox); // exibe a janela parent::show_all(); }
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(); }
/** * Add an Action to the DataGrid * @param $object A TDataGridAction object */ public function addAction(TDataGridAction $action) { $this->actions[] = $action; $button = new GtkButton($action->getLabel()); if (file_exists('lib/adianti/images/' . $action->getImage())) { $button->set_image(GtkImage::new_from_file('lib/adianti/images/' . $action->getImage())); } else { $button->set_image(GtkImage::new_from_file('app/images/' . $action->getImage())); } $button->connect_simple('clicked', array($this, 'onExecute'), $action); $this->action_area->pack_start($button); }
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; }
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(); }
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; }
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(); }
function __construct($Parent, $CodConta) { parent::__construct(latin1('Movimentação da Conta'), 600, 300, 'contas_receber.png'); $this->Parent = $Parent; $this->CodConta = $CodConta; // CodConta, TipoDoc e NumDoc $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->cod_conta = new GtkLabel()); $hbox->pack_start($this->tipo_doc = new GtkLabel()); $hbox->pack_start($this->num_doc = new GtkLabel()); $this->pack_start($vbox = new GtkVBox()); $vbox->pack_start($this->grid = new TGridInfoMovContaReceber($this)); $vbox->pack_start($this->fechar = GtkButton::new_from_stock('gtk-close'), false); $this->fechar->add_accelerator('clicked', $this->accel_group, Gdk::KEY_Escape, 0, 0); $this->fechar->connect('clicked', array($this, 'fechar_clicked')); $this->children_show_all(); }
function __construct($Parent, $operacao = 'i', $CodConta = null) { parent::__construct($operacao == 'i' ? 'Contas a Pagar - Incluir' : 'Contas a Pagar - Alterar', null, null, 'contas_pagar.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodConta = $CodConta; // tipo doc. $this->pack_start($this->tipo_doc = new TTipoDoc($this)); // filial $this->pack_start($this->filial = new TFiliais($this)); // Fornecedor $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->fornecedores = new TFornecedores($this)); // num doc $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->num_doc = new AEntry(true)); $this->num_doc->label->set_text(' Num. Doc.: '); // parcela $hbox->pack_start($this->parcela = new IEntry(true)); $this->parcela->label->set_text(' Parcela: '); // vencimento $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->vencimento = new TData(true)); $this->vencimento->label->set_text(' Vencimento: '); // valor $hbox->pack_start($this->valor = new TFloat(true)); $this->valor->label->set_text(' Valor: '); // anotacoes $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start($this->anotacoes = new AEntry()); $this->anotacoes->label->set_text(latin1(' Anotações ')); // 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->anotacoes->focus_widget = $this->ok; $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); // extra $this->children_show_all(); $this->anotacoes->set_next_focus($this->ok); $this->fornecedores->entry->grab_focus(); }
function __construct($pesquisar) { parent::__construct(' Filtro '); $this->set_expanded(true); $this->add($hbox = new GtkHBox()); $hbox->pack_start($this->vbox = new GtkVBox()); $this->vbox->pack_start(new GtkEventBox()); $hbox->pack_start($vbox = new GtkVBox(), false); // pesquisar $vbox->pack_start($this->localizar = GtkButton::new_from_stock('gtk-find'), false); $this->localizar->connect('clicked', $pesquisar); // restaurar $vbox->pack_start($this->limpar = GtkButton::new_from_stock('gtk-clear'), false); $this->limpar->connect('clicked', array($this, 'restaurar')); // fill empty space $vbox->pack_start(new GtkEventBox()); $this->show_all(); }
/** The constructor. It builds the window. */ function __construct($args = array()){ require_once("knj/functions_knj_gtk2.php"); //Create window. $this->window = new GtkWindow(); $this->window->set_title("Status"); $this->window->set_resizable(false); $this->window->set_position(GTK_WIN_POS_CENTER); $this->window->connect("destroy", array($this, "CloseWindow")); $this->window->set_size_request(500, -1); $this->window->set_border_width(3); if ($args["window_parent"]){ $this->window->set_transient_for($args["window_parent"]); $this->window->set_modal(true); } //Create progressbar. $adj = new GtkAdjustment(0.5, 100.0, 200.0, 0.0, 0.0, 0.0); $this->progress = new GtkProgressBar($adj); @$this->progress->set_fraction(0); //Create status-label. $this->label = new GtkLabel("Status: Waiting."); $this->label->set_alignment(0, 0.5); //Attach to window. $box = new GtkVBox(); $box->pack_start($this->label, false); $box->pack_start($this->progress, false); if ($args["with_cancelbtn"]){ $button_cancel = GtkButton::new_from_stock(Gtk::STOCK_CANCEL); $button_cancel->connect("clicked", array($this, "on_btnCancel_clicked")); $box->pack_start($button_cancel, false, false); } $this->window->add($box); $this->window->show_all(); }
function __construct($Parent, $operacao = 'i', $CodBanco = null) { parent::__construct($operacao == 'i' ? 'Bancos - Incluir' : 'Bancos - Alterar', null, null, 'bancos.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodBanco = $CodBanco; $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Banco'; $GLOBALS['XMONEY_FIELD_ID'] = $CodBanco ? $CodBanco : -1; // Id $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $CodBanco . '</b>'); } // Filial $hbox->pack_start($this->filial = new TFiliais($this)); // 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_Bancos', 'Nome')); // agencia $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(' Agencia: '), false); $hbox->pack_start($this->agencia = new AEntry(true, true, 'Tb_Bancos', 'Agencia')); // conta $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(' Conta: '), false); $hbox->pack_start($this->conta = new AEntry(true, true, 'Tb_Bancos', 'Conta')); // 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->conta->focus_widget = $this->ok; $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->conta->set_next_focus($this->ok); $this->children_show_all(); $this->nome->set_focus(); }
function create_framedbox($horizontal, $title, $spacing, $layout) { $frame = new GtkFrame($title); if ($horizontal) { $box = new GtkHButtonBox(); } else { $box = new GtkVButtonBox(); } $box->set_border_width(5); $box->set_layout($layout); $box->set_spacing($spacing); $frame->add($box); $button = GtkButton::new_from_stock(Gtk::STOCK_OK); $box->add($button); $button = GtkButton::new_from_stock(Gtk::STOCK_CANCEL); $box->add($button); $button = GtkButton::new_from_stock(Gtk::STOCK_HELP); $box->add($button); return $frame; }
function setup_yes_no_dialog() { $dialog = new GtkDialog(); $dialog->vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(new GtkLabel('Phone Number: '), 0); $hbox->pack_start($phone = new GtkEntry(), 0); // note 1 $dialog->vbox->pack_start($hbox2 = new GtkHBox()); $button_ok = GtkButton::new_from_stock(Gtk::STOCK_OK); $button_ok->set_size_request(87, 33); $hbox2->pack_start(new GtkLabel()); $hbox2->pack_start($button_ok, 0); $phone->connect('activate', 'on_enter', $button_ok); // note 2 $button_ok->connect('clicked', 'on_ok_button', $dialog); $dialog->set_has_separator(false); $dialog->action_area->set_size_request(-1, 1); $dialog->show_all(); $dialog->run(); $dialog->destroy(); global $response; $response->set_text($phone->get_text()); }
function __construct($Parent, $operacao = 'i', $CodSit = null) { parent::__construct($operacao == 'i' ? latin1('Situação de Produto - Incluir') : latin1('Situação de Produto - Alterar'), null, null, 'sit_produtos.png'); $this->Parent = $Parent; $this->operacao = $operacao; $this->CodSit = $CodSit; $GLOBALS['XMONEY_FIELD'] = 'Cod_S_Sit'; $GLOBALS['XMONEY_FIELD_ID'] = $CodSit ? $CodSit : -1; // Id $this->pack_start($hbox = new GtkHBox()); if ($operacao == 'a') { $hbox->pack_start($id = new GtkLabel(), false); $id->set_markup(' Id.: <b>' . $CodSit . '</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_Sit_Produtos', 'Nome')); // abreviacao $this->pack_start($hbox = new GtkHBox(), false); $hbox->pack_start(new GtkLabel(latin1(' Abreviação: ')), false); $hbox->pack_start($this->abreviacao = new AEntry(true, true, 'Tb_Sit_Produtos', 'Abreviacao')); // 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); // extra $this->children_show_all(); $this->abreviacao->set_next_focus($this->ok); $this->nome->set_focus(); }
function uprav_behy() { global $G, $model, $view; #debug_log('úprava behov'); $dialog = new GtkDialog(); // note 1 $viewport1 = new GtkViewPort(); $dialog->set_title('Behy'); $dialog->set_position(GTK::WIN_POS_CENTER); $dialog->set_default_size(960, 420); $model = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING); #datum #nazov #druh (OA, OJ, A1, A2, A3, J1, J2, J3) #rozhodca #$rozhodcovia=explode(",",$G["config"]->__get("rozhodca")); $view = new GtkTreeView($model); # $view->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH); $column1 = new GtkTreeViewColumn('Kód'); $column2 = new GtkTreeViewColumn('Názov'); $column3 = new GtkTreeViewColumn('Filter'); $column4 = new GtkTreeViewColumn('Dátum'); $column5 = new GtkTreeViewColumn('Rozhodca'); $column6 = new GtkTreeViewColumn('Dĺžka'); $column7 = new GtkTreeViewColumn('Prekážky'); $column8 = new GtkTreeViewColumn('Štd.č'); $column9 = new GtkTreeViewColumn('Max.č'); $view->append_column($column1); $view->append_column($column2); $view->append_column($column3); $view->append_column($column4); $view->append_column($column5); $view->append_column($column6); $view->append_column($column7); $view->append_column($column8); $view->append_column($column9); $cell_renderer1 = new GtkCellRendererText(); $cell_renderer2 = new GtkCellRendererText(); $cell_renderer3 = new GtkCellRendererText(); $cell_renderer4 = new GtkCellRendererText(); $cell_renderer5 = new GtkCellRendererText(); $cell_renderer6 = new GtkCellRendererText(); $cell_renderer7 = new GtkCellRendererText(); $cell_renderer8 = new GtkCellRendererText(); $cell_renderer9 = new GtkCellRendererText(); $cell_renderer1->set_property('width', 60); $cell_renderer1->set_property('editable', true); $cell_renderer2->set_property('width', 220); $cell_renderer2->set_property('editable', true); $cell_renderer3->set_property('width', 50); $cell_renderer3->set_property('editable', true); $cell_renderer4->set_property('width', 80); $cell_renderer4->set_property('editable', true); $cell_renderer5->set_property('width', 180); $cell_renderer5->set_property('editable', true); $cell_renderer6->set_property('width', 50); $cell_renderer6->set_property('editable', true); $cell_renderer7->set_property('width', 50); $cell_renderer7->set_property('editable', true); $cell_renderer8->set_property('width', 50); $cell_renderer8->set_property('editable', true); $cell_renderer9->set_property('width', 50); $cell_renderer9->set_property('editable', true); $cell_renderer1->connect('edited', 'callback_start1'); $cell_renderer2->connect('edited', 'callback_start2'); $cell_renderer3->connect('edited', 'callback_start3'); $cell_renderer4->connect('edited', 'callback_start4'); $cell_renderer5->connect('edited', 'callback_start5'); $cell_renderer6->connect('edited', 'callback_start6'); $cell_renderer7->connect('edited', 'callback_start7'); $cell_renderer8->connect('edited', 'callback_start8'); $cell_renderer9->connect('edited', 'callback_start9'); #$cell_renderer3->set_property('width', -1); $column1->pack_start($cell_renderer1, true); $column2->pack_start($cell_renderer2, true); $column3->pack_start($cell_renderer3, true); $column4->pack_start($cell_renderer4, true); $column5->pack_start($cell_renderer5, true); $column6->pack_start($cell_renderer6, true); $column7->pack_start($cell_renderer7, true); $column8->pack_start($cell_renderer8, true); $column9->pack_start($cell_renderer9, true); $column1->set_attributes($cell_renderer1, 'text', 0); $column2->set_attributes($cell_renderer2, 'text', 1); $column3->set_attributes($cell_renderer3, 'text', 2); $column4->set_attributes($cell_renderer4, 'text', 3); $column5->set_attributes($cell_renderer5, 'text', 4); $column6->set_attributes($cell_renderer6, 'text', 5); $column7->set_attributes($cell_renderer7, 'text', 6); $column8->set_attributes($cell_renderer8, 'text', 7); $column9->set_attributes($cell_renderer9, 'text', 8); #print_r($G["behy"]);exit; foreach ($G["behy"] as $b) { $model->append($b); } $toolbar = new GtkHButtonBox(); $addbutton = GtkButton::new_from_stock(Gtk::STOCK_ADD); $deletebutton = GtkButton::new_from_stock(Gtk::STOCK_DELETE); #$loadbutton=GtkButton::new_from_stock(Gtk::STOCK_REFRESH); $savebutton = GtkButton::new_from_stock(Gtk::STOCK_SAVE); $savebutton->connect("pressed", "uloz_behy"); $addbutton->connect("pressed", "pridaj_beh"); $deletebutton->connect("pressed", "vymaz_beh"); $toolbar->add($addbutton); $toolbar->add($deletebutton); #$toolbar->add($loadbutton); $toolbar->add($savebutton); $toolbar->set_size_request(0, 40); $sw = new GtkScrolledWindow(); $sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $sw->add($view); $sw->set_size_request(-1, 560); $vbox = new GtkVBox(); $vbox->add($toolbar); $vbox->add($sw); $dialog->vbox->pack_start($vbox); // note 3 $dialog->show_all(); // note 4 $dialog->run(); // note 5 $dialog->destroy(); // note 6 }
// 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();