@@ -8,25 +8,24 @@ namespace RTEGUI {
8
8
9
9
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10
10
11
- int EditorUtil::QuitMessageBox (const std::string &message, const HWND &windowHandle) {
11
+ int EditorUtil::DisplayDialogBox (const std::string &message, const HWND &windowHandle) {
12
12
int result = MessageBox (windowHandle, message.c_str (), " Cortex Command GUI Editor" , MB_YESNOCANCEL);
13
13
14
14
if (result == IDNO) { return -1 ; }
15
15
if (result == IDYES) { return 1 ; }
16
- return 0 ; // Cancel
16
+ return 0 ;
17
17
}
18
18
19
19
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
20
20
21
- bool EditorUtil::DisplayLoadGUIFile (std::string * filename, const HWND &windowHandle) {
21
+ bool EditorUtil::DisplayLoadFileDialogBox (std::string & filename, const HWND &windowHandle) {
22
22
OPENFILENAMEA dialogBox;
23
23
std::string filenameToLoad (MAX_PATH, ' \0 ' ); // Make sure the string is initialized with the correct size and filled with null characters.
24
24
25
25
std::string currentDir (MAX_PATH, ' \0 ' );
26
26
currentDir = std::filesystem::current_path ().string ();
27
27
28
- // Initialize OPENFILENAME
29
- ZeroMemory (&dialogBox, sizeof (OPENFILENAME));
28
+ ZeroMemory (&dialogBox, sizeof (OPENFILENAME)); // Initialize OPENFILENAME
30
29
dialogBox.lStructSize = sizeof (OPENFILENAME);
31
30
dialogBox.hInstance = nullptr ;
32
31
dialogBox.hwndOwner = windowHandle;
@@ -42,7 +41,7 @@ namespace RTEGUI {
42
41
dialogBox.lpstrDefExt = " ini" ;
43
42
44
43
if (GetOpenFileName (&dialogBox)) {
45
- * filename = std::string (filenameToLoad.data ());
44
+ filename = std::string (filenameToLoad.data ());
46
45
std::filesystem::current_path (currentDir);
47
46
return true ;
48
47
}
@@ -52,15 +51,14 @@ namespace RTEGUI {
52
51
53
52
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54
53
55
- bool EditorUtil::DisplaySaveGUIFile (std::string * filename, const HWND &windowHandle) {
54
+ bool EditorUtil::DisplaySaveFileDialogBox (std::string & filename, const HWND &windowHandle) {
56
55
OPENFILENAMEA dialogBox;
57
56
std::string filenameToSave (MAX_PATH, ' \0 ' ); // Make sure the string is initialized with the correct size and filled with null characters.
58
57
59
58
std::string currentDir (MAX_PATH, ' \0 ' );
60
59
currentDir = std::filesystem::current_path ().string ();
61
60
62
- // Initialize OPENFILENAME
63
- ZeroMemory (&dialogBox, sizeof (OPENFILENAME));
61
+ ZeroMemory (&dialogBox, sizeof (OPENFILENAME)); // Initialize OPENFILENAME
64
62
dialogBox.lStructSize = sizeof (OPENFILENAME);
65
63
dialogBox.hInstance = nullptr ;
66
64
dialogBox.hwndOwner = windowHandle;
@@ -85,7 +83,7 @@ namespace RTEGUI {
85
83
return false ;
86
84
}
87
85
}
88
- * filename = filenameToSave;
86
+ filename = filenameToSave;
89
87
std::filesystem::current_path (currentDir);
90
88
return true ;
91
89
}
0 commit comments