From 0aaa1dc0dbd44d6d4b9d8cac42fbb7fb782f6709 Mon Sep 17 00:00:00 2001 From: koowolf <450928375@qq.com> Date: Thu, 6 Mar 2014 19:38:44 +0800 Subject: [PATCH] =?UTF-8?q?closed=20#4291=EF=BC=9Aopen=20CCEditBox=20as=20?= =?UTF-8?q?modal=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 14 +++++++++++++- extensions/proj.win32/Win32InputBox.cpp | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index f3bfa937a3..4dcc885f49 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -26,8 +26,17 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#ifndef GLFW_EXPOSE_NATIVE_WIN32 +#define GLFW_EXPOSE_NATIVE_WIN32 +#endif + +#ifndef GLFW_EXPOSE_NATIVE_WGL +#define GLFW_EXPOSE_NATIVE_WGL +#endif + #include "CCEditBox.h" #include "proj.win32/Win32InputBox.h" +#include "glfw3native.h" NS_CC_EXT_BEGIN @@ -275,7 +284,10 @@ void EditBoxImplWin::openKeyboard() std::string text = getText(); if (text.length()) strncpy(pText, text.c_str(), 100); - bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false) == IDOK; + GLView *glView = Director::getInstance()->getOpenGLView(); + GLFWwindow *glfwWindow = glView->getWindow(); + HWND hwnd = glfwGetWin32Window(glfwWindow); + bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false, hwnd) == IDOK; if (didChange) setText(pText); diff --git a/extensions/proj.win32/Win32InputBox.cpp b/extensions/proj.win32/Win32InputBox.cpp index 1412e1a198..bc115dfc54 100644 --- a/extensions/proj.win32/Win32InputBox.cpp +++ b/extensions/proj.win32/Win32InputBox.cpp @@ -210,7 +210,7 @@ INT_PTR CWin32InputBox::InputBox( param.szResult = szResult; param.nResultSize = nResultSize; param.bMultiline = bMultiLine; - + param.hwndOwner = hwndParent; return InputBoxEx(¶m); }