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

@@ -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);
}