#include <org/xwt/Surface.h>
#include <org/xwt/DoubleBuffer.h>
#include <org/xwt/Picture.h>
+#include <org/xwt/ByteStream.h>
#include <org/xwt/Platform.h>
#include <org/xwt/Platform$ParsedFont.h>
#include <org/xwt/plat/Win32.h>
#include <org/xwt/plat/Win32$Win32Surface.h>
#include <org/xwt/plat/Win32$Win32DoubleBuffer.h>
#include <org/xwt/plat/Win32$Win32Picture.h>
+#include <org/xwt/util/Log.h>
#include <org/xwt/util/Semaphore.h>
// for debugging
// Platform Methods ///////////////////////////////////////////////////////////////////
+jstring org::xwt::plat::Win32::_fileDialog(jstring suggestedFileName, jboolean write) {
+
+ char buf[1024];
+ OPENFILENAME ofn;
+ memset(buf, 0, 1024);
+ memset(&ofn, 0, sizeof(OPENFILENAME));
+
+ if (suggestedFileName != NULL)
+ JvGetStringUTFRegion(suggestedFileName, 0, min(1023, JvGetStringUTFLength(suggestedFileName)), buf);
+
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.nMaxCustFilter = 0;
+ ofn.lpstrFile = buf;
+ ofn.nMaxFile = 1024;
+
+ if (write) ofn.Flags |= OFN_OVERWRITEPROMPT;
+ ofn.Flags |= OFN_HIDEREADONLY;
+
+ int ret = write ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn);
+ return ret == 0 ? NULL : JvNewStringLatin1(buf);
+}
+
void org::xwt::plat::Win32::__detectProxy(JArray<jstring>* container) {
HKEY hkey;
static char keyarr [256] = { 0 };
static jstring keyToString(WPARAM wParam) {
- char arr[4];
+ char arr[8];
keyarr[VK_CAPITAL] = GetKeyState(VK_CAPITAL);
keyarr[VK_LSHIFT] = GetKeyState(VK_LSHIFT);
keyarr[VK_RSHIFT] = GetKeyState(VK_RSHIFT);
keyarr[VK_SHIFT] = GetKeyState(VK_SHIFT);
-
- if (ToAscii(wParam, 0, (BYTE*)keyarr, (WORD*)arr, 0) == 1) {
+
+ if (ToAsciiEx(wParam, 0, (BYTE*)keyarr, (WORD*)arr, 0, GetKeyboardLayout(0)) == 1) {
switch (arr[0]) {
case '\t': return JvNewStringLatin1("tab");
case 0x1b: return JvNewStringLatin1("escape");