a standard experimental class any
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Bedrock Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -993,7 +993,7 @@ namespace detail
|
||||
if(input_context)
|
||||
{
|
||||
nana::detail::platform_scope_guard psg;
|
||||
#if defined(NANA_UNICODE)
|
||||
#if 1 //Utf8
|
||||
len = ::Xutf8LookupString(input_context, &xevent.xkey, keybuf, 32, &keysym, &status);
|
||||
if(status == XBufferOverflow)
|
||||
{
|
||||
@@ -1088,14 +1088,12 @@ namespace detail
|
||||
if (msgwnd->flags.enabled)
|
||||
{
|
||||
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 wchar_t*>(str.c_str()) + 1;
|
||||
len = str.size() / sizeof(wchar_t) - 1;
|
||||
#else
|
||||
charbuf = keybuf;
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < len; ++i)
|
||||
{
|
||||
arg_keyboard arg;
|
||||
|
||||
@@ -202,8 +202,8 @@ namespace nana
|
||||
ls_file_.events().mouse_down.connect_unignorable(fn_sel_file);
|
||||
ls_file_.set_sort_compare(0, [](const std::string& a, nana::any* fs_a, const std::string& b, nana::any* fs_b, bool reverse) -> bool
|
||||
{
|
||||
int dira = fs_a->get<item_fs>()->directory ? 1 : 0;
|
||||
int dirb = fs_b->get<item_fs>()->directory ? 1 : 0;
|
||||
int dira = any_cast<item_fs>(fs_a)->directory ? 1 : 0;
|
||||
int dirb = any_cast<item_fs>(fs_b)->directory ? 1 : 0;
|
||||
if(dira != dirb)
|
||||
return (reverse ? dira < dirb : dira > dirb);
|
||||
|
||||
@@ -256,8 +256,8 @@ namespace nana
|
||||
});
|
||||
ls_file_.set_sort_compare(2, [](const std::string& a, nana::any* anyptr_a, const std::string& b, nana::any* anyptr_b, bool reverse) -> bool
|
||||
{
|
||||
int dir1 = anyptr_a->get<item_fs>()->directory ? 1 : 0;
|
||||
int dir2 = anyptr_b->get<item_fs>()->directory ? 1 : 0;
|
||||
int dir1 = any_cast<item_fs>(anyptr_a)->directory ? 1 : 0;
|
||||
int dir2 = any_cast<item_fs>(anyptr_b)->directory ? 1 : 0;
|
||||
if(dir1 != dir2)
|
||||
return (reverse ? dir1 < dir2 : dir1 > dir2);
|
||||
|
||||
@@ -265,8 +265,8 @@ namespace nana
|
||||
});
|
||||
ls_file_.set_sort_compare(3, [this](const std::string&, nana::any* anyptr_a, const std::string&, nana::any* anyptr_b, bool reverse) -> bool
|
||||
{
|
||||
item_fs * fsa = anyptr_a->get<item_fs>();
|
||||
item_fs * fsb = anyptr_b->get<item_fs>();
|
||||
item_fs * fsa = any_cast<item_fs>(anyptr_a);
|
||||
item_fs * fsb = any_cast<item_fs>(anyptr_b);
|
||||
return (reverse ? fsa->bytes > fsb->bytes : fsa->bytes < fsb->bytes);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A List Box Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
Reference in New Issue
Block a user