/** * @name __construct() * @return Demo */ public function __construct() { $vbox = new GtkVBox(); // Adiciona o menu $this->widgets['mnuBar'] = Fabula::GtkMenuBar(); $vbox->pack_start($this->widgets['mnuBar'], FALSE, FALSE); // Arquivo $mnuFile = $this->widgets['mnuBar']->append_menu("_Arquivo"); $mnuImportar = $mnuFile->append_menu("Importar"); $mnuFile->append_item("Exportar"); $mnuFile->append_separator(); $mnuFile->append_item("Sair", array($this, "sair_onclick")); // Importar $mnuImportar->append_item("Arquivo 1"); $mnuImportar->append_item("Arquivo 2"); // Ajuda $mnuHelp = $this->widgets['mnuBar']->append_menu("Aju_da"); $mnuHelp->append_item("Ajuda"); $mnuHelp->append_item("Site na Web"); $mnuHelp->append_separator(); $mnuHelp->append_item("Sobre"); // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(500, 500); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $this->widgets['frmDemo']->add($vbox); $vbox->pack_start(new GtkFixed(), TRUE, TRUE); // Inicia a aplicação $this->frmDemo_onload(); }
function __construct() { parent::__construct('Contas a Pagar', 'contas_pagar.png'); // barra de ferramentas $this->pack_start($toolbar = new TToolbar(), false); $this->lancar = $toolbar->append_stock('gtk-add', 0, array($this, 'lancar_clicked')); $this->lancar->set_label(latin1('Lançar')); $this->baixar = $toolbar->append_stock('gtk-go-down', 1, array($this, 'baixar_clicked')); $this->baixar->set_label('Baixar'); $this->cancelar = $toolbar->append_stock('gtk-cancel', 2, array($this, 'cancelar_clicked')); $this->estornar = $toolbar->append_stock('gtk-cancel', 3, array($this, 'estornar_clicked')); $this->estornar->set_label('Estornar'); $this->info_mov = $toolbar->append_stock('gtk-info', 4, array($this, 'info_mov_clicked')); $this->imprimir = $toolbar->append_stock('gtk-print-preview', 5, array($this, 'imprimir_clicked')); // contas em aberto $this->pack_start($this->notebook = new GtkNotebook()); $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Em aberto ')); $vbox->pack_start($this->filtro = new TFiltroContasPagar(array($this, 'pega_dados')), false); $vbox->pack_start($this->grid = new TGridContasPagar($this)); // contas pagas baixadas $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Baixas ')); $vbox->pack_start($this->mov_filtro = new TFiltroMovContasPagar(array($this, 'pega_dados_mov')), false); $vbox->pack_start($this->mov_grid = new TGridMovContasPagar($this)); // contas pagas canceladas $this->notebook->append_page($vbox = new GtkVBox(), new GtkLabel(' Canceladas ')); $vbox->pack_start($this->del_filtro = new TFiltroDelContasPagar(array($this, 'pega_dados_del')), false); $vbox->pack_start($this->del_grid = new TGridDelContasPagar($this)); $this->notebook->connect('switch-page', array($this, 'notebook_switch_page')); $this->notebook->set_current_page(0); $this->lancar->set_sensitive(CheckPermissao($this, 'lancar_conta_pagar')); $this->info_mov->set_sensitive(CheckPermissao($this, 'info_mov_conta_pagar')); $this->imprimir->set_sensitive(CheckPermissao($this, 'imprimir_contas_pagar')); }
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(); }
public function __construct() { parent::__construct(); $dbi = new DBInterface(); $this->strings = KioskClient::getStrings(); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(300, 200); $this->set_resizable(false); $this->timeLabel = new GtkLabel($this->strings["timeLeftLabel_begin"] . '0' . $this->strings["timeLeftLabel_end"]); $this->set_title($this->strings["windowTitle_begin"] . '0' . $this->strings["windowTitle_end"]); $this->logoutButton = new GtkButton($this->strings['logoutButton']); $this->pauseButton = new GtkButton($this->strings['pauseButton']); $box = new GtkVBox(); $box->pack_start($this->timeLabel); if ($dbi->getSetting('max_pause_time')) { $box->pack_start($this->pauseButton); } $box->pack_start($this->logoutButton); # if ( DEBUG ) { # $this->quitButton = new GtkButton("Quit"); # $box->pack_start( $this->quitButton ); # } # $this->connect_simple( 'destroy', array('Gtk', 'main_quit') ); $this->add($box); }
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 __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(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(-1, 500); $this->set_border_width(8); $hbox = new GtkHBox(false, 8); $this->add($hbox); $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')); $this->show_all(); }
/** * @name __construct() * @return Demo */ public function __construct() { // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(600, 300); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $box = new GtkVBox(); // Adiciona o textview do resultado $this->widgets['txtResult'] = Fabula::GtkTextView(); $box->pack_start(Fabula::GtkViewPort($this->widgets['txtResult']), TRUE, TRUE); // Adiciona o textview dos comandos $this->widgets['txtCommands'] = Fabula::GtkEntry(); $box->pack_start($this->widgets['txtCommands'], FALSE, FALSE); $this->widgets['txtCommands']->grab_focus(); // Connecta o entry de comandos para capturar o botão enter $this->widgets['txtCommands']->connect("key-press-event", array($this, "txtCommands_onkeypress")); // Inicia o pipe $this->pipe = Fabula::PipeIO("/bin/sh", array()); $this->pipe->set_callback("stdout", array($this, "on_pipe_io_stdout")); $this->pipe->run(); // Inicia a aplicação $this->widgets['frmDemo']->add($box); $this->frmDemo_onload(); }
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); }
function __create_box() { $vbox = new GtkVBox(); $label = new GtkLabel('Window test'); $button = new GtkButton('Click the button!'); $vbox->pack_start($label); $vbox->pack_start($button); $editor = new WidgetEditor($this, array(array('decorated', GtkToggleButton::gtype), array('resizable', GtkToggleButton::gtype), array('skip_pager_hint', GtkToggleButton::gtype), array('skip_taskbar_hint', GtkToggleButton::gtype), array('accept_focus', GtkToggleButton::gtype), array('modal', GtkToggleButton::gtype), array('keep_above', GtkToggleButton::gtype, 'on', 'off', false), array('keep_below', GtkToggleButton::gtype, 'on', 'off', false), array('iconify', GtkButton::gtype, 'deiconify'), array('fullscreen', GtkButton::gtype, 'unfullscreen'), array('maximize', GtkButton::gtype, 'unmaximize'), array('stick', GtkButton::gtype, 'unstick'), array('present', GtkButton::gtype))); return $vbox; }
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(); }
function __create_box() { $vbox = new GtkVBox(false, 5); $vbox->set_border_width(5); $label = new GtkLabel(); $label->set_markup('Expander demo. Click on the triangle for details.'); $vbox->pack_start($label, false, false, 0); $expander = new GtkExpander('Details'); $vbox->pack_start($expander, false, false, 0); $label2 = new GtkLabel('Details can be shown or hidden'); $expander->add($label2); return $vbox; }
function __construct() { parent::__construct(); parent::set_title('Adianti Framework :: Samples'); $this->content = new GtkFixed(); $vbox = new GtkVBox(); $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false); $MenuBar = TMenuBar::newFromXML('menu.xml'); $vbox->pack_start($MenuBar, false, false); $vbox->pack_start($this->content, true, true); parent::add($vbox); parent::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("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() { $vbox = new GtkVBox(false, 5); $vbox->set_border_width(5); $combo = GtkComboBox::new_text(); $data = array('PHP-Gtk2', 'is', 'really', 'cool'); foreach ($data as $string) { $combo->append_text($string); } $combo->set_active(2); $button = new GtkButton('Check this'); $vbox->pack_start($combo, false, true); $vbox->pack_start($button, false, true); $button->connect('clicked', array($this, 'onClickedButton'), $combo); //GtkComboBoxEntry $vbox->pack_start(new GtkHSeparator(), false, true); $comboentry = GtkComboBoxEntry::new_text(); $data2 = array('You', 'can', 'edit', 'this', 'box'); foreach ($data2 as $string) { $comboentry->append_text($string); } $comboentry->get_child()->set_text('That\'s an own text for the entry'); $vbox->pack_start($comboentry, false, true); $button2 = new GtkButton('Check that'); $vbox->pack_start($button2, false, true); $button2->connect('clicked', array($this, 'onClickedButton'), $comboentry); return $vbox; }
function __create_box() { $vbox = new GtkVBox(); $vbox->show(); $drawing_area = new GtkDrawingArea(); $drawing_area->set_size_request(300, 300); $vbox->pack_start($drawing_area); // $drawing_area->realize(); $drawing_area->connect('expose_event', array($this, 'expose_event')); $drawing_area->connect('configure_event', array($this, 'configure_event')); $drawing_area->connect('motion_notify_event', array($this, 'motion_notify_event')); $drawing_area->connect('button_press_event', array($this, 'button_press_event')); $drawing_area->set_events(Gdk::EXPOSURE_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK); return $vbox; }
/** * Define the Height * @param $height An integer containing the height */ public function setHeight($height) { $this->height = $height; if ($this->scrollable) { parent::set_size_request(-1, $height); } }
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::__construct(); parent::set_title('Adianti Framework :: Samples'); $this->content = new GtkFixed(); $vbox = new GtkVBox(); $scroll = new GtkScrolledWindow(); $scroll->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS); $scroll->set_size_request(200, -1); $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader.png'), false, false); $MenuBar = TMenuBar::newFromXML('menu.xml'); $vbox->pack_start($MenuBar, false, false); $vbox->pack_start($this->content, true, true); parent::add($vbox); parent::show_all(); }
function __construct($title, $icon) { parent::__construct(); $this->set_border_width(5); $this->Title = $title; $this->Icon = $icon; }
function __create_box() { $vbox = new GtkVBox(false, 5); $vbox->set_border_width(5); $label = new GtkLabel(); $label->set_markup('Completion demo, try writing <b>total</b> or <b>gnome</b> for example.'); $vbox->pack_start($label, false, false, 0); $entry = new GtkEntry(); $vbox->pack_start($entry, false, false, 0); $completion = new GtkEntryCompletion(); $completion_model = $this->__create_completion_model(); $completion->set_model($completion_model); $completion->set_text_column(0); $entry->set_completion($completion); return $vbox; }
function __create_box() { $box = new GtkVBox(); $box->pack_start(new GtkLabel('Double click with the mouse on a file, or select by key and press return'), false); $paned = new GtkHPaned(); $paned->set_position(200); //filename, markup-filename, fullpath, is_dir, preview image $mFile = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_BOOLEAN, GdkPixbuf::gtype); $mFile->set_sort_column_id(0, Gtk::SORT_ASCENDING); $vFile = new GtkTreeView($mFile); $col = new GtkTreeViewColumn('Image', new GtkCellRendererPixbuf(), 'pixbuf', 4); $text = new GtkCellRendererText(); $col->pack_start($text); $col->add_attribute($text, 'markup', 1); $vFile->append_column($col); $vFile->set_headers_visible(false); $vFile->connect('key-press-event', array($this, 'onPressFile')); $vFile->connect('button-press-event', array($this, 'onPressFile')); /* GtkIconView has some problems with text that are too long and missing icons $vFile = new GtkIconView(); $vFile->set_model($mFile); $vFile->set_columns(1); $vFile->set_pixbuf_column(3); $vFile->set_text_column(0); $vFile->set_item_width(100); */ $this->loadFiles($mFile, getcwd()); $scrwndFiles = new GtkScrolledWindow(); $scrwndFiles->add($vFile); $scrwndFiles->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $vboxFile = new GtkVBox(); $vboxFile->pack_start($scrwndFiles); $chkImg = new GtkCheckbutton('Load preview images'); $chkImg->set_active(true); $chkImg->connect('toggled', array($this, 'onCheckPreview')); $vboxFile->pack_start($chkImg, false); $paned->add1($vboxFile); $this->img = new GtkImage(); $scrwndImg = new GtkScrolledWindow(); $scrwndImg->add_with_viewport($this->img); $scrwndImg->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $paned->add2($scrwndImg); $box->pack_end($paned); return $box; }
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, $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($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(); }
/** * @name __construct() * @return Demo */ public function __construct() { // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(200, 200); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $box = new GtkVBox(); // Cria o video $this->widgets['vdoDemo'] = Fabula::GtkVideo(); $this->widgets['vdoDemo']->set_auto_scalable(TRUE); $this->widgets['vdoDemo']->connect("button-press-event", array($this, "vdoDemo_button_pressed")); $this->widgets['vdoDemo']->connect("video-changed", array($this, "vdoDemo_onchange")); $this->widgets['vdoDemo']->connect("video-closed", array($this, "vdoDemo_onclose")); $box->pack_start($this->widgets['vdoDemo'], TRUE, TRUE); // Cria o progressbar $this->widgets['sclDemo'] = GtkHScale::new_with_range(0, 100, 1); $this->widgets['sclDemo']->set_draw_value(FALSE); $this->widgets['sclDemo']->connect("button-release-event", array($this, "sclDemo_button_pressed")); $box->pack_start($this->widgets['sclDemo'], FALSE, FALSE); // Cria o box dos botões $this->widgets['hbox'] = new GtkHBox(); $box->pack_start($this->widgets['hbox'], FALSE, FALSE); // Cria o label do tempo $this->widgets['lblTime'] = Fabula::GtkLabel(""); $this->widgets['lblTime']->set_alignment(1, 0.5); $this->widgets['hbox']->pack_end($this->widgets['lblTime']); // Adiciona os botões $this->widgets['btnOpen'] = Fabula::GtkButton(NULL, array($this, "btnOpen_click")); $this->widgets['btnOpen']->set_image(GtkImage::new_from_stock(Gtk::STOCK_OPEN, Gtk::ICON_SIZE_BUTTON)); $this->widgets['hbox']->pack_start($this->widgets['btnOpen'], FALSE, FALSE); $this->widgets['btnPlay'] = Fabula::GtkButton(NULL, array($this, "btnPlay_click")); $this->widgets['btnPlay']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_PLAY, Gtk::ICON_SIZE_BUTTON)); $this->widgets['hbox']->pack_start($this->widgets['btnPlay'], FALSE, FALSE); $this->widgets['btnPause'] = Fabula::GtkButton(NULL, array($this, "btnPause_click")); $this->widgets['btnPause']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_PAUSE, Gtk::ICON_SIZE_BUTTON)); $this->widgets['hbox']->pack_start($this->widgets['btnPause'], FALSE, FALSE); $this->widgets['btnStop'] = Fabula::GtkButton(NULL, array($this, "btnStop_click")); $this->widgets['btnStop']->set_image(GtkImage::new_from_stock(Gtk::STOCK_MEDIA_STOP, Gtk::ICON_SIZE_BUTTON)); $this->widgets['hbox']->pack_start($this->widgets['btnStop'], FALSE, FALSE); // Inicia a aplicação $this->widgets['frmDemo']->add($box); $this->frmDemo_onload(); }
/** 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::__construct(); parent::set_title('Adianti Framework :: Library'); $this->content = new GtkFixed(); $vbox = new GtkVBox(); $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false); $hbox = new GtkHBox(); $vbox->pack_start($hbox, true, true); $frame = new GtkFrame(); $frame->add($this->content); $this->scroll = new GtkScrolledWindow(); $this->scroll->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS); $this->scroll->set_size_request(200, -1); $hbox->pack_start($this->scroll, false, false); $hbox->pack_start($frame, true, true); parent::add($vbox); parent::show_all(); $this->run('LoginForm'); }
/** * Shows the VBox */ public function show() { $children = parent::get_children(); if ($children) { foreach ($children as $child) { // show child object $child->show(); } } parent::show_all(); }