/** Initiates a standard combobox-entry. */ function cbe_init(GtkComboBoxEntry $cbe) { $cr = new GtkCellRendererText(); $cr->set_property("xalign", 0); $cr->set_property("yalign", 0); $cbe->set_model(new GtkListStore(_TYPE_STRING)); $cbe->pack_start($cr); $cbe->set_attributes($cr, "text", 0); $cbe->connect("changed", "cbe_event", $cbe); }
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() { $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); }
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 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 }
/** * Add a field to the MultiField * @param $name Widget's name * @param $text Widget's label * @param $object Widget * @param $size Widget's size * @param $inform Show the Widget in the form */ public function addField($name, $text, GtkObject $object, $size, $mandatory = FALSE) { if ($this->orientation == 'horizontal') { if (count($this->fields) == 0) { $this->row_label = $this->table_fields->addRow(); $this->row_field = $this->table_fields->addRow(); } } else { $row = $this->table_fields->addRow(); $this->row_label = $row; $this->row_field = $row; } $label = new TLabel("<i>{$text}</i>"); if ($mandatory) { $label->setFontColor('#FF0000'); } $n = $this->count; $object->setName("{$this->name}_text{$n}"); $this->row_label->addCell($label); $this->row_field->addCell($object); $this->fields[$name] = array($text, $object, $size, FALSE, $mandatory); $this->allfields[$name] = array($text, $object, $size, FALSE, $mandatory); if (get_class($object) == 'TComboCombined') { $column = new GtkTreeViewColumn('ID'); } else { $column = new GtkTreeViewColumn($text); } $cell_renderer = new GtkCellRendererText(); $cell_renderer->set_property('width', $size); $column->set_fixed_width($size); $column->pack_start($cell_renderer, true); $column->add_attribute($cell_renderer, 'text', $this->count); $this->types[] = GObject::TYPE_STRING; $this->view->append_column($column); $this->columns[$name] = $this->count; $this->count++; // combocombined, need to add one more column and treat different if (get_class($object) == 'TComboCombined') { $cell_renderer->set_property('width', 20); $column->set_fixed_width(20); $tname = $object->getTextName(); $this->fields[$tname] = array($text, $object, $size, TRUE, $mandatory); $this->fields[$name][2] = 20; $this->allfields[$name][2] = 20; $column = new GtkTreeViewColumn($text); $cell_renderer = new GtkCellRendererText(); $cell_renderer->set_property('width', $size); $column->set_fixed_width($size); $column->pack_start($cell_renderer, true); $column->add_attribute($cell_renderer, 'text', $this->count); $this->types[] = GObject::TYPE_STRING; $this->view->append_column($column); $this->allfields[$tname] = array($text, $object, $size, TRUE, $mandatory); $this->columns[$tname] = $this->count; $this->count++; } }
public function treeviewLoadXML($file, $mainObject = NULL) { // Lê o XML // @since rev 1 $xml = new SimpleXMLElement(file_get_contents($file)); // Cria o frame, o scrool e o treeview // @since rev 1 $treeviewName = (string) $xml['name']; $obj['treeview'] = new GtkTreeView(); $scrolled = new GtkScrolledWindow(); $scrolled->add($obj['treeview']); $obj['object'] = new GtkFrame(); $obj['object']->add($scrolled); // Verifica o modo do scroll horizontal // @since rev 1 switch (strtoupper((string) $xml['hscroll'])) { case "TRUE": $hscroll = Gtk::POLICY_ALWAYS; break; case "FALSE": $hscroll = Gtk::POLICY_NEVER; break; case "AUTO": default: $hscroll = Gtk::POLICY_AUTOMATIC; break; } // Verifica o modo do scroll vertical // @since rev 1 switch (strtoupper((string) $xml['vscroll'])) { case "TRUE": $vscroll = Gtk::POLICY_ALWAYS; break; case "FALSE": $vscroll = Gtk::POLICY_NEVER; break; case "AUTO": default: $vscroll = Gtk::POLICY_AUTOMATIC; break; } // Configura os scrolls // @since rev 1 $scrolled->set_policy($hscroll, $vscroll); // Configura o tamanho // @since rev 1 $width = isset($xml['width']) ? (int) $xml['width'] : FALSE; $height = isset($xml['height']) ? (int) $xml['height'] : FALSE; $scrolled->set_size_request($width, $height); // Seta a coluna para a busca // @since rev 1 $searchcolumn = isset($xml['searchcolumn']) ? (int) $xml['searchcolumn'] : 0; $obj['treeview']->set_search_column($searchcolumn); // Configura a visibilidade do header da coluna // @since rev 1 switch (strtoupper((string) $xml['hvisible'])) { case "FALSE": $hvisible = FALSE; break; case "TRUE": default: $hvisible = TRUE; break; } $obj['treeview']->set_headers_visible($hvisible); // Verifica se existe evento button-press-event // @since rev 1 $buttonpressevent = (string) $xml['buttonpressevent']; if (strlen($buttonpressevent) > 0) { // Verifica se é orientado à objeto // @since rev 1 if ($mainObject != NULL) { $function = array($mainObject, $buttonpressevent); } else { $function = $buttonpressevent; } $obj['treeview']->connect("button-press-event", $function); } // Verifica se existe evento cursor-changed // @since rev 1 $cursorchanged = (string) $xml['cursorchanged']; if (strlen($cursorchanged) > 0) { // Verifica se é orientado à objeto // @since rev 1 if ($mainObject != NULL) { $function = array($mainObject, $cursorchanged); } else { $function = $cursorchanged; } $obj['treeview']->connect("cursor-changed", $function); } // Percorre as configurações // @since rev 1 foreach ($xml as $configs) { // Verifica o tipo de configuração // @since rev 1 if ($configs->getName() == "columns") { // Percorre as colunas // @since rev 1 $counter = 0; $columnModel = array(); foreach ($configs as $column) { // Busca as configurações $title = (string) $column['title']; $visible = (string) $column['visible']; // Cria a coluna // @since rev 1 $modelType = Gobject::TYPE_STRING; if (strtoupper($visible) != "FALSE") { // Verifica o tipo e o render // @since rev 1 switch (strtoupper((string) $column['type'])) { // Toggle // @since rev 1 case "TOGGLE": // Cria o render // @since rev 1 $render = new GtkCellRendererToggle(); $render->set_property("activatable", TRUE); // Verifica se deve usar o autocheck // @since rev 1 switch (strtoupper((string) $column['autocheck'])) { case "FALSE": break; case "TRUE": default: $render->connect("toggled", array("FTreeViews", "on_toggle"), $obj['treeview'], $counter); break; } // Verifica se existe evento onclick da coluna // @since rev 1 $onclick = (string) $column['onclick']; if (strlen($onclick) > 0) { // Verifica se é orientado à objeto // @since rev 1 if ($mainObject != NULL) { $function = array($mainObject, $onclick); } else { $function = $onclick; } $render->connect("toggled", $function, $obj['treeview'], $counter); } // Armazena o atributo e o model // @since rev 1 $attribute = "active"; $modelType = Gobject::TYPE_BOOLEAN; break; // Texto // @since rev 1 // Texto // @since rev 1 case "TEXT": default: $render = new GtkCellRendererText(); // Verifica se a coluna é editavel // @since rev 1 switch (strtoupper((string) $column['editable'])) { case "TRUE": $render->set_property("editable", TRUE); break; case "FALSE": default: break; } // Verifica se existe sinal para edição // @since rev 1 $onedited = (string) $column['onedited']; if (strlen($onedited) > 0) { // Verifica se é orientado à objeto // @since rev 1 if ($mainObject != NULL) { $function = array($mainObject, $onedited); } else { $function = $onedited; } $render->connect("edited", $function, $obj['treeview'], $counter); } $attribute = "text"; $modelType = Gobject::TYPE_STRING; } // Cria a coluna // @since rev 1 $trvColumn = new GtkTreeViewColumn($title, $render, $attribute, $counter); $obj['treeview']->append_column($trvColumn); // Verifica se existe parametrização do tamanho // @since rev 1 if (isset($column['width'])) { $trvColumn->set_fixed_width((int) $column['width']); $trvColumn->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); } // Verifica se existe parametrização da formatação if (isset($column['onformat'])) { $onformat = (string) $column['onformat']; // Verifica se é orientado à objeto if ($mainObject != NULL) { $function = array($mainObject, $onformat); } else { $function = $onformat; } $trvColumn->set_cell_data_func($render, $function, $counter); } } // Armazena o model // @since rev 1 $columnModel[$counter++] = $modelType; } // Seta o model // @since rev 1 $model = new GtkTreeStore(); $model->set_column_types($columnModel); $obj['treeview']->set_model($model); } } return $obj; }
/** * Cria o treeview apartir de um XML * * @name treeviewLoadXML * @param string $file Caminho do arquivo XML com as definições do treeview * @param object $mainObject Objeto onde está os métodos callback do treeview */ public function treeviewLoadXML($file, $mainObject = NULL) { // Lê o XML $xml = new SimpleXMLElement(file_get_contents($file)); // Seta a coluna para a busca $searchcolumn = isset($xml['searchcolumn']) ? (int) $xml['searchcolumn'] : 0; parent::set_search_column($searchcolumn); // Configura a visibilidade do header da coluna switch (strtoupper((string) $xml['hvisible'])) { case "FALSE": $hvisible = FALSE; break; case "TRUE": default: $hvisible = TRUE; break; } parent::set_headers_visible($hvisible); // Verifica se existe evento button-press-event $buttonpressevent = (string) $xml['buttonpressevent']; if (strlen($buttonpressevent) > 0) { // Verifica se é orientado à objeto if ($mainObject != NULL) { // Cria o método callback $function = array($mainObject, $buttonpressevent); } else { // Cria a função callback $function = $buttonpressevent; } parent::connect("button-press-event", $function); } // Verifica se existe evento cursor-changed $cursorchanged = (string) $xml['cursorchanged']; if (strlen($cursorchanged) > 0) { // Verifica se é orientado à objeto if ($mainObject != NULL) { // Cria o método callback $function = array($mainObject, $cursorchanged); } else { // Cria a função callback $function = $cursorchanged; } parent::connect("cursor-changed", $function); } // Percorre as configurações foreach ($xml as $configs) { // Verifica se são as configurações das colunas if ($configs->getName() == "columns") { // Percorre as colunas $counter = 0; $columnModel = array(); foreach ($configs as $column) { // Busca as configurações $title = (string) $column['title']; $visible = (string) $column['visible']; // Cria a coluna $modelType = Gobject::TYPE_STRING; if (strtoupper($visible) != "FALSE") { // Verifica o tipo e o render switch (strtoupper((string) $column['type'])) { // Toggle case "TOGGLE": // Cria o render $render = new GtkCellRendererToggle(); $render->set_property("activatable", TRUE); // Verifica se deve usar o autocheck switch (strtoupper((string) $column['autocheck'])) { case "FALSE": break; case "TRUE": default: $render->connect("toggled", array($this, "__onToggle"), $counter); break; } // Verifica se existe evento onclick da coluna $onclick = (string) $column['onclick']; if (strlen($onclick) > 0) { // Verifica se é orientado à objeto if ($mainObject != NULL) { // Cria o método callback $function = array($mainObject, $onclick); } else { // Cria a função callback $function = $onclick; } // Conecta o callback de check $render->connect("toggled", $function, $counter); } // Armazena o atributo e o model $attribute = "active"; $modelType = Gobject::TYPE_BOOLEAN; break; // Texto // Texto case "TEXT": default: $render = new GtkCellRendererText(); // Verifica se a coluna é editavel switch (strtoupper((string) $column['editable'])) { case "TRUE": $render->set_property("editable", TRUE); break; case "FALSE": default: break; } // Verifica se existe sinal para edição $onedited = (string) $column['onedited']; if (strlen($onedited) > 0) { // Verifica se é orientado à objeto if ($mainObject != NULL) { // Cria o método callback $function = array($mainObject, $onedited); } else { // Cria a função callback $function = $onedited; } // Conecta a coluna ao callback $render->connect("edited", $function, $this, $counter); } // Armazena os atributos $attribute = "text"; $modelType = Gobject::TYPE_STRING; } // Cria a coluna com as configurações $trvColumn = new GtkTreeViewColumn($title, $render, $attribute, $counter); parent::append_column($trvColumn); // Verifica se existe parametrização do tamanho da coluna if (isset($column['width'])) { $trvColumn->set_fixed_width((int) $column['width']); $trvColumn->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); } // Verifica se existe parametrização da formatação if (isset($column['onformat'])) { $onformat = (string) $column['onformat']; // Verifica se é orientado à objeto if ($mainObject != NULL) { // Cria o método callback $function = array($mainObject, $onformat); } else { // Cria a função callback $function = $onformat; } // Conecta o callback de renderização $trvColumn->set_cell_data_func($render, $function, $counter); } } // Armazena o model $columnModel[$counter++] = $modelType; } // Seta o model $model = new GtkTreeStore(); $model->set_column_types($columnModel); parent::set_model($model); } } }