model = ( ! is_null($model)) ? $model : new GtkTreeStore(Gobject::TYPE_PHP_VALUE); parent::__construct($this->model); } // -------------------------------------------------------------------------- /** * Get the value of the model for the current selection * * @param int pos * @return mixed */ public function get($pos = 0) { // Get the selection object of the row $sel = $this->get_selection(); // Get the model and iterator for the selected row list($model, $iter) = $sel->get_selected(); // Return on lack of $iter if (is_null($iter)) { return; } // Get the data from the model return $model->get_value($iter, $pos); } // -------------------------------------------------------------------------- /** * Empty the model */ public function reset() { $this->model->clear(); $cols = $this->get_columns(); foreach($cols as $c) { $this->remove_column($c); } } } // End of data_grid.php