1 /*
2 guiFileSelectMenu.h
3 Copyright (C) 2013 sapier
4 */
5 
6 /*
7 This file is part of Freeminer.
8 
9 Freeminer is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Freeminer  is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Freeminer.  If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef GUIFILESELECTMENU_H_
24 #define GUIFILESELECTMENU_H_
25 
26 #include <string>
27 
28 #include "modalMenu.h"
29 #include "IGUIFileOpenDialog.h"
30 #include "guiFormSpecMenu.h" //required because of TextDest only !!!
31 
32 
33 class GUIFileSelectMenu: public GUIModalMenu
34 {
35 public:
36 	GUIFileSelectMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
37 			s32 id, IMenuManager *menumgr,
38 			std::string title,
39 			std::string formid);
40 	~GUIFileSelectMenu();
41 
42 	void removeChildren();
43 
44 	/*
45 	 Remove and re-add (or reposition) stuff
46 	 */
47 	void regenerateGui(v2u32 screensize);
48 
49 	void drawMenu();
50 
51 	bool OnEvent(const SEvent& event);
52 
isRunning()53 	bool isRunning() {
54 		return m_running;
55 	}
56 
setTextDest(TextDest * dest)57 	void setTextDest(TextDest * dest) {
58 		m_text_dst = dest;
59 	}
60 
61 private:
62 	void acceptInput();
63 
64 	std::wstring m_title;
65 	bool m_accepted;
66 	gui::IGUIElement* m_parent;
67 
68 	std::string m_selectedPath;
69 
70 	gui::IGUIFileOpenDialog* m_fileOpenDialog;
71 
72 	bool m_running;
73 
74 	TextDest *m_text_dst;
75 
76 	std::string m_formname;
77 };
78 
79 
80 
81 #endif /* GUIFILESELECTMENU_H_ */
82