Quellcode durchsuchen

Fixed win32 browse dialogs

Marko Pintera vor 11 Jahren
Ursprung
Commit
513dee4c47

+ 1 - 1
BansheeCore/Include/BsPlatform.h

@@ -52,7 +52,7 @@ namespace BansheeEngine
 		OpenFile = 0x0, 
 		OpenFolder = 0x1, 
 		Save = 0x2,
-		Multiselect = 0x00001,
+		Multiselect = 0x10000,
 		TypeMask = 0xFFFF
 	};
 

+ 5 - 0
BansheeCore/Source/BsCoreApplication.cpp

@@ -41,6 +41,7 @@
 #include "BsMessageHandler.h"
 #include "BsResourceListenerManager.h"
 #include "BsRenderStateManager.h"
+#include "BsPath.h"
 
 #include "BsMaterial.h"
 #include "BsShader.h"
@@ -64,6 +65,10 @@ namespace BansheeEngine
 	{
 		signal(SIGABRT, handleAbort);
 
+		Vector<Path> outPaths;
+		Platform::openBrowseDialog((FileDialogType)((UINT32)FileDialogType::OpenFile | (UINT32)FileDialogType::Multiselect), "D:\\Downloads", L"*.exe", outPaths);
+
+
 		UINT32 numWorkerThreads = BS_THREAD_HARDWARE_CONCURRENCY - 1; // Number of cores while excluding current thread.
 
 		Platform::_startUp();

+ 6 - 3
BansheeCore/Source/Win32/BsWin32BrowseDialogs.cpp

@@ -32,7 +32,8 @@ namespace BansheeEngine
 
 	void setDefaultPath(IFileDialog* dialog, const Path& defaultPath)
 	{
-		const wchar_t* defaultPathW = defaultPath.toWString().c_str();
+		WString pathStr = defaultPath.toWString();
+		const wchar_t* defaultPathW = pathStr.c_str();
 
 		IShellItem* folder;
 		HRESULT result = SHCreateItemFromParsingName(defaultPathW, NULL, IID_PPV_ARGS(&folder));
@@ -119,13 +120,15 @@ namespace BansheeEngine
 			if (isMultiselect)
 			{
 				// Get file names
-				IFileOpenDialog* fileOpenDialog = static_cast<IFileOpenDialog*>(fileDialog);
-
+				IFileOpenDialog* fileOpenDialog;
+				fileDialog->QueryInterface(IID_IFileOpenDialog, (void**)&fileOpenDialog);
+				
 				IShellItemArray* shellItems = nullptr;
 				fileOpenDialog->GetResults(&shellItems);
 
 				getPaths(shellItems, paths);
 				shellItems->Release();
+				fileOpenDialog->Release();
 			}
 			else
 			{

+ 0 - 2
TODO.txt

@@ -12,8 +12,6 @@ Test file/folder open/save dialog
 C#:
 Dialog.Show(title, text, btn1 text, btn1 callback, btn2 text, btn2 callback, btn3 text, btn3 callback)
 
-Add C# wrappers GUIElement bounds and visible bounds (with ability to set non-visible bounds)
-
 Got a crash on shutdown that was caused by locking a mutex in an Event destructor. Event was Platform::onMouseCaptureChanged. 
 Issue happened when I closed the app via the X button (if that's relevant). It doesn't seem to happen always.