use UTF-8 for string representation

This commit is contained in:
Jinhao
2015-12-31 01:09:52 +08:00
parent 0a396c12c2
commit a42ebe19b4
38 changed files with 182 additions and 416 deletions

View File

@@ -1017,7 +1017,7 @@ namespace detail
}
keybuf[len] = 0;
::nana::char_t os_code = 0;
wchar_t os_code = 0;
switch(status)
{
case XLookupKeySym:
@@ -1074,7 +1074,7 @@ namespace detail
if(brock.wd_manager().available(msgwnd) && (msgwnd->root_widget->other.attribute.root->menubar == msgwnd))
{
int cmd = (menu_wd && (keyboard::escape == static_cast<nana::char_t>(arg.key)) ? 1 : 0 );
int cmd = (menu_wd && (keyboard::escape == static_cast<wchar_t>(arg.key)) ? 1 : 0 );
brock.delay_restore(cmd);
}
}
@@ -1087,11 +1087,11 @@ namespace detail
case XLookupChars:
if (msgwnd->flags.enabled)
{
const ::nana::char_t* charbuf;
const wchar_t* charbuf;
#if defined(NANA_UNICODE)
nana::detail::charset_conv charset("UTF-32", "UTF-8");
const std::string& str = charset.charset(std::string(keybuf, keybuf + len));
charbuf = reinterpret_cast<const nana::char_t*>(str.c_str()) + 1;
charbuf = reinterpret_cast<const wchar_t*>(str.c_str()) + 1;
len = str.size() / sizeof(wchar_t) - 1;
#else
charbuf = keybuf;
@@ -1400,4 +1400,4 @@ namespace detail
}
}//end namespace detail
}//end namespace nana
#endif //NANA_POSIX && NANA_X11
#endif //NANA_POSIX && NANA_X11

View File

@@ -141,7 +141,7 @@ namespace detail
struct platform_detail_tag
{
nana::char_t keychar;
wchar_t keychar;
}platform;
struct cursor_tag
@@ -1185,7 +1185,7 @@ namespace detail
unsigned reqlen = ::DragQueryFile(drop, i, 0, 0) + 1;
if(bufsize < reqlen)
{
varbuf.reset(new nana::char_t[reqlen]);
varbuf.reset(new wchar_t[reqlen]);
bufsize = reqlen;
}
@@ -1345,7 +1345,7 @@ namespace detail
arg.evt_code = event_code::key_press;
arg.window_handle = reinterpret_cast<window>(msgwnd);
arg.ignore = false;
arg.key = static_cast<nana::char_t>(wParam);
arg.key = static_cast<wchar_t>(wParam);
brock.get_key_state(arg);
brock.emit(event_code::key_press, msgwnd, arg, true, &context);
@@ -1373,7 +1373,7 @@ namespace detail
arg.evt_code = event_code::key_release;
arg.window_handle = reinterpret_cast<window>(msgwnd);
arg.ignore = false;
arg.key = static_cast<nana::char_t>(wParam);
arg.key = static_cast<wchar_t>(wParam);
brock.get_key_state(arg);
brock.emit(event_code::key_release, msgwnd, arg, true, &context);
@@ -1415,7 +1415,7 @@ namespace detail
arg.evt_code = event_code::key_press;
arg.window_handle = reinterpret_cast<window>(msgwnd);
arg.ignore = false;
arg.key = static_cast<nana::char_t>(wParam);
arg.key = static_cast<wchar_t>(wParam);
brock.get_key_state(arg);
brock.emit(event_code::key_press, msgwnd, arg, true, &context);
@@ -1426,7 +1426,7 @@ namespace detail
//If no menu popuped by the menubar, it should enable delay restore to
//restore the focus for taken window.
int cmd = (menu_wd && (keyboard::escape == static_cast<nana::char_t>(wParam)) ? 1 : 0);
int cmd = (menu_wd && (keyboard::escape == static_cast<wchar_t>(wParam)) ? 1 : 0);
brock.delay_restore(cmd);
}
}
@@ -1443,7 +1443,7 @@ namespace detail
arg_keyboard arg;
arg.evt_code = event_code::key_char;
arg.window_handle = reinterpret_cast<window>(msgwnd);
arg.key = static_cast<nana::char_t>(wParam);
arg.key = static_cast<wchar_t>(wParam);
brock.get_key_state(arg);
arg.ignore = false;
@@ -1464,7 +1464,7 @@ namespace detail
arg_keyboard arg;
arg.evt_code = event_code::key_release;
arg.window_handle = reinterpret_cast<window>(msgwnd);
arg.key = static_cast<nana::char_t>(wParam);
arg.key = static_cast<wchar_t>(wParam);
brock.get_key_state(arg);
arg.ignore = false;
brock.emit(event_code::key_release, msgwnd, arg, true, &context);
@@ -1729,9 +1729,9 @@ namespace detail
return true;
}
const nana::char_t* translate(cursor id)
const wchar_t* translate(cursor id)
{
const nana::char_t* name = IDC_ARROW;
const wchar_t* name = IDC_ARROW;
switch(id)
{