Add tabbed interface for switching between database aspects

Such as tables, views, stored procedures, et cetera.
This commit is contained in:
Timothy Warren 2012-03-28 16:10:39 -04:00
parent 382fb8e711
commit a368285710
2 changed files with 64 additions and 11 deletions

View File

@ -150,7 +150,7 @@ class Main extends GtkWindow {
$scrolled_win = new GtkScrolledWindow();
$scrolled_win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
$scrolled_win->add(new Data_Grid());
$scrolled_win->add_with_viewport(new DB_tabs());
// Add the connection sidebar
$this->connection_sidebar =& Connection_Sidebar::get_instance();

View File

@ -0,0 +1,53 @@
<?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
*/
// --------------------------------------------------------------------------
/**
* Tabbed Container for database properties
*/
class DB_tabs extends GTKNotebook {
/**
* Create the object
*/
public function __construct()
{
parent::__construct();
// Move the tab bar to the bottom
$this->set_tab_pos(Gtk::POS_BOTTOM);
$this->add_tab('Tables');
}
// --------------------------------------------------------------------------
/**
* Add a new tab with the provided label
*
* @param string $label
* @param GObject $widget
* @return void
*/
public function add_tab($label, $widget = NULL)
{
if (is_null($widget))
{
$widget = new Data_Grid();
}
$this->append_page($widget, new GtkLabel($label));
}
}
// End of db_tabs.php