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 5 #ifndef __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__ 6 #define __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__ 7 8 #include "IrrCompileConfig.h" 9 #ifdef _IRR_COMPILE_WITH_GUI_ 10 11 #include "IGUIFileOpenDialog.h" 12 #include "IGUIButton.h" 13 #include "IGUIListBox.h" 14 #include "IGUIEditBox.h" 15 #include "IFileSystem.h" 16 17 namespace irr 18 { 19 namespace gui 20 { 21 22 class CGUIFileOpenDialog : public IGUIFileOpenDialog 23 { 24 public: 25 26 //! constructor 27 CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* environment, 28 IGUIElement* parent, s32 id, bool restoreCWD=false, 29 io::path::char_type* startDir=0); 30 31 //! destructor 32 virtual ~CGUIFileOpenDialog(); 33 34 //! returns the filename of the selected file. Returns NULL, if no file was selected. 35 virtual const wchar_t* getFileName() const; 36 37 //! Returns the directory of the selected file. Returns NULL, if no directory was selected. 38 virtual const io::path& getDirectoryName(); 39 40 //! called if an event happened. 41 virtual bool OnEvent(const SEvent& event); 42 43 //! draws the element and its children 44 virtual void draw(); 45 46 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; 47 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); 48 49 protected: 50 51 //! fills the listbox with files. 52 void fillListBox(); 53 54 //! sends the event that the file has been selected. 55 void sendSelectedEvent( EGUI_EVENT_TYPE type ); 56 57 //! sends the event that the file choose process has been canceld 58 void sendCancelEvent(); 59 60 core::position2d<s32> DragStart; 61 core::stringw FileName; 62 io::path FileDirectory; 63 io::path RestoreDirectory; 64 io::path StartDirectory; 65 66 IGUIButton* CloseButton; 67 IGUIButton* OKButton; 68 IGUIButton* CancelButton; 69 IGUIListBox* FileBox; 70 IGUIEditBox* FileNameText; 71 IGUIElement* EventParent; 72 io::IFileSystem* FileSystem; 73 io::IFileList* FileList; 74 bool Dragging; 75 }; 76 77 78 } // end namespace gui 79 } // end namespace irr 80 81 #endif // _IRR_COMPILE_WITH_GUI_ 82 83 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__ 84 85