function __construct($Owner) { parent::__construct(); $this->pack_start(new GtkLabel(latin1(' Tipo de Endereço: ')), false); $this->store = new GtkListStore(TYPE_STRING, TYPE_LONG); $this->pack_start($this->combobox = new GtkComboBox($this->store)); $this->combobox->pack_start($cell = new GtkCellRendererText()); $this->combobox->set_attributes($cell, 'text', 0); $this->combobox->connect('changed', array($this, 'tipo_endereco_changed')); $this->show_all(); /* * preenche lista */ $db = new Database($Owner, true); if (!$db->link) { return; } /* * Tipo de Endereco */ if (!$db->multi_query('SELECT * FROM Vw_Tipos_Endereco')) { return; } $this->store->clear(); unset($this->it); while ($line = $db->line()) { $row = $this->store->append(); $this->store->set($row, 0, $line['Descricao'], 1, $line['Id']); $this->it[$line['Id']] = $row; } }
function on_interactive_dialog_clicked($button) { $dialog = new GtkDialog('Interactive Dialog', $this, 0, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, '_Non-stock button', Gtk::RESPONSE_CANCEL)); $hbox = new GtkHBox(false, 8); $hbox->set_border_width(8); $dialog->vbox->pack_start($hbox, false, false, 0); $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG); $hbox->pack_start($stock, false, false, 0); $table = new GtkTable(2, 2); $table->set_row_spacings(4); $table->set_col_spacings(4); $hbox->pack_start($table, true, true, 0); $label = new GtkLabel('Entry _1'); $label->set_use_underline(true); $table->attach($label, 0, 1, 0, 1); $local_entry1 = new GtkEntry(); $local_entry1->set_text($this->entry1->get_text()); $table->attach($local_entry1, 1, 2, 0, 1); $label->set_mnemonic_widget($local_entry1); $label = new GtkLabel('Entry _2'); $label->set_use_underline(true); $table->attach($label, 0, 1, 1, 2); $local_entry2 = new GtkEntry(); $local_entry2->set_text($this->entry2->get_text()); $table->attach($local_entry2, 1, 2, 1, 2); $label->set_mnemonic_widget($local_entry2); $dialog->show_all(); $response = $dialog->run(); if ($response == Gtk::RESPONSE_OK) { $this->entry1->set_text($local_entry1->get_text()); $this->entry2->set_text($local_entry2->get_text()); } $dialog->destroy(); }
function on_delete_confirm() { $dialog = new GtkDialog('CAUTION!', $this, 0, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, Gtk::STOCK_CANCEL, Gtk::RESPONSE_CANCEL)); $hbox = new GtkHBox(false, 8); $hbox->set_border_width(8); $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG); $confirm_text1 = new GtkLabel('Are you sure you want to proceed ?'); $confirm_text2 = new GtkLabel('Note: This process is irreversible.'); $confirm_text3 = new GtkLabel($this->selected_file); $confirm_text3->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#ff0000")); $vbox2 = new GtkVBox(); $vbox2->pack_start($confirm_text1); $vbox2->pack_start($confirm_text2); $vbox2->pack_start($confirm_text3); $hbox->pack_start($stock, false, false, 0); $hbox->pack_start($vbox2, false, false, 0); $dialog->vbox->pack_start($hbox, false, false, 0); $dialog->show_all(); $response = $dialog->run(); if ($response == Gtk::RESPONSE_OK) { $resp = $this->delete_file(); if ($resp) { $this->on_delete_successful(); $this->selected_file = ""; $this->file_label->set_text($this->file_label_default); } else { $this->selected_file = ""; $this->file_label->set_text('Unable to delete the specified file.'); } } $dialog->destroy(); }
/** * Show the table and all aggregated rows */ public function show() { if ($this->showed === FALSE) { $i = 0; if ($this->rows) { foreach ($this->rows as $row) { $c = 0; if ($row->getCells()) { foreach ($row->getCells() as $column) { $properties = $column->getProperties(); $properties['colspan'] = isset($properties['colspan']) ? $properties['colspan'] - 1 : 0; $hbox = new GtkHBox(); if (isset($properties['width'])) { $hbox->set_size_request($properties['width'], -1); } $hbox->set_border_width(1); $hbox->pack_start($column->getContent(), false, false); $column->getContent()->show(); //$hbox->pack_start(new GtkHBox, true, true); parent::attach($hbox, $c, $c + 1 + $properties['colspan'], $i, $i + 1, GTK::FILL, 0, 0, 0); $c++; } } $i++; } } $this->showed = TRUE; } parent::show(); }
function alert($msg) { // note 1 $dialog = new GtkDialog('Alert', null, Gtk::DIALOG_MODAL); // create a new dialog $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $top_area = $dialog->vbox; // note 2 $top_area->pack_start($hbox = new GtkHBox()); // note 3 $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); // note 4 $hbox->pack_start($stock, 0, 0); // stuff in the icon $hbox->pack_start(new GtkLabel($msg)); // and the msg $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK); // note 5 $dialog->set_has_separator(false); // don't display the set_has_separator $dialog->show_all(); // show the dialog $dialog->run(); // the dialog in action $dialog->destroy(); // done. close the dialog box. }
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', $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 __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(); }
/** * 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 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 }
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(); }
public function __construct() { $this->frame = new GtkFrame(); $frameBox = new GtkVBox(false, 10); $frameBox->set_border_width(10); $titleBox = new GtkHBox(false, 10); $titleLabel = new GtkLabel("User Profile"); $titleLabel->set_markup("<span weight='bold'>User Profile</span>"); $titleLabel->set_alignment(0, 0.5); $this->statusLabel = new GtkLabel(""); $this->statusLabel->set_alignment(1, 0.5); $titleBox->pack_start($titleLabel, true, true, 0); $titleBox->pack_end($this->statusLabel, true, true, 0); $frameBox->pack_start($titleBox, false, false, 0); $this->frame->add($frameBox); $this->userFormTable = new GtkTable(3, 7); list($labelFname, $this->entryFname) = $this->createLabelText('First Name', true); list($labelLname, $this->entryLname) = $this->createLabelText('Last Name', true); list($labelEmail, $this->entryEmail) = $this->createLabelText('Email', true); list($labelUsername, $this->entryUsername) = $this->createLabelText('Username', true); list($labelPassword, $this->entryPassword) = $this->createLabelText('Password', false); list($labelConfirm, $this->entryConfirm) = $this->createLabelText('Confirm Password', false); $this->deptComboStore = new GtkRefListStore(Gobject::TYPE_STRING); $this->deptComboStore->refInsert(DeptEnum::getList()); $this->comboDept = new GtkRefComboBox($this->deptComboStore); $cellDept = new GtkCellRendererText(); $cellDept->set_property('ellipsize', Pango::ELLIPSIZE_END); $this->comboDept->pack_start($cellDept); $this->comboDept->set_attributes($cellDept, 'text', 0); $labelDept = new GtkLabel('Department'); $labelDept->set_alignment(1, 0.5); $this->attachLabelText($labelFname, $this->entryFname, false, 0); $this->attachLabelText($labelLname, $this->entryLname, false, 1); $this->attachLabelText($labelEmail, $this->entryEmail, false, 2); $this->attachLabelText($labelUsername, $this->entryUsername, true, 3); $this->attachLabelText($labelPassword, $this->entryPassword, true, 4); $this->attachLabelText($labelConfirm, $this->entryConfirm, true, 5); $this->attachLabelText($labelDept, $this->comboDept, true, 6); $this->entryUsername->connect('key-release-event', array($this, 'enableSubmit')); $this->entryPassword->connect('key-release-event', array($this, 'enableSubmit')); $this->entryConfirm->connect('key-release-event', array($this, 'enableSubmit')); $this->comboDept->connect('changed', array($this, 'enableSubmit')); $subFrame = new GtkFrame(); $subFrameBox = new GtkVBox(false, 0); $subFrameBox->set_border_width(12); $subFrame->add($subFrameBox); $subFrameBox->pack_start($this->userFormTable, false, false, 0); $frameBox->pack_start($subFrame, false, false, 0); $buttonBox = new GtkHBox(false, 8); $this->submitButton = new GtkButton($this->mode == self::MODE_ADD ? 'Add User' : 'Update Profile'); $this->submitButton->connect('clicked', array($this, 'submit')); $this->cancelButton = new GtkButton("Cancel"); $buttonBox->pack_end($this->cancelButton, false, false, 0); $buttonBox->pack_end($this->submitButton, false, false, 0); $frameBox->pack_end($buttonBox, true, true, 0); $this->enableForm(false); }
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(); }
/** * 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); }
public function init(GtkFrame $userList, GtkFrame $userForm, GtkFrame $rolePanel) { $mainVBox = new GtkVBox(false, 10); $mainHBox = new GtkHBox(true, 10); $mainVBox->pack_start($userList, true, true, 0); $mainHBox->pack_start($userForm, true, true, 0); $mainHBox->pack_start($rolePanel, true, true, 0); $mainVBox->pack_start($mainHBox, false, false, 0); $this->window->add($mainVBox); $this->window->show_all(); Gtk::main(); }
public function __construct() { $this->frame = new GtkFrame(); $frameBox = new GtkVBox(false, 10); $frameBox->set_border_width(10); $titleBox = new GtkHBox(false, 10); $titleLabel = new GtkLabel("User Roles"); $titleLabel->set_markup("<span weight='bold'>User Roles</span>"); $titleLabel->set_alignment(0, 0.5); $this->statusLabel = new GtkLabel(""); $this->statusLabel->set_alignment(1, 0.5); $titleBox->pack_start($titleLabel, true, true, 0); $titleBox->pack_end($this->statusLabel, true, true, 0); $frameBox->pack_start($titleBox, false, false, 0); $this->frame->add($frameBox); $this->roleListStore = new GtkRefListStore(Gobject::TYPE_STRING); $this->roleListTree = new GtkRefTreeView($this->roleListStore); $this->roleListTree->set_headers_visible(false); $roleListSelection = $this->roleListTree->get_selection(); $roleListSelection->set_mode(Gtk::SELECTION_SINGLE); $roleListSelection->connect('changed', array($this, 'selectRoleToRemove')); $rolesWindow = new GtkScrolledWindow(); $rolesWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $rolesWindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); $rolesWindow->add($this->roleListTree); $frameBox->pack_start($rolesWindow, true, true, 0); $renderer = new GtkCellRendererText(); $renderer->set_property("editable", false); $column = new GtkTreeViewColumn('Role', $renderer, "text", 0); $column->set_expand(true); $column->set_resizable(false); $this->roleListTree->append_column($column); $this->roleComboStore = new GtkRefListStore(Gobject::TYPE_STRING); $this->roleComboStore->refInsert(RoleEnum::getList()); $this->roleCombo = new GtkRefComboBox($this->roleComboStore); $roleCell = new GtkCellRendererText(); $roleCell->set_property('ellipsize', Pango::ELLIPSIZE_END); $this->roleCombo->pack_start($roleCell); $this->roleCombo->set_attributes($roleCell, 'text', 0); $this->roleCombo->connect('changed', array($this, 'selectRoleToAdd')); $this->addButton = new GtkButton("Add"); $this->addButton->set_sensitive(false); $this->removeButton = new GtkButton("Remove"); $this->removeButton->set_sensitive(false); $this->enableForm(false); $buttonBox = new GtkHBox(false, 8); $buttonBox->pack_end($this->removeButton, false, false, 0); $buttonBox->pack_end($this->addButton, false, false, 0); $buttonBox->pack_end($this->roleCombo, true, true, 0); $frameBox->pack_end($buttonBox, false, false, 0); }
function __create_box() { $hbox = new GtkHBox(false, 8); $scrolled = new GtkScrolledWindow(); $scrolled->set_shadow_type(Gtk::SHADOW_ETCHED_IN); $scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); $hbox->pack_start($scrolled, false, false, 0); $model = $this->create_model(); $treeview = new GtkTreeView($model); $scrolled->add($treeview); $column = new GtkTreeViewColumn(); $column->set_title('Icon and Constant'); $cell_renderer = new GtkCellRendererPixbuf(); $column->pack_start($cell_renderer, false); $column->set_attributes($cell_renderer, 'stock-id', 1); $cell_renderer = new GtkCellRendererText(); $column->pack_start($cell_renderer, true); $column->set_cell_data_func($cell_renderer, 'constant_setter'); $treeview->append_column($column); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'Label', $cell_renderer, 'label_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'Accelerator', $cell_renderer, 'accel_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'ID', $cell_renderer, 'id_setter'); $align = new GtkAlignment(0.5, 0, 0, 0); $hbox->pack_end($align, true, true, 0); $frame = new GtkFrame('Selection Info'); $align->add($frame); $vbox = new GtkVBox(false, 8); $vbox->set_border_width(4); $frame->add($vbox); $display = new StockItemDisplay(); $treeview->set_data('stock-display', $display); $display->type_label = new GtkLabel(); $display->constant_label = new GtkLabel(); $display->id_label = new GtkLabel(); $display->accel_label = new GtkLabel(); $display->icon_image = new GtkImage(); $vbox->pack_start($display->type_label, false, false, 0); $vbox->pack_start($display->icon_image, false, false, 0); $vbox->pack_start($display->accel_label, false, false, 0); $vbox->pack_start($display->constant_label, false, false, 0); $vbox->pack_start($display->id_label, false, false, 0); $selection = $treeview->get_selection(); $selection->set_mode(Gtk::SELECTION_SINGLE); $selection->connect('changed', array($this, 'on_selection_changed')); return $hbox; }
/** * Append an item to the menu */ public function append($item, $submenu) { $button = new GtkToggleButton(); if (OS == 'WIN') { $hbox = new GtkHBox(); $hbox->set_border_width(4); $hbox->pack_start(new GtkLabel($item->getLabel())); $button->add($hbox); } else { $button->set_label($item->getLabel()); } $handler = $button->connect('clicked', array($this, 'onExecute'), $item, $submenu); $button->set_data('handler', $handler); $this->pack_start($button, FALSE, FALSE); }
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(); }
/** * Class Constructor * @param $name name of the field */ public function __construct($name) { parent::__construct(); self::setName($name); // initialize validations array $this->validations = array(); }
function __construct($Owner) { parent::__construct(); $this->pack_start(new GtkLabel(' Fornecedor: '), false); $completion = new GtkEntryCompletion(); $completion->set_model($this->store = new GtkListStore(TYPE_STRING, TYPE_LONG)); $completion->set_text_column(0); $completion->pack_start($cell = new GtkCellRendererText()); $completion->set_attributes($cell, 'text', 1); $completion->connect('match-selected', array($this, 'fornecedor_selected')); $this->pack_start($this->entry = new GtkEntry()); $this->entry->set_completion($completion); $this->show_all(); /* * preenche lista */ $db = new Database($Owner, true); if (!$db->link) { return; } /* * Fornecedores */ if (!$db->multi_query('SELECT * FROM Vw_Fornecedores')) { return; } $this->store->clear(); unset($this->it); while ($line = $db->line()) { $row = $this->store->append(); $this->store->set($row, 0, $line['Nome'], 1, $line['Id']); $this->it[$line['Id']] = $row; } }
function __construct($Owner) { parent::__construct(); $this->pack_start(new GtkLabel(' Forma de Pgto: '), false); $this->store = new GtkListStore(TYPE_STRING, TYPE_LONG); $this->pack_start($this->combobox = new GtkComboBox($this->store)); $this->combobox->pack_start($cell = new GtkCellRendererText()); $this->combobox->set_attributes($cell, 'text', 0); $this->combobox->connect('changed', array($this, 'forma_pgto_changed')); $this->show_all(); /* * preenche lista */ $db = new Database($Owner, true); if (!$db->link) { return; } /* * Formas de Pagamento */ if (!$db->multi_query('SELECT * FROM Vw_Formas_Pgto')) { return; } $this->store->clear(); unset($this->it); while ($line = $db->line()) { $row = $this->store->append(); $this->store->set($row, 0, $line['Nome'], 1, $line['Id']); $this->it[$line['Id']] = $row; } }
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(); }
public function __construct() { $this->frame = new GtkFrame(); $frameBox = new GtkVBox(false, 10); $frameBox->set_border_width(10); $titleBox = new GtkHBox(false, 10); $titleLabel = new GtkLabel("Users"); $titleLabel->set_markup("<span weight='bold'>Users</span>"); $titleLabel->set_alignment(0, 0.5); $this->statusLabel = new GtkLabel(""); $this->statusLabel->set_alignment(1, 0.5); $titleBox->pack_start($titleLabel, true, true, 0); $titleBox->pack_end($this->statusLabel, true, true, 0); $frameBox->pack_start($titleBox, false, false, 0); $this->frame->add($frameBox); $this->userListStore = new GtkRefListStore(Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING); $this->userListTree = new GtkRefTreeView($this->userListStore); $this->userListTree->set_rules_hint(true); $usersWindow = new GtkScrolledWindow(); $usersWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $usersWindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); $usersWindow->add($this->userListTree); $frameBox->pack_start($usersWindow, true, true, 0); $cols = array('Username', 'First Name', 'Last Name', 'Email', 'Department'); foreach ($cols as $num => $item) { $renderer = new GtkCellRendererText(); $renderer->set_property("editable", false); $column = new GtkTreeViewColumn($item, $renderer, "text", $num); $column->set_sort_column_id($num); $column->set_expand(true); $column->set_resizable(true); $this->userListTree->append_column($column); } $userSelection = $this->userListTree->get_selection(); $userSelection->set_mode(Gtk::SELECTION_SINGLE); $userSelection->connect('changed', array($this, 'isSelected')); $this->newButton = new GtkButton("New"); $this->newButton->connect('clicked', array($this, 'deSelect')); $this->delButton = new GtkButton("Delete"); $this->delButton->set_sensitive(false); $this->delButton->connect('clicked', array($this, 'confirmDeletion')); $buttonBox = new GtkHBox(false, 8); $buttonBox->pack_end($this->newButton, false, false, 0); $buttonBox->pack_end($this->delButton, false, false, 0); $frameBox->pack_end($buttonBox, false, false, 0); }
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(); }
public function __construct($message) { parent::__construct(); $this->strings = KioskClient::getStrings(); $this->set_default_size(300, 200); $this->set_resizable(false); $this->set_keep_above(true); $this->set_title("Message: {$message}"); $this->messageLabel = new GtkLabel(); $this->messageLabel->set_use_markup(true); $this->messageLabel->set_markup($this->strings["message_begin"] . $message . $this->strings["message_end"]); $this->set_title($message); $hbox = new GtkHBox(); $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); $hbox->pack_start($stock, 0, 0); $hbox->pack_start($this->messageLabel); $this->add($hbox); $this->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(); }
/** * Shows the HBox */ public function show() { $children = parent::get_children(); if ($children) { foreach ($children as $child) { // show child object $child->show(); } } parent::show_all(); }
/** * Class Constructor * @param $name widget's name */ public function __construct($name) { parent::__construct(); $this->widget = GtkComboBox::new_text(); // create the combo model $this->model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING); $this->widget->set_model($this->model); $this->widget->set_size_request(200, -1); $this->wname = $name; parent::add($this->widget); $this->validations = array(); }