/** * Add an Action to the DataGrid * @param $object A TDataGridAction object */ public function addAction(TDataGridAction $action) { $this->actions[] = $action; $button = new GtkButton($action->getLabel()); if (file_exists('lib/adianti/images/' . $action->getImage())) { $button->set_image(GtkImage::new_from_file('lib/adianti/images/' . $action->getImage())); } else { $button->set_image(GtkImage::new_from_file('app/images/' . $action->getImage())); } $button->connect_simple('clicked', array($this, 'onExecute'), $action); $this->action_area->pack_start($button); }
/** * Add an Action to the DataGrid * @param $object A TDataGridAction object */ public function addAction(TDataGridAction $action) { if ($this->modelCreated) { throw new Exception(TAdiantiCoreTranslator::translate('You must call ^1 before ^2', __METHOD__, 'createModel')); } else { $this->actions[] = $action; $button = new GtkButton($action->getLabel()); if (file_exists('lib/adianti/images/' . $action->getImage())) { $button->set_image(GtkImage::new_from_file('lib/adianti/images/' . $action->getImage())); } else { $button->set_image(GtkImage::new_from_file('app/images/' . $action->getImage())); } $button->connect_simple('clicked', array($this, 'onExecute'), $action); $this->action_area->pack_start($button); } }