]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUIFileOpenDialog.h
CIrrDeviceWin32: drop all video mode code
[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                 virtual const wchar_t* getFileName() const _IRR_OVERRIDE_;\r
36 \r
37                 //! Returns the filename of the selected file. Is empty if no file was selected.\r
38                 virtual const io::path& getFileNameP() const _IRR_OVERRIDE_;\r
39 \r
40                 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.\r
41                 virtual const io::path& getDirectoryName() const _IRR_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                 virtual const wchar_t* getDirectoryNameW() const _IRR_OVERRIDE_;\r
45 \r
46                 //! called if an event happened.\r
47                 virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;\r
48 \r
49                 //! draws the element and its children\r
50                 virtual void draw() _IRR_OVERRIDE_;\r
51 \r
52                 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
53                 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
54 \r
55         protected:\r
56 \r
57                 void setFileName(const irr::io::path& name);\r
58                 void setDirectoryName(const irr::io::path& name);\r
59 \r
60                 //! Ensure filenames are converted correct depending on wide-char settings\r
61                 void pathToStringW(irr::core::stringw& result, const irr::io::path& p);\r
62 \r
63                 //! fills the listbox with files.\r
64                 void fillListBox();\r
65 \r
66                 //! sends the event that the file has been selected.\r
67                 void sendSelectedEvent( EGUI_EVENT_TYPE type );\r
68 \r
69                 //! sends the event that the file choose process has been canceld\r
70                 void sendCancelEvent();\r
71 \r
72                 core::position2d<s32> DragStart;\r
73                 io::path FileName;\r
74                 core::stringw FileNameW;\r
75                 io::path FileDirectory;\r
76                 io::path FileDirectoryFlat;\r
77                 core::stringw FileDirectoryFlatW;\r
78                 io::path RestoreDirectory;\r
79                 io::path StartDirectory;\r
80 \r
81                 IGUIButton* CloseButton;\r
82                 IGUIButton* OKButton;\r
83                 IGUIButton* CancelButton;\r
84                 IGUIListBox* FileBox;\r
85                 IGUIEditBox* FileNameText;\r
86                 IGUIElement* EventParent;\r
87                 io::IFileSystem* FileSystem;\r
88                 io::IFileList* FileList;\r
89                 bool Dragging;\r
90         };\r
91 \r
92 \r
93 } // end namespace gui\r
94 } // end namespace irr\r
95 \r
96 #endif // _IRR_COMPILE_WITH_GUI_\r
97 \r
98 #endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__\r
99 \r