2012-04-11 11:16:44 -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
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Popup window to display database table data
|
|
|
|
*/
|
|
|
|
class DB_Table_Data extends GTKWindow {
|
|
|
|
|
2012-04-19 12:29:47 -04:00
|
|
|
/**
|
|
|
|
* Reference to the scrolled window
|
2012-04-19 21:55:44 -04:00
|
|
|
*
|
|
|
|
* @var GtkScrolledWindow
|
2012-04-19 12:29:47 -04:00
|
|
|
*/
|
2012-04-11 11:16:44 -04:00
|
|
|
protected $win;
|
|
|
|
|
2012-04-19 12:29:47 -04:00
|
|
|
/**
|
|
|
|
* Create and populate the window
|
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
* @return void
|
|
|
|
*/
|
2012-04-11 11:16:44 -04:00
|
|
|
public function __construct($data)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->set_title("Table Data");
|
|
|
|
$this->set_position(Gtk::WIN_POS_CENTER_ALWAYS);
|
|
|
|
$this->set_destroy_with_parent(TRUE);
|
2012-04-11 14:57:38 -04:00
|
|
|
|
|
|
|
// Add the scrolled window
|
2012-04-11 11:16:44 -04:00
|
|
|
$this->win = new GTKScrolledWindow();
|
|
|
|
$this->win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
|
|
|
$this->add($this->win);
|
|
|
|
|
|
|
|
// Resize to a sane size
|
|
|
|
$this->set_size_request(640, 480);
|
|
|
|
|
2012-04-11 14:57:38 -04:00
|
|
|
// Layout the widgets
|
2012-04-11 12:50:06 -04:00
|
|
|
$view = new Data_Grid();
|
|
|
|
$view->render_data($data);
|
2012-04-11 11:16:44 -04:00
|
|
|
|
|
|
|
// Add the grid to the window
|
|
|
|
$this->win->add_with_viewport($view);
|
|
|
|
|
2012-04-11 14:57:38 -04:00
|
|
|
// Show everything
|
2012-04-11 11:16:44 -04:00
|
|
|
$this->show_all();
|
|
|
|
}
|
|
|
|
}
|