]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUIFileOpenDialog.h
Reduce IrrCompileConfig usage to files that actually need it
[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 "IGUIFileOpenDialog.h"\r
9 #include "IGUIButton.h"\r
10 #include "IGUIListBox.h"\r
11 #include "IGUIEditBox.h"\r
12 #include "IFileSystem.h"\r
13 \r
14 namespace irr\r
15 {\r
16 namespace gui\r
17 {\r
18 \r
19         class CGUIFileOpenDialog : public IGUIFileOpenDialog\r
20         {\r
21         public:\r
22 \r
23                 //! constructor\r
24                 CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* environment,\r
25                                 IGUIElement* parent, s32 id, bool restoreCWD=false,\r
26                                 io::path::char_type* startDir=0);\r
27 \r
28                 //! destructor\r
29                 virtual ~CGUIFileOpenDialog();\r
30 \r
31                 //! returns the filename of the selected file. Returns NULL, if no file was selected.\r
32                 const wchar_t* getFileName() const override;\r
33 \r
34                 //! Returns the filename of the selected file. Is empty if no file was selected.\r
35                 const io::path& getFileNameP() const override;\r
36 \r
37                 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.\r
38                 const io::path& getDirectoryName() const override;\r
39 \r
40                 //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected.\r
41                 const wchar_t* getDirectoryNameW() const override;\r
42 \r
43                 //! called if an event happened.\r
44                 bool OnEvent(const SEvent& event) override;\r
45 \r
46                 //! draws the element and its children\r
47                 void draw() override;\r
48 \r
49         protected:\r
50 \r
51                 void setFileName(const irr::io::path& name);\r
52                 void setDirectoryName(const irr::io::path& name);\r
53 \r
54                 //! Ensure filenames are converted correct depending on wide-char settings\r
55                 void pathToStringW(irr::core::stringw& result, const irr::io::path& p);\r
56 \r
57                 //! fills the listbox with files.\r
58                 void fillListBox();\r
59 \r
60                 //! sends the event that the file has been selected.\r
61                 void sendSelectedEvent( EGUI_EVENT_TYPE type );\r
62 \r
63                 //! sends the event that the file choose process has been canceld\r
64                 void sendCancelEvent();\r
65 \r
66                 core::position2d<s32> DragStart;\r
67                 io::path FileName;\r
68                 core::stringw FileNameW;\r
69                 io::path FileDirectory;\r
70                 io::path FileDirectoryFlat;\r
71                 core::stringw FileDirectoryFlatW;\r
72                 io::path RestoreDirectory;\r
73                 io::path StartDirectory;\r
74 \r
75                 IGUIButton* CloseButton;\r
76                 IGUIButton* OKButton;\r
77                 IGUIButton* CancelButton;\r
78                 IGUIListBox* FileBox;\r
79                 IGUIEditBox* FileNameText;\r
80                 IGUIElement* EventParent;\r
81                 io::IFileSystem* FileSystem;\r
82                 io::IFileList* FileList;\r
83                 bool Dragging;\r
84         };\r
85 \r
86 \r
87 } // end namespace gui\r
88 } // end namespace irr\r
89 \r
90 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r