use lambda instead of std::bind

This commit is contained in:
Jinhao
2015-09-27 05:31:42 +08:00
parent 90533b3a83
commit 2f47e89af1
8 changed files with 212 additions and 28 deletions

View File

@@ -172,10 +172,31 @@ namespace nana
{
editor_->editable(enb);
/*
if(enb)
editor_->ext_renderer().background = nullptr;
else
editor_->ext_renderer().background = std::bind(&drawer_impl::_m_draw_background, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
editor_->ext_renderer().background = std::bind(&drawer_impl::_m_draw_background, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); //deprecated
*/
if (!enb)
{
editor_->ext_renderer().background = [this](graph_reference graph, const ::nana::rectangle&, const ::nana::color&)
{
auto clr_from = colors::button_face_shadow_start;
auto clr_to = colors::button_face_shadow_end;
int pare_off_px = 1;
if (element_state::pressed == state_.button_state)
{
pare_off_px = 2;
std::swap(clr_from, clr_to);
}
graph.gradual_rectangle(::nana::rectangle(graph.size()).pare_off(pare_off_px), clr_from, clr_to, true);
};
}
else
editor_->ext_renderer().background = nullptr;
editor_->enable_background(enb);
editor_->enable_background_counterpart(!enb);
@@ -433,8 +454,8 @@ namespace nana
API::refresh_window(*widget_);
}
}
void _m_draw_background(graph_reference graph, const rectangle&, const ::nana::color&)
/*
void _m_draw_background(graph_reference graph, const rectangle&, const ::nana::color&) //deprecated
{
auto clr_from = colors::button_face_shadow_start;
auto clr_to = colors::button_face_shadow_end;
@@ -448,7 +469,7 @@ namespace nana
graph.gradual_rectangle(::nana::rectangle(graph.size()).pare_off(pare_off_px), clr_from, clr_to, true);
}
*/
void _m_draw_push_button(bool enabled)
{
::nana::rectangle r{graph_->size()};