1 //////////////////////////////////////////////////////////////////////////
2 //
3 // pgAdmin III - PostgreSQL Tools
4 //
5 // Copyright (C) 2002 - 2016, The pgAdmin Development Team
6 // This software is released under the PostgreSQL Licence
7 //
8 // dlgSelectDatabase.h - Connect to a database
9 //
10 //////////////////////////////////////////////////////////////////////////
11 
12 #ifndef DLGSELECTDATABASE_H
13 #define DLGSELECTDATABASE_H
14 
15 #include <wx/wx.h>
16 #include <wx/image.h>
17 #include <wx/treectrl.h>
18 
19 
20 class pgServer;
21 
22 
23 class dlgSelDBNode : public wxTreeItemData
24 {
25 
26 public:
27 	dlgSelDBNode(pgServer *server, const wxString &dbname = wxEmptyString);
28 	dlgSelDBNode *createChild(const wxString &dbName);
29 
getDatabase()30 	wxString getDatabase()
31 	{
32 		return dbname;
33 	}
34 	wxString getConnectionString();
35 
36 private:
37 	pgServer        *server;  // Do not remove it, not owned by this
38 	wxString         dbname;
39 
40 	friend class dlgSelectDatabase;
41 
42 };
43 
44 
45 class dlgSelectDatabase: public wxDialog
46 {
47 
48 public:
49 	dlgSelectDatabase(wxWindow *parent, int id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxCLOSE_BOX);
50 
51 	wxString getConnInfo();
52 	static bool getValidConnectionString(wxString connStr, wxString &resultStr);
53 
54 protected:
55 	void Initialize();
56 	void OnSelect(wxTreeEvent &ev);
57 	void OnSelActivate(wxTreeEvent &ev);
58 
59 	wxTreeCtrl *tcServers;
60 	dlgSelDBNode *selectedConn;
61 
62 	DECLARE_EVENT_TABLE()
63 };
64 
65 #endif
66 
67