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 const wchar_t* getFileName() const override;
\r
37 //! Returns the filename of the selected file. Is empty if no file was selected.
\r
38 const io::path& getFileNameP() const override;
\r
40 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.
\r
41 const io::path& getDirectoryName() const override;
\r
43 //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected.
\r
44 const wchar_t* getDirectoryNameW() const override;
\r
46 //! called if an event happened.
\r
47 bool OnEvent(const SEvent& event) override;
\r
49 //! draws the element and its children
\r
50 void draw() override;
\r
54 void setFileName(const irr::io::path& name);
\r
55 void setDirectoryName(const irr::io::path& name);
\r
57 //! Ensure filenames are converted correct depending on wide-char settings
\r
58 void pathToStringW(irr::core::stringw& result, const irr::io::path& p);
\r
60 //! fills the listbox with files.
\r
63 //! sends the event that the file has been selected.
\r
64 void sendSelectedEvent( EGUI_EVENT_TYPE type );
\r
66 //! sends the event that the file choose process has been canceld
\r
67 void sendCancelEvent();
\r
69 core::position2d<s32> DragStart;
\r
71 core::stringw FileNameW;
\r
72 io::path FileDirectory;
\r
73 io::path FileDirectoryFlat;
\r
74 core::stringw FileDirectoryFlatW;
\r
75 io::path RestoreDirectory;
\r
76 io::path StartDirectory;
\r
78 IGUIButton* CloseButton;
\r
79 IGUIButton* OKButton;
\r
80 IGUIButton* CancelButton;
\r
81 IGUIListBox* FileBox;
\r
82 IGUIEditBox* FileNameText;
\r
83 IGUIElement* EventParent;
\r
84 io::IFileSystem* FileSystem;
\r
85 io::IFileList* FileList;
\r
90 } // end namespace gui
\r
91 } // end namespace irr
\r
93 #endif // _IRR_COMPILE_WITH_GUI_
\r
95 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
\r