]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUIFileOpenDialog.h
55b9ffa7ed4bf2aa9953faaed5caccbf10245e37
[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 #ifdef _IRR_COMPILE_WITH_GUI_\r
10 \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
16 \r
17 namespace irr\r
18 {\r
19 namespace gui\r
20 {\r
21 \r
22         class CGUIFileOpenDialog : public IGUIFileOpenDialog\r
23         {\r
24         public:\r
25 \r
26                 //! constructor\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
30 \r
31                 //! destructor\r
32                 virtual ~CGUIFileOpenDialog();\r
33 \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
36 \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
39 \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
42 \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
45 \r
46                 //! called if an event happened.\r
47                 bool OnEvent(const SEvent& event) override;\r
48 \r
49                 //! draws the element and its children\r
50                 void draw() override;\r
51 \r
52         protected:\r
53 \r
54                 void setFileName(const irr::io::path& name);\r
55                 void setDirectoryName(const irr::io::path& name);\r
56 \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
59 \r
60                 //! fills the listbox with files.\r
61                 void fillListBox();\r
62 \r
63                 //! sends the event that the file has been selected.\r
64                 void sendSelectedEvent( EGUI_EVENT_TYPE type );\r
65 \r
66                 //! sends the event that the file choose process has been canceld\r
67                 void sendCancelEvent();\r
68 \r
69                 core::position2d<s32> DragStart;\r
70                 io::path FileName;\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
77 \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
86                 bool Dragging;\r
87         };\r
88 \r
89 \r
90 } // end namespace gui\r
91 } // end namespace irr\r
92 \r
93 #endif // _IRR_COMPILE_WITH_GUI_\r
94 \r
95 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r
96 \r