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 // frmConfig.h - Configuration tool
9 //
10 //////////////////////////////////////////////////////////////////////////
11 
12 #ifndef FRMCONFIG_H
13 #define FRMCONFIG_H
14 
15 #include <wx/textbuf.h>
16 
17 class pgConn;
18 class ctlListView;
19 class frmMain;
20 
21 
22 extern wxImageList *configImageList;
23 
24 class frmConfig : public pgFrame
25 {
26 public:
27 
28 	enum tryMode
29 	{
30 		NONE = 0,
31 		ANYFILE,
32 		HBAFILE,
33 		MAINFILE,
34 		PGPASSFILE
35 	};
36 
37 	static frmConfig *Create(const wxString &title, const wxString &configFile, tryMode mode);
38 	void Go();
39 	void DoOpen(const wxString &fn = wxEmptyString);
40 
41 
42 protected:
43 	frmConfig(const wxString &title, const wxString &configFile);
44 	frmConfig(frmMain *parent, const wxString &title, pgConn *conn);
45 	~frmConfig();
46 
47 	virtual void DisplayFile(const wxString &str) = 0;
48 	virtual void WriteFile(pgConn *conn = 0) = 0;
GetHintString()49 	virtual wxString GetHintString()
50 	{
51 		return wxEmptyString;
52 	}
53 
54 	void OpenLastFile();
55 	void InitFrame(const wxChar *frameName);
56 	bool DoWriteFile(const wxChar *str, pgConn *conn);
57 	bool CheckChanged(bool canVeto);
58 
59 private:
60 
61 	virtual void OnOpen(wxCommandEvent &event);
62 	void OnSave(wxCommandEvent &event);
63 	void OnSaveAs(wxCommandEvent &event);
64 
65 	void OnClose(wxCloseEvent &event);
66 	void OnExecute(wxCommandEvent &event);
67 	void OnHelp(wxCommandEvent &event);
68 	void OnHint(wxCommandEvent &event);
69 	void OnBugreport(wxCommandEvent &event);
70 
71 	void DisplayHint(bool force);
72 
73 protected:
74 	pgConn *conn;
75 	frmMain *mainForm;
76 	wxString serverFileName;
77 
78 	wxTextFileType filetype;
79 
80 	DECLARE_EVENT_TABLE()
81 };
82 
83 
84 
85 #endif
86