
///////////////////////////////////////////////////////////
//                                                       //
//                         SAGA                          //
//                                                       //
//      System for Automated Geoscientific Analyses      //
//                                                       //
//                    User Interface                     //
//                                                       //
//                    Program: SAGA                      //
//                                                       //
//-------------------------------------------------------//
//                                                       //
//                wksp_database_menu.h                   //
//                                                       //
//          Copyright (C) 2008 by Stefan Liersch         //
//                                                       //
//-------------------------------------------------------//
//                                                       //
// This file is part of 'SAGA - System for Automated     //
// Geoscientific Analyses'. SAGA is free software; you   //
// can redistribute it and/or modify it under the terms  //
// of the GNU General Public License as published by the //
// Free Software Foundation; version 2 of the License.   //
//                                                       //
// SAGA is distributed in the hope that it will be       //
// useful, but WITHOUT ANY WARRANTY; without even the    //
// implied warranty of MERCHANTABILITY or FITNESS FOR A  //
// PARTICULAR PURPOSE. See the GNU General Public        //
// License for more details.                             //
//                                                       //
// You should have received a copy of the GNU General    //
// Public License along with this program; if not,       //
// write to the Free Software Foundation, Inc.,          //
// 59 Temple Place - Suite 330, Boston, MA 02111-1307,   //
// USA.                                                  //
//                                                       //
//-------------------------------------------------------//
//                                                       //
//    contact:    Olaf Conrad                            //
//                Institute of Geography                 //
//                University of Goettingen               //
//                Goldschmidtstr. 5                      //
//                37077 Goettingen                       //
//                Germany                                //
//                                                       //
//    e-mail:     oconrad@saga-gis.org                   //
//                                                       //
///////////////////////////////////////////////////////////

//---------------------------------------------------------


///////////////////////////////////////////////////////////
//														 //
//														 //
//														 //
///////////////////////////////////////////////////////////

//---------------------------------------------------------
#ifndef _HEADER_INCLUDED__SAGA_GUI__WKSP_Database_Menu_H
#define _HEADER_INCLUDED__SAGA_GUI__WKSP_Database_Menu_H


///////////////////////////////////////////////////////////
//														 //
//														 //
//														 //
///////////////////////////////////////////////////////////

#include "saga_gui/saga_frame.h"		// location of class Cpgdatabase
										// using global *g_pSAGA_Frame pointer


#include "pgsql/pgdatabase.h"
#include "pgsql/sqltable.h"

//---------------------------------------------------------------------

class ConnectionParameters
{
public:
	// Database connection parameters
	std::string		host;
	std::string		hostaddr;
	std::string		port;
	std::string		options;
	std::string		tty;
	std::string		dbname;
	std::string		user;
	std::string		password;
};
//---------------------------------------------------------------------

//---------------------------------------------------------
class CWKSP_Database_Menu
{
public:
	CWKSP_Database_Menu(void);
	virtual ~CWKSP_Database_Menu(void);

	void					Destroy				(void);

	void					Add					(class wxMenu *pMenu);
	void					Del					(class wxMenu *pMenu);

	void					Update				(void);


	void					On_Command			(wxCommandEvent& event);



private:

	void					_Update				(class wxMenu *pMenu);

	void					_EnableDisableMenu	(bool bconnected, wxMenu* pMenu);

	// --------------------------------------------------------------
	// Event handler funcions
	void					_On_ConnectDB		(wxCommandEvent& event);

	// --------------------------------------------------------------
	// helper functions
	std::string				_GenerateConnectionString(ConnectionParameters connParms);


	wxMenu					*m_pDB_Menu;

	int						m_nMenus;

	class wxMenu			**m_Menus;


	ConnectionParameters	connParms;

};
#endif /* _HEADER_INCLUDED__SAGA_GUI__WKSP_Database_Menu_H */
