1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
\r
6 #define __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
9 #ifdef _IRR_COMPILE_WITH_GUI_
\r
11 #include "IGUIFileOpenDialog.h"
\r
12 #include "IGUIButton.h"
\r
13 #include "IGUIListBox.h"
\r
14 #include "IGUIEditBox.h"
\r
15 #include "IFileSystem.h"
\r
22 class CGUIFileOpenDialog : public IGUIFileOpenDialog
\r
27 CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* environment,
\r
28 IGUIElement* parent, s32 id, bool restoreCWD=false,
\r
29 io::path::char_type* startDir=0);
\r
32 virtual ~CGUIFileOpenDialog();
\r
34 //! returns the filename of the selected file. Returns NULL, if no file was selected.
\r
35 virtual const wchar_t* getFileName() const _IRR_OVERRIDE_;
\r
37 //! Returns the filename of the selected file. Is empty if no file was selected.
\r
38 virtual const io::path& getFileNameP() const _IRR_OVERRIDE_;
\r
40 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.
\r
41 virtual const io::path& getDirectoryName() const _IRR_OVERRIDE_;
\r
43 //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected.
\r
44 virtual const wchar_t* getDirectoryNameW() const _IRR_OVERRIDE_;
\r
46 //! called if an event happened.
\r
47 virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;
\r
49 //! draws the element and its children
\r
50 virtual void draw() _IRR_OVERRIDE_;
\r
52 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
\r
53 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
\r
57 void setFileName(const irr::io::path& name);
\r
58 void setDirectoryName(const irr::io::path& name);
\r
60 //! Ensure filenames are converted correct depending on wide-char settings
\r
61 void pathToStringW(irr::core::stringw& result, const irr::io::path& p);
\r
63 //! fills the listbox with files.
\r
66 //! sends the event that the file has been selected.
\r
67 void sendSelectedEvent( EGUI_EVENT_TYPE type );
\r
69 //! sends the event that the file choose process has been canceld
\r
70 void sendCancelEvent();
\r
72 core::position2d<s32> DragStart;
\r
74 core::stringw FileNameW;
\r
75 io::path FileDirectory;
\r
76 io::path FileDirectoryFlat;
\r
77 core::stringw FileDirectoryFlatW;
\r
78 io::path RestoreDirectory;
\r
79 io::path StartDirectory;
\r
81 IGUIButton* CloseButton;
\r
82 IGUIButton* OKButton;
\r
83 IGUIButton* CancelButton;
\r
84 IGUIListBox* FileBox;
\r
85 IGUIEditBox* FileNameText;
\r
86 IGUIElement* EventParent;
\r
87 io::IFileSystem* FileSystem;
\r
88 io::IFileList* FileList;
\r
93 } // end namespace gui
\r
94 } // end namespace irr
\r
96 #endif // _IRR_COMPILE_WITH_GUI_
\r
98 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
\r