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 #include "IGUIFileOpenDialog.h"
\r
10 #include "IGUIButton.h"
\r
11 #include "IGUIListBox.h"
\r
12 #include "IGUIEditBox.h"
\r
13 #include "IFileSystem.h"
\r
20 class CGUIFileOpenDialog : public IGUIFileOpenDialog
\r
25 CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* environment,
\r
26 IGUIElement* parent, s32 id, bool restoreCWD=false,
\r
27 io::path::char_type* startDir=0);
\r
30 virtual ~CGUIFileOpenDialog();
\r
32 //! returns the filename of the selected file. Returns NULL, if no file was selected.
\r
33 const wchar_t* getFileName() const override;
\r
35 //! Returns the filename of the selected file. Is empty if no file was selected.
\r
36 const io::path& getFileNameP() const override;
\r
38 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.
\r
39 const io::path& getDirectoryName() const override;
\r
41 //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected.
\r
42 const wchar_t* getDirectoryNameW() const override;
\r
44 //! called if an event happened.
\r
45 bool OnEvent(const SEvent& event) override;
\r
47 //! draws the element and its children
\r
48 void draw() override;
\r
52 void setFileName(const irr::io::path& name);
\r
53 void setDirectoryName(const irr::io::path& name);
\r
55 //! Ensure filenames are converted correct depending on wide-char settings
\r
56 void pathToStringW(irr::core::stringw& result, const irr::io::path& p);
\r
58 //! fills the listbox with files.
\r
61 //! sends the event that the file has been selected.
\r
62 void sendSelectedEvent( EGUI_EVENT_TYPE type );
\r
64 //! sends the event that the file choose process has been canceld
\r
65 void sendCancelEvent();
\r
67 core::position2d<s32> DragStart;
\r
69 core::stringw FileNameW;
\r
70 io::path FileDirectory;
\r
71 io::path FileDirectoryFlat;
\r
72 core::stringw FileDirectoryFlatW;
\r
73 io::path RestoreDirectory;
\r
74 io::path StartDirectory;
\r
76 IGUIButton* CloseButton;
\r
77 IGUIButton* OKButton;
\r
78 IGUIButton* CancelButton;
\r
79 IGUIListBox* FileBox;
\r
80 IGUIEditBox* FileNameText;
\r
81 IGUIElement* EventParent;
\r
82 io::IFileSystem* FileSystem;
\r
83 io::IFileList* FileList;
\r
88 } // end namespace gui
\r
89 } // end namespace irr
\r
91 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
\r