]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUIFileOpenDialog.h
c51f60498f5b4ac763c96af2c276c1cb45cceb50
[irrlicht.git] / source / Irrlicht / CGUIFileOpenDialog.h
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
4 \r
5 #ifndef __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r
6 #define __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r
7 \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
14 \r
15 namespace irr\r
16 {\r
17 namespace gui\r
18 {\r
19 \r
20         class CGUIFileOpenDialog : public IGUIFileOpenDialog\r
21         {\r
22         public:\r
23 \r
24                 //! constructor\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
28 \r
29                 //! destructor\r
30                 virtual ~CGUIFileOpenDialog();\r
31 \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
34 \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
37 \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
40 \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
43 \r
44                 //! called if an event happened.\r
45                 bool OnEvent(const SEvent& event) override;\r
46 \r
47                 //! draws the element and its children\r
48                 void draw() override;\r
49 \r
50         protected:\r
51 \r
52                 void setFileName(const irr::io::path& name);\r
53                 void setDirectoryName(const irr::io::path& name);\r
54 \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
57 \r
58                 //! fills the listbox with files.\r
59                 void fillListBox();\r
60 \r
61                 //! sends the event that the file has been selected.\r
62                 void sendSelectedEvent( EGUI_EVENT_TYPE type );\r
63 \r
64                 //! sends the event that the file choose process has been canceld\r
65                 void sendCancelEvent();\r
66 \r
67                 core::position2d<s32> DragStart;\r
68                 io::path FileName;\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
75 \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
84                 bool Dragging;\r
85         };\r
86 \r
87 \r
88 } // end namespace gui\r
89 } // end namespace irr\r
90 \r
91 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r