remove utf8_cast functions
This commit is contained in:
@@ -1191,7 +1191,7 @@ namespace detail
|
||||
|
||||
::DragQueryFile(drop, i, varbuf.get(), reqlen);
|
||||
|
||||
dropfiles.files.emplace_back(utf8_cast(varbuf.get()));
|
||||
dropfiles.files.emplace_back(to_utf8(varbuf.get()));
|
||||
}
|
||||
|
||||
while(msgwnd && (msgwnd->flags.dropable == false))
|
||||
|
||||
@@ -912,7 +912,7 @@ namespace nana
|
||||
::GetCurrentDirectory(len, &(path[0]));
|
||||
path.resize(len);
|
||||
|
||||
impl_->path = utf8_cast(path);
|
||||
impl_->path = to_utf8(path);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1002,9 +1002,9 @@ namespace nana
|
||||
{
|
||||
for(auto & f : impl_->filters)
|
||||
{
|
||||
filter_holder += utf8_cast(f.des);
|
||||
filter_holder += to_wstring(f.des);
|
||||
filter_holder += static_cast<std::wstring::value_type>('\0');
|
||||
std::wstring fs = utf8_cast(f.type);
|
||||
std::wstring fs = to_wstring(f.type);
|
||||
std::size_t pos = 0;
|
||||
while(true)
|
||||
{
|
||||
@@ -1036,8 +1036,8 @@ namespace nana
|
||||
else
|
||||
filter = L"All Files\0*.*\0";
|
||||
|
||||
auto wtitle = utf8_cast(impl_->title);
|
||||
auto wpath = utf8_cast(impl_->path);
|
||||
auto wtitle = to_wstring(impl_->title);
|
||||
auto wpath = to_wstring(impl_->path);
|
||||
ofn.lpstrFilter = filter;
|
||||
ofn.lpstrTitle = (wtitle.empty() ? nullptr : wtitle.c_str());
|
||||
ofn.nFilterIndex = 0;
|
||||
@@ -1053,7 +1053,7 @@ namespace nana
|
||||
return false;
|
||||
|
||||
wfile.resize(std::wcslen(wfile.data()));
|
||||
impl_->file = utf8_cast(wfile);
|
||||
impl_->file = to_utf8(wfile);
|
||||
#elif defined(NANA_POSIX)
|
||||
filebox_implement fb(impl_->owner, impl_->open_or_save, impl_->title);
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace nana
|
||||
default: break;
|
||||
}
|
||||
|
||||
auto bt = ::MessageBoxW(reinterpret_cast<HWND>(API::root(wd_)), utf8_cast(sstream_.str()).c_str(), utf8_cast(title_).c_str(), type);
|
||||
auto bt = ::MessageBoxW(reinterpret_cast<HWND>(API::root(wd_)), to_wstring(sstream_.str()).c_str(), to_wstring(title_).c_str(), type);
|
||||
|
||||
switch(bt)
|
||||
{
|
||||
@@ -835,7 +835,7 @@ namespace nana
|
||||
|
||||
void inputbox::text::tip_string(std::wstring tip)
|
||||
{
|
||||
impl_->tip = utf8_cast(tip);
|
||||
impl_->tip = to_utf8(tip);
|
||||
}
|
||||
|
||||
void inputbox::text::tip_string(std::string tip_utf8)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* An Implementation of Place for Layout
|
||||
* 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
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace nana
|
||||
graph.rectangle(true, static_cast<color_rgb>(0x83EB));
|
||||
|
||||
//draw caption
|
||||
auto text = utf8_cast(API::window_caption(window_handle_));
|
||||
auto text = to_wstring(API::window_caption(window_handle_));
|
||||
text_rd_->render({ 3, 1 }, text.data(), text.size(), graph.size().width - 20, true);
|
||||
|
||||
//draw x button
|
||||
|
||||
@@ -17,39 +17,68 @@
|
||||
|
||||
namespace nana{ namespace drawerbase
|
||||
{
|
||||
namespace checkbox
|
||||
{
|
||||
typedef element::crook_interface::state crook_state;
|
||||
|
||||
struct drawer::implement
|
||||
namespace checkbox
|
||||
{
|
||||
bool react;
|
||||
bool radio;
|
||||
facade<element::crook> crook;
|
||||
};
|
||||
typedef element::crook_interface::state crook_state;
|
||||
|
||||
struct drawer::implement
|
||||
{
|
||||
widget * widget_ptr;
|
||||
bool react;
|
||||
bool radio;
|
||||
facade<element::crook> crook;
|
||||
};
|
||||
|
||||
//class drawer
|
||||
|
||||
drawer::drawer()
|
||||
: widget_(nullptr),
|
||||
imptr_(new drawer::implement),
|
||||
impl_(imptr_.get())
|
||||
: impl_(new implement)
|
||||
{
|
||||
impl_->widget_ptr = nullptr;
|
||||
impl_->react = true;
|
||||
impl_->radio = false;
|
||||
}
|
||||
|
||||
drawer::~drawer()
|
||||
{}
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
void drawer::attached(widget_reference widget, graph_reference)
|
||||
{
|
||||
widget_ = &widget;
|
||||
impl_->widget_ptr = &widget;
|
||||
}
|
||||
|
||||
void drawer::refresh(graph_reference graph)
|
||||
{
|
||||
_m_draw_background(graph);
|
||||
_m_draw_title(graph);
|
||||
_m_draw_checkbox(graph, graph.text_extent_size(L"jN", 2).height + 2);
|
||||
auto wdg = impl_->widget_ptr;
|
||||
|
||||
//draw background
|
||||
if (bground_mode::basic != API::effects_bground_mode(*wdg))
|
||||
graph.rectangle(true, wdg->bgcolor());
|
||||
|
||||
//draw title
|
||||
if (graph.width() > 16 + interval)
|
||||
{
|
||||
auto title = to_wstring(wdg->caption_native());
|
||||
unsigned pixels = graph.width() - (16 + interval);
|
||||
|
||||
nana::paint::text_renderer tr(graph);
|
||||
if (!wdg->enabled())
|
||||
{
|
||||
graph.palette(true, colors::white);
|
||||
tr.render({ 17 + interval, 2 }, title.c_str(), title.length(), pixels);
|
||||
graph.palette(true, static_cast<color_rgb>(0x808080));
|
||||
}
|
||||
else
|
||||
graph.palette(true, wdg->fgcolor());
|
||||
|
||||
tr.render({ 16 + interval, 1 }, title.c_str(), title.length(), pixels);
|
||||
}
|
||||
|
||||
//draw crook
|
||||
auto txt_px = graph.text_extent_size(L"jN", 2).height + 2;
|
||||
impl_->crook.draw(graph, wdg->bgcolor(), wdg->fgcolor(), rectangle(0, txt_px > 16 ? (txt_px - 16) / 2 : 0, 16, 16), API::element_state(*wdg));
|
||||
}
|
||||
|
||||
void drawer::mouse_down(graph_reference graph, const arg_mouse&)
|
||||
@@ -63,8 +92,8 @@ namespace checkbox
|
||||
if (impl_->react)
|
||||
{
|
||||
impl_->crook.reverse();
|
||||
arg_checkbox arg{ static_cast<nana::checkbox*>(widget_) };
|
||||
API::events<nana::checkbox>(widget_->handle()).checked.emit(arg);
|
||||
arg_checkbox arg{ static_cast<nana::checkbox*>(impl_->widget_ptr) };
|
||||
API::events<nana::checkbox>(impl_->widget_ptr->handle()).checked.emit(arg);
|
||||
}
|
||||
refresh(graph);
|
||||
API::lazy_refresh();
|
||||
@@ -86,39 +115,6 @@ namespace checkbox
|
||||
{
|
||||
return impl_;
|
||||
}
|
||||
|
||||
void drawer::_m_draw_background(graph_reference graph)
|
||||
{
|
||||
if(bground_mode::basic != API::effects_bground_mode(*widget_))
|
||||
graph.rectangle(true, API::bgcolor(*widget_));
|
||||
}
|
||||
|
||||
void drawer::_m_draw_checkbox(graph_reference graph, unsigned first_line_height)
|
||||
{
|
||||
impl_->crook.draw(graph, widget_->bgcolor(), widget_->fgcolor(), rectangle(0, first_line_height > 16 ? (first_line_height - 16) / 2 : 0, 16, 16), API::element_state(*widget_));
|
||||
}
|
||||
|
||||
void drawer::_m_draw_title(graph_reference graph)
|
||||
{
|
||||
if (graph.width() > 16 + interval)
|
||||
{
|
||||
std::wstring title = ::nana::charset(widget_->caption(), ::nana::unicode::utf8);
|
||||
|
||||
unsigned pixels = graph.width() - (16 + interval);
|
||||
|
||||
nana::paint::text_renderer tr(graph);
|
||||
if (API::window_enabled(widget_->handle()) == false)
|
||||
{
|
||||
graph.palette(true, colors::white);
|
||||
tr.render({ 17 + interval, 2 }, title.c_str(), title.length(), pixels);
|
||||
graph.palette(true, { 0x80, 0x80, 0x80 });
|
||||
}
|
||||
else
|
||||
graph.palette(true, widget_->fgcolor());
|
||||
|
||||
tr.render({ 16 + interval, 1 }, title.c_str(), title.length(), pixels);
|
||||
}
|
||||
}
|
||||
//end class drawer
|
||||
} //end namespace checkbox
|
||||
}//end namespace drawerbase
|
||||
@@ -209,6 +205,7 @@ namespace checkbox
|
||||
e.uiobj->react(true);
|
||||
API::umake_event(e.eh_checked);
|
||||
API::umake_event(e.eh_destroy);
|
||||
API::umake_event(e.eh_keyboard);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -851,7 +851,7 @@ namespace nana
|
||||
throw_not_utf8(str);
|
||||
drawerbase::label::renderer rd;
|
||||
rd.format(format_enabled);
|
||||
rd.parse(utf8_cast(str));
|
||||
rd.parse(to_wstring(str));
|
||||
return rd.measure(graph, allowed_width_in_pixel, h_align, v_align);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A text editor 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
|
||||
@@ -1255,11 +1255,12 @@ namespace nana{ namespace widgets
|
||||
return (a.begin < b.begin);
|
||||
});
|
||||
|
||||
auto previous = entities.begin();
|
||||
auto i = previous + 1;
|
||||
while(i != entities.end())
|
||||
auto i = entities.begin();
|
||||
auto bound = i->end;
|
||||
|
||||
for (++i; i != entities.end(); )
|
||||
{
|
||||
if (previous->end > i->begin)
|
||||
if (bound > i->begin)
|
||||
i = entities.erase(i); // erase overlaping. Left only the first.
|
||||
else
|
||||
++i;
|
||||
@@ -1321,7 +1322,7 @@ namespace nana{ namespace widgets
|
||||
auto sp = std::make_shared<keyword_scheme>();
|
||||
sp->fgcolor = fgcolor;
|
||||
sp->bgcolor = bgcolor;
|
||||
keywords_->schemes[name] = sp;
|
||||
keywords_->schemes[name].swap(sp);
|
||||
}
|
||||
|
||||
void text_editor::erase_highlight(const std::string& name)
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace drawerbase {
|
||||
std::wstring line_text;
|
||||
if (editor->getline(line_index, line_text))
|
||||
{
|
||||
text = utf8_cast(line_text);
|
||||
text = to_utf8(line_text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,8 +343,8 @@ namespace nana
|
||||
else
|
||||
{
|
||||
wchar_t wstr[2] = { key, 0 };
|
||||
pattern += utf8_cast(wstr);
|
||||
track_node.key_buf += utf8_cast(wstr);
|
||||
pattern += to_utf8(wstr);
|
||||
track_node.key_buf += to_utf8(wstr);
|
||||
}
|
||||
|
||||
const node_type *begin = node_state.selected ? node_state.selected : attr.tree_cont.get_root()->child;
|
||||
@@ -995,7 +995,7 @@ namespace nana
|
||||
|
||||
bool item_proxy::operator==(const wchar_t* s) const
|
||||
{
|
||||
return (node_ && s && (node_->value.second.text == utf8_cast(s)));
|
||||
return (node_ && s && (node_->value.second.text == to_utf8(s)));
|
||||
}
|
||||
|
||||
// Behavior of Iterator
|
||||
|
||||
Reference in New Issue
Block a user