use UTF-8 for string representation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace nana
|
||||
{
|
||||
double cap = bytes / 1024.0;
|
||||
std::size_t uid = 0;
|
||||
while((cap >= 1024.0) && (uid < (sizeof(ustr) / sizeof(nana::char_t*))))
|
||||
while((cap >= 1024.0) && (uid < (sizeof(ustr) / sizeof(char*))))
|
||||
{
|
||||
cap /= 1024.0;
|
||||
++uid;
|
||||
|
||||
@@ -164,13 +164,13 @@ namespace nana{ namespace drawerbase
|
||||
|
||||
void trigger::key_char(graph_reference, const arg_keyboard& arg)
|
||||
{
|
||||
if (static_cast<char_t>(keyboard::enter) == arg.key)
|
||||
if (static_cast<wchar_t>(keyboard::enter) == arg.key)
|
||||
emit_click();
|
||||
}
|
||||
|
||||
void trigger::key_press(graph_reference graph, const arg_keyboard& arg)
|
||||
{
|
||||
if (keyboard::space == static_cast<char_t>(arg.key))
|
||||
if (keyboard::space == static_cast<wchar_t>(arg.key))
|
||||
{
|
||||
_m_press(graph, true);
|
||||
return;
|
||||
@@ -193,7 +193,7 @@ namespace nana{ namespace drawerbase
|
||||
|
||||
void trigger::key_release(graph_reference graph, const arg_keyboard& arg)
|
||||
{
|
||||
if (arg.key != static_cast<char_t>(keyboard::space))
|
||||
if (arg.key != static_cast<wchar_t>(keyboard::space))
|
||||
return;
|
||||
|
||||
emit_click();
|
||||
@@ -259,8 +259,13 @@ namespace nana{ namespace drawerbase
|
||||
{
|
||||
unsigned off_w = (shortkey_pos ? graph.text_extent_size(mbstr.c_str(), static_cast<unsigned>(shortkey_pos)).width : 0);
|
||||
nana::size shortkey_size = graph.text_extent_size(to_wstring(mbstr.c_str() + shortkey_pos), 1);
|
||||
|
||||
unsigned ascent, descent, inleading;
|
||||
graph.text_metrics(ascent, descent, inleading);
|
||||
|
||||
pos.x += off_w;
|
||||
pos.y += static_cast<int>(shortkey_size.height);
|
||||
pos.y += static_cast<int>(ascent + 2);
|
||||
|
||||
graph.set_color(colors::black);
|
||||
graph.line(pos, point{ pos.x + static_cast<int>(shortkey_size.width) - 1, pos.y });
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ namespace nana
|
||||
return _m_impl().editable();
|
||||
}
|
||||
|
||||
void combox::set_accept(std::function<bool(nana::char_t)> pred)
|
||||
void combox::set_accept(std::function<bool(wchar_t)> pred)
|
||||
{
|
||||
internal_scope_guard lock;
|
||||
auto editor = _m_impl().editor();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace nana
|
||||
typedef widgets::skeletons::fblock fblock;
|
||||
typedef widgets::skeletons::data data;
|
||||
|
||||
void parse(const nana::string& s)
|
||||
void parse(const std::wstring& s)
|
||||
{
|
||||
dstream_.parse(s, format_enabled_);
|
||||
}
|
||||
@@ -439,7 +439,7 @@ namespace nana
|
||||
|
||||
bool _m_each_line(graph_reference graph, dstream::linecontainer& line, render_status& rs)
|
||||
{
|
||||
nana::string text;
|
||||
std::wstring text;
|
||||
iterator block_start;
|
||||
|
||||
const int lastpos = static_cast<int>(graph.height()) - 1;
|
||||
@@ -521,7 +521,7 @@ namespace nana
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _m_draw_block(graph_reference graph, const nana::string& s, dstream::linecontainer::iterator block_start, render_status& rs)
|
||||
void _m_draw_block(graph_reference graph, const std::wstring& s, dstream::linecontainer::iterator block_start, render_status& rs)
|
||||
{
|
||||
nana::unicode_bidi bidi;
|
||||
std::vector<nana::unicode_bidi::entity> reordered;
|
||||
@@ -568,7 +568,7 @@ namespace nana
|
||||
}
|
||||
else
|
||||
{
|
||||
nana::string str = data_ptr->text().substr(text_range.first, text_range.second);
|
||||
auto str = data_ptr->text().substr(text_range.first, text_range.second);
|
||||
graph.string({ rs.pos.x, y }, str, _m_fgcolor(fblock_ptr));
|
||||
sz = graph.text_extent_size(str);
|
||||
}
|
||||
@@ -625,23 +625,24 @@ namespace nana
|
||||
|
||||
class renderer renderer;
|
||||
|
||||
nana::string target; //It indicates which target is tracing.
|
||||
nana::string url;
|
||||
std::wstring target; //It indicates which target is tracing.
|
||||
std::wstring url;
|
||||
|
||||
window for_associated_wd{ nullptr };
|
||||
|
||||
void add_listener(std::function<void(command, const nana::string&)>&& fn)
|
||||
void add_listener(std::function<void(command, const std::string&)>&& fn)
|
||||
{
|
||||
listener_.emplace_back(std::move(fn));
|
||||
}
|
||||
|
||||
void call_listener(command cmd, const nana::string& tar)
|
||||
void call_listener(command cmd, const std::wstring& tar)
|
||||
{
|
||||
auto str = to_utf8(tar);
|
||||
for (auto & fn : listener_)
|
||||
fn(cmd, tar);
|
||||
fn(cmd, str);
|
||||
}
|
||||
private:
|
||||
std::vector<std::function<void(command, const nana::string&)>> listener_;
|
||||
std::vector<std::function<void(command, const std::string&)>> listener_;
|
||||
};
|
||||
|
||||
trigger::trigger()
|
||||
@@ -666,7 +667,7 @@ namespace nana
|
||||
|
||||
void trigger::mouse_move(graph_reference, const arg_mouse& arg)
|
||||
{
|
||||
nana::string target, url;
|
||||
std::wstring target, url;
|
||||
|
||||
if(impl_->renderer.find(arg.pos.x, arg.pos.y, target, url))
|
||||
{
|
||||
@@ -741,7 +742,7 @@ namespace nana
|
||||
if(impl_->target.size())
|
||||
impl_->call_listener(command::click, impl_->target);
|
||||
|
||||
system::open_url(url);
|
||||
system::open_url(to_utf8(url));
|
||||
|
||||
API::focus_window(impl_->for_associated_wd);
|
||||
}
|
||||
@@ -813,7 +814,7 @@ namespace nana
|
||||
return *this;
|
||||
}
|
||||
|
||||
label& label::add_format_listener(std::function<void(command, const nana::string&)> f)
|
||||
label& label::add_format_listener(std::function<void(command, const std::string&)> f)
|
||||
{
|
||||
get_drawer_trigger().impl()->add_listener(std::move(f));
|
||||
return *this;
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace nana
|
||||
oresolver& oresolver::operator<<(std::nullptr_t)
|
||||
{
|
||||
cells_.emplace_back();
|
||||
cells_.back().text.assign(1, nana::char_t(0)); //means invalid cell
|
||||
cells_.back().text.assign(1, wchar_t(0)); //means invalid cell
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -4239,7 +4239,7 @@ namespace nana
|
||||
//check invalid cells
|
||||
for (auto & cl : cells)
|
||||
{
|
||||
if (cl.text.size() == 1 && cl.text[0] == nana::char_t(0))
|
||||
if (cl.text.size() == 1 && cl.text[0] == wchar_t(0))
|
||||
{
|
||||
cl.text.clear();
|
||||
cl.custom_format.reset();
|
||||
|
||||
@@ -148,11 +148,13 @@ namespace nana
|
||||
img.stretch(rectangle{ img.size() }, graph, rectangle{ pos, ::nana::size(image_px, image_px) });
|
||||
}
|
||||
|
||||
void item_text(graph_reference graph, const nana::point& pos, const std::wstring& text, unsigned text_pixels, const attr& at)
|
||||
void item_text(graph_reference graph, const nana::point& pos, const std::string& text, unsigned text_pixels, const attr& at)
|
||||
{
|
||||
graph.set_text_color(at.enabled ? colors::black : colors::gray_border);
|
||||
nana::paint::text_renderer tr(graph);
|
||||
tr.render(pos, text.c_str(), text.length(), text_pixels, true);
|
||||
|
||||
auto wstr = to_wstring(text);
|
||||
tr.render(pos, wstr.c_str(), wstr.length(), text_pixels, true);
|
||||
}
|
||||
|
||||
void sub_arrow(graph_reference graph, const nana::point& pos, unsigned pixels, const attr&)
|
||||
@@ -389,7 +391,7 @@ namespace nana
|
||||
if (m.image.empty() == false)
|
||||
renderer->item_image(graph, nana::point(item_r.x + 5, item_r.y + static_cast<int>(item_h_px - image_px) / 2 - 1), image_px, m.image);
|
||||
|
||||
renderer->item_text(graph, nana::point(item_r.x + 40, item_r.y + text_top_off), text, strpixels, attr);
|
||||
renderer->item_text(graph, nana::point(item_r.x + 40, item_r.y + text_top_off), to_utf8(text), strpixels, attr);
|
||||
|
||||
if (hotkey)
|
||||
{
|
||||
@@ -546,7 +548,7 @@ namespace nana
|
||||
}
|
||||
|
||||
//send_shortkey has 3 states, 0 = UNKNOWN KEY, 1 = ITEM, 2 = GOTO SUBMENU
|
||||
int send_shortkey(nana::char_t key)
|
||||
int send_shortkey(wchar_t key)
|
||||
{
|
||||
key = std::tolower(key);
|
||||
std::size_t index = 0;
|
||||
@@ -845,7 +847,7 @@ namespace nana
|
||||
return menu_wd->_m_manipulate_sub(0, true);
|
||||
}
|
||||
|
||||
int send_shortkey(nana::char_t key)
|
||||
int send_shortkey(wchar_t key)
|
||||
{
|
||||
menu_window * object = this;
|
||||
while(object->submenu_.child)
|
||||
@@ -1254,7 +1256,7 @@ namespace nana
|
||||
return impl_->mbuilder.data().items.size();
|
||||
}
|
||||
|
||||
int menu::send_shortkey(nana::char_t key)
|
||||
int menu::send_shortkey(wchar_t key)
|
||||
{
|
||||
return (impl_->uiobj ? impl_->uiobj->send_shortkey(key) : 0);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace nana
|
||||
{
|
||||
struct item_type
|
||||
{
|
||||
item_type(const ::std::wstring& text, unsigned long shortkey)
|
||||
item_type(const native_string_type text, unsigned long shortkey)
|
||||
: text(text), shortkey(shortkey)
|
||||
{}
|
||||
|
||||
::std::wstring text;
|
||||
native_string_type text;
|
||||
unsigned long shortkey;
|
||||
::nana::menu menu_obj;
|
||||
::nana::point pos;
|
||||
@@ -52,7 +52,7 @@ namespace nana
|
||||
delete i;
|
||||
}
|
||||
|
||||
void append(const ::std::wstring& text, unsigned long shortkey)
|
||||
void append(const native_string_type& text, unsigned long shortkey)
|
||||
{
|
||||
if(shortkey && shortkey < 0x61) shortkey += (0x61 - 0x41);
|
||||
cont_.push_back(new item_type(text, shortkey));
|
||||
@@ -122,7 +122,7 @@ namespace nana
|
||||
graph_.rectangle(r.pare_off(1), true, body);
|
||||
}
|
||||
|
||||
void item_renderer::caption(const point& pos, const std::wstring& text)
|
||||
void item_renderer::caption(const point& pos, const native_string_type& text)
|
||||
{
|
||||
graph_.string(pos, text, colors::black);
|
||||
}
|
||||
@@ -138,16 +138,16 @@ namespace nana
|
||||
delete items_;
|
||||
}
|
||||
|
||||
nana::menu* trigger::push_back(const ::std::wstring& text)
|
||||
nana::menu* trigger::push_back(const std::string& text)
|
||||
{
|
||||
wchar_t shkey;
|
||||
API::transform_shortkey_text(to_utf8(text), shkey, nullptr);
|
||||
API::transform_shortkey_text(text, shkey, nullptr);
|
||||
|
||||
if(shkey)
|
||||
API::register_shortkey(widget_->handle(), shkey);
|
||||
|
||||
auto pos = items_->cont().size();
|
||||
items_->append(text, shkey);
|
||||
items_->append(to_nstring(text), shkey);
|
||||
refresh(*graph_);
|
||||
API::update_window(*widget_);
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace nana
|
||||
|
||||
//Draw text, the text is transformed from orignal for hotkey character
|
||||
int text_top_off = (item_s.height - text_s.height) / 2;
|
||||
ird.caption({ item_pos.x + 8, item_pos.y + text_top_off }, to_wstring(text));
|
||||
ird.caption({ item_pos.x + 8, item_pos.y + text_top_off }, to_nstring(text));
|
||||
|
||||
if (hotkey)
|
||||
{
|
||||
@@ -619,7 +619,7 @@ namespace nana
|
||||
|
||||
menu& menubar::push_back(const std::string& text)
|
||||
{
|
||||
return *(get_drawer_trigger().push_back(to_wstring(text)));
|
||||
return *(get_drawer_trigger().push_back(text));
|
||||
}
|
||||
|
||||
menu& menubar::at(std::size_t index) const
|
||||
|
||||
@@ -500,8 +500,8 @@ namespace nana{ namespace widgets
|
||||
{
|
||||
struct text_section
|
||||
{
|
||||
const nana::char_t* begin;
|
||||
const nana::char_t* end;
|
||||
const wchar_t* begin;
|
||||
const wchar_t* end;
|
||||
unsigned pixels;
|
||||
|
||||
text_section()
|
||||
@@ -509,7 +509,7 @@ namespace nana{ namespace widgets
|
||||
throw std::runtime_error("text_section default construction is forbidden.");
|
||||
}
|
||||
|
||||
text_section(const nana::char_t* ptr, const nana::char_t* endptr)
|
||||
text_section(const wchar_t* ptr, const wchar_t* endptr)
|
||||
: begin(ptr), end(endptr)
|
||||
{}
|
||||
};
|
||||
@@ -591,7 +591,7 @@ namespace nana{ namespace widgets
|
||||
std::vector<text_section> line_sections;
|
||||
|
||||
unsigned text_px = 0;
|
||||
const nana::char_t * secondary_begin = nullptr;
|
||||
const wchar_t * secondary_begin = nullptr;
|
||||
for (auto & ts : sections)
|
||||
{
|
||||
if (!secondary_begin)
|
||||
@@ -627,7 +627,7 @@ namespace nana{ namespace widgets
|
||||
if (text_px < pixels)
|
||||
continue;
|
||||
|
||||
const nana::char_t * endptr = ts.begin + (pxi - pxptr) + (text_px == pixels ? 1 : 0);
|
||||
const wchar_t * endptr = ts.begin + (pxi - pxptr) + (text_px == pixels ? 1 : 0);
|
||||
line_sections.emplace_back(secondary_begin, endptr);
|
||||
line_sections.back().pixels = text_px - (text_px == pixels ? 0 : *pxi);
|
||||
secondary_begin = endptr;
|
||||
@@ -816,7 +816,7 @@ namespace nana{ namespace widgets
|
||||
if (editor_.mask_char_)
|
||||
mask_str.reset(new std::wstring(real_str.end - real_str.begin, editor_.mask_char_));
|
||||
|
||||
const ::nana::char_t * str = (editor_.mask_char_ ? mask_str->data() : real_str.begin);
|
||||
const wchar_t * str = (editor_.mask_char_ ? mask_str->data() : real_str.begin);
|
||||
|
||||
std::vector<unicode_bidi::entity> reordered;
|
||||
unicode_bidi bidi;
|
||||
@@ -934,10 +934,10 @@ namespace nana{ namespace widgets
|
||||
}
|
||||
const auto end = str.data() + str.size();
|
||||
|
||||
const nana::char_t * word = nullptr;
|
||||
const wchar_t * word = nullptr;
|
||||
for (auto i = str.data(); i != end; ++i)
|
||||
{
|
||||
nana::char_t const ch = *i;
|
||||
wchar_t const ch = *i;
|
||||
|
||||
//CKJ characters and whitespace
|
||||
if (' ' == ch || '\t' == ch || (0x4E00 <= ch && ch <= 0x9FCF))
|
||||
@@ -1166,8 +1166,8 @@ namespace nana{ namespace widgets
|
||||
|
||||
struct entity
|
||||
{
|
||||
const ::nana::char_t* begin;
|
||||
const ::nana::char_t* end;
|
||||
const wchar_t* begin;
|
||||
const wchar_t* end;
|
||||
const keyword_scheme * scheme;
|
||||
};
|
||||
|
||||
@@ -1388,7 +1388,7 @@ namespace nana{ namespace widgets
|
||||
case keyboard::sync_idel:
|
||||
paste(); break;
|
||||
case keyboard::tab:
|
||||
put(static_cast<char_t>(keyboard::tab)); break;
|
||||
put(static_cast<wchar_t>(keyboard::tab)); break;
|
||||
case keyboard::cancel:
|
||||
cut();
|
||||
break;
|
||||
@@ -1404,11 +1404,6 @@ namespace nana{ namespace widgets
|
||||
|
||||
if (key > 0x7F || (32 <= key && key <= 126))
|
||||
put(key);
|
||||
else if (sizeof(nana::char_t) == sizeof(char))
|
||||
{ //Non-Unicode Version for Non-English characters
|
||||
if (key & (1 << (sizeof(nana::char_t) * 8 - 1)))
|
||||
put(key);
|
||||
}
|
||||
}
|
||||
reset_caret();
|
||||
return true;
|
||||
@@ -1729,12 +1724,12 @@ namespace nana{ namespace widgets
|
||||
return false;
|
||||
}
|
||||
|
||||
textbase<nana::char_t> & text_editor::textbase()
|
||||
textbase<wchar_t> & text_editor::textbase()
|
||||
{
|
||||
return textbase_;
|
||||
}
|
||||
|
||||
const textbase<nana::char_t> & text_editor::textbase() const
|
||||
const textbase<wchar_t> & text_editor::textbase() const
|
||||
{
|
||||
return textbase_;
|
||||
}
|
||||
@@ -1896,7 +1891,7 @@ namespace nana{ namespace widgets
|
||||
return false;
|
||||
}
|
||||
|
||||
bool text_editor::mask(nana::char_t ch)
|
||||
bool text_editor::mask(wchar_t ch)
|
||||
{
|
||||
if (mask_char_ == ch)
|
||||
return false;
|
||||
@@ -2315,7 +2310,7 @@ namespace nana{ namespace widgets
|
||||
|
||||
bool changed = false;
|
||||
nana::upoint caret = points_.caret;
|
||||
char_t key = arg.key;
|
||||
wchar_t key = arg.key;
|
||||
size_t nlines = textbase_.lines();
|
||||
if (arg.ctrl) {
|
||||
switch (key) {
|
||||
@@ -2853,7 +2848,7 @@ namespace nana{ namespace widgets
|
||||
{
|
||||
if(0 == tabs) return 0;
|
||||
|
||||
nana::char_t ws[2] = {};
|
||||
wchar_t ws[2] = {};
|
||||
ws[0] = mask_char_ ? mask_char_ : ' ';
|
||||
return static_cast<unsigned>(tabs * graph_.text_extent_size(ws).width * text_area_.tab_space);
|
||||
}
|
||||
@@ -2999,7 +2994,7 @@ namespace nana{ namespace widgets
|
||||
|
||||
for (auto & ent : entities)
|
||||
{
|
||||
const ::nana::char_t* ent_begin = nullptr;
|
||||
const wchar_t* ent_begin = nullptr;
|
||||
|
||||
int ent_off = 0;
|
||||
if (str <= ent.begin && ent.begin < str_end)
|
||||
@@ -3094,7 +3089,7 @@ namespace nana{ namespace widgets
|
||||
}
|
||||
else
|
||||
{
|
||||
auto rtl_string = [this, line_h_pixels, &parser, &clr](point strpos, const nana::char_t* str, std::size_t len, std::size_t str_px, unsigned glyph_front, unsigned glyph_selected){
|
||||
auto rtl_string = [this, line_h_pixels, &parser, &clr](point strpos, const wchar_t* str, std::size_t len, std::size_t str_px, unsigned glyph_front, unsigned glyph_selected){
|
||||
this->_m_draw_parse_string(parser, true, strpos, clr, str, len);
|
||||
|
||||
//Draw selected part
|
||||
@@ -3109,7 +3104,7 @@ namespace nana{ namespace widgets
|
||||
graph_.bitblt(nana::rectangle(strpos.x + sel_xpos, strpos.y, glyph_selected, line_h_pixels), graph);
|
||||
};
|
||||
|
||||
const nana::char_t * strbeg = linestr.c_str();
|
||||
const wchar_t * strbeg = linestr.c_str();
|
||||
if (a.y == b.y)
|
||||
{
|
||||
for (auto & ent : reordered)
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace nana
|
||||
auto scheme = static_cast<::nana::widgets::skeletons::text_editor_scheme*>(API::dev::get_scheme(wd));
|
||||
editor_ = new ::nana::widgets::skeletons::text_editor(wd, graph, scheme);
|
||||
editor_->multi_lines(false);
|
||||
editor_->set_accept([this](::nana::char_t ch)
|
||||
editor_->set_accept([this](wchar_t ch)
|
||||
{
|
||||
auto str = editor_->text();
|
||||
auto pos = editor_->caret().x;
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace drawerbase {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void textbox::set_accept(std::function<bool(nana::char_t)> fn)
|
||||
void textbox::set_accept(std::function<bool(wchar_t)> fn)
|
||||
{
|
||||
internal_scope_guard lock;
|
||||
auto editor = get_drawer_trigger().editor();
|
||||
@@ -439,7 +439,7 @@ namespace drawerbase {
|
||||
return *this;
|
||||
}
|
||||
|
||||
textbox& textbox::mask(nana::char_t ch)
|
||||
textbox& textbox::mask(wchar_t ch)
|
||||
{
|
||||
internal_scope_guard lock;
|
||||
auto editor = get_drawer_trigger().editor();
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace nana
|
||||
API::umake_event(eh);
|
||||
}
|
||||
|
||||
widget& widget::register_shortkey(char_t key)
|
||||
widget& widget::register_shortkey(wchar_t key)
|
||||
{
|
||||
if (key)
|
||||
API::register_shortkey(handle(), static_cast<unsigned long>(key));
|
||||
|
||||
Reference in New Issue
Block a user