CGUIFileOpenDialog.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
  5. #define __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
  6. #include "IrrCompileConfig.h"
  7. #ifdef _IRR_COMPILE_WITH_GUI_
  8. #include "IGUIFileOpenDialog.h"
  9. #include "IGUIButton.h"
  10. #include "IGUIListBox.h"
  11. #include "IGUIEditBox.h"
  12. #include "IFileSystem.h"
  13. namespace irr
  14. {
  15. namespace gui
  16. {
  17. class CGUIFileOpenDialog : public IGUIFileOpenDialog
  18. {
  19. public:
  20. //! constructor
  21. CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* environment,
  22. IGUIElement* parent, s32 id, bool restoreCWD=false,
  23. io::path::char_type* startDir=0);
  24. //! destructor
  25. virtual ~CGUIFileOpenDialog();
  26. //! returns the filename of the selected file. Returns NULL, if no file was selected.
  27. virtual const wchar_t* getFileName() const;
  28. //! Returns the directory of the selected file. Returns NULL, if no directory was selected.
  29. virtual const io::path& getDirectoryName();
  30. //! called if an event happened.
  31. virtual bool OnEvent(const SEvent& event);
  32. //! draws the element and its children
  33. virtual void draw();
  34. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
  35. virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
  36. protected:
  37. //! fills the listbox with files.
  38. void fillListBox();
  39. //! sends the event that the file has been selected.
  40. void sendSelectedEvent( EGUI_EVENT_TYPE type );
  41. //! sends the event that the file choose process has been canceld
  42. void sendCancelEvent();
  43. core::position2d<s32> DragStart;
  44. core::stringw FileName;
  45. io::path FileDirectory;
  46. io::path RestoreDirectory;
  47. io::path StartDirectory;
  48. IGUIButton* CloseButton;
  49. IGUIButton* OKButton;
  50. IGUIButton* CancelButton;
  51. IGUIListBox* FileBox;
  52. IGUIEditBox* FileNameText;
  53. IGUIElement* EventParent;
  54. io::IFileSystem* FileSystem;
  55. io::IFileList* FileList;
  56. bool Dragging;
  57. };
  58. } // end namespace gui
  59. } // end namespace irr
  60. #endif // _IRR_COMPILE_WITH_GUI_
  61. #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__