Started Fleshing out add db connection window

This commit is contained in:
Timothy Warren 2012-01-31 12:42:38 -05:00
parent 59f6061a5f
commit 97196ac6c3
2 changed files with 49 additions and 0 deletions

View File

@ -20,6 +20,48 @@ class Add_DB extends GtkWindow {
function __construct()
{
parent::__construct();
$this->set_title("OpenSQLManager - Add Database Connection");
$this->resize(400, 300);
// Add the Vbox, and show the window
$this->add($this->_layout());
$this->show_all();
}
/**
* Window layout
*
* @return GtkVBox
*/
private function _layout()
{
$table = new GtkTable();
$db_types = array(
'MySQL',
'PostgreSQL',
'SQLite',
'ODBC'
);
//Row 1 - Database type
$dbtypelbl = new GtkLabel("Database Type");
$dbtype = GtkComboBox::new_text();
$align = new GtkAlignment(0, 0.5, 0, 0);
$align->add($dbtypelbl);
foreach($db_types as $t)
{
$dbtype->append_text($t);
}
$table->attach($align, 0,1,0,1);
$table->attach($dbtype, 1,2,0,1);
return $table;
}
}

View File

@ -210,6 +210,8 @@ class Main extends GtkWindow {
$add_button->set_label("New Connnection");
$add_button->set_image(GTKImage::new_from_stock(GTK::STOCK_ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
$add_button->connect_simple('clicked', array($this, 'new_conn'));
$conn_vbox = new GtkVBox();
$conn_vbox->pack_start($dblabel, FALSE);
@ -217,6 +219,11 @@ class Main extends GtkWindow {
return $conn_vbox;
}
function new_conn()
{
return new Add_DB();
}
}