2012-03-28 15:13:34 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* OpenSQLManager
|
|
|
|
*
|
|
|
|
* Free Database manager for Open Source Databases
|
|
|
|
*
|
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @link https://github.com/aviat4ion/OpenSQLManager
|
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
*Class to simplify dealing with GtkTreeView
|
|
|
|
*/
|
|
|
|
class Data_Grid extends GtkTreeView {
|
|
|
|
|
|
|
|
protected $model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create the object
|
2012-03-29 16:26:50 -04:00
|
|
|
*
|
|
|
|
* @param object $model
|
2012-03-28 15:13:34 -04:00
|
|
|
*/
|
2012-03-29 16:26:50 -04:00
|
|
|
public function __construct($model = null)
|
2012-03-28 15:13:34 -04:00
|
|
|
{
|
2012-03-29 16:26:50 -04:00
|
|
|
$this->model = ( ! is_null($model))
|
|
|
|
? $model
|
|
|
|
: new GtkTreeStore(Gobject::TYPE_PHP_VALUE, Gobject::TYPE_PHP_VALUE);
|
|
|
|
|
2012-03-28 15:13:34 -04:00
|
|
|
parent::__construct($this->model);
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the value of the cell at the provided coordinate array
|
|
|
|
*
|
|
|
|
* @param array $coord
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function get(array $coord)
|
|
|
|
{
|
|
|
|
// @todo implement
|
|
|
|
}
|
2012-03-29 16:26:50 -04:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the value of the cell at the provided coordinate array
|
|
|
|
*
|
|
|
|
* @param array $coord
|
|
|
|
* @param mixed $val
|
|
|
|
*/
|
|
|
|
public function set(array $coord, $val)
|
|
|
|
{
|
|
|
|
// @todo implement
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
2012-03-29 19:57:10 -04:00
|
|
|
* Empty the model
|
2012-03-29 16:26:50 -04:00
|
|
|
*/
|
|
|
|
public function reset($model = null)
|
|
|
|
{
|
2012-03-29 19:57:10 -04:00
|
|
|
$this->model->clear();
|
2012-03-30 10:13:16 -04:00
|
|
|
|
|
|
|
$cols = $this->get_columns();
|
|
|
|
|
|
|
|
foreach($cols as $c)
|
|
|
|
{
|
|
|
|
$this->remove_column($c);
|
|
|
|
}
|
2012-03-29 16:26:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// End of data_grid.php
|