guiFileSelectMenu.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. Minetest
  3. Copyright (C) 2013 sapier
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef GUIFILESELECTMENU_H_
  17. #define GUIFILESELECTMENU_H_
  18. #include <string>
  19. #include "modalMenu.h"
  20. #include "IGUIFileOpenDialog.h"
  21. #include "guiFormSpecMenu.h" //required because of TextDest only !!!
  22. class GUIFileSelectMenu: public GUIModalMenu
  23. {
  24. public:
  25. GUIFileSelectMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
  26. s32 id, IMenuManager *menumgr,
  27. std::string title,
  28. std::string formid);
  29. ~GUIFileSelectMenu();
  30. void removeChildren();
  31. /*
  32. Remove and re-add (or reposition) stuff
  33. */
  34. void regenerateGui(v2u32 screensize);
  35. void drawMenu();
  36. bool OnEvent(const SEvent& event);
  37. bool isRunning() {
  38. return m_running;
  39. }
  40. void setTextDest(TextDest * dest) {
  41. m_text_dst = dest;
  42. }
  43. private:
  44. void acceptInput();
  45. std::wstring m_title;
  46. bool m_accepted;
  47. gui::IGUIElement* m_parent;
  48. std::string m_selectedPath;
  49. gui::IGUIFileOpenDialog* m_fileOpenDialog;
  50. bool m_running;
  51. TextDest *m_text_dst;
  52. std::string m_formname;
  53. };
  54. #endif /* GUIFILESELECTMENU_H_ */