code review
This commit is contained in:
@@ -213,25 +213,14 @@ namespace checkbox
|
||||
element_tag el;
|
||||
|
||||
el.uiobj = &uiobj;
|
||||
//el.eh_checked = uiobj.events().click.connect_unignorable(std::bind(&radio_group::_m_checked, this, std::placeholders::_1), true); //deprecated
|
||||
el.eh_checked = uiobj.events().click.connect_unignorable([this](const arg_click& arg)
|
||||
{
|
||||
for (auto & i : ui_container_)
|
||||
i.uiobj->check(arg.window_handle == i.uiobj->handle());
|
||||
}, true);
|
||||
|
||||
//el.eh_destroy = uiobj.events().destroy.connect_unignorable(std::bind(&radio_group::_m_destroy, this, std::placeholders::_1)); //deprecated
|
||||
el.eh_destroy = uiobj.events().destroy.connect_unignorable([this](const arg_destroy& arg)
|
||||
{
|
||||
/*
|
||||
auto i = std::find_if(ui_container_.begin(), ui_container_.end(), [&arg](decltype(*ui_container_.begin()) & x)
|
||||
{
|
||||
return (arg.window_handle == x.uiobj->handle());
|
||||
});
|
||||
if (i != ui_container_.end())
|
||||
ui_container_.erase(i);
|
||||
*/
|
||||
|
||||
for (auto i = ui_container_.begin(); i != ui_container_.end(); ++i)
|
||||
{
|
||||
if (arg.window_handle == i->uiobj->handle())
|
||||
@@ -247,35 +236,18 @@ namespace checkbox
|
||||
|
||||
std::size_t radio_group::checked() const
|
||||
{
|
||||
auto i = std::find_if(ui_container_.cbegin(), ui_container_.cend(), [](decltype(*ui_container_.cbegin())& x)
|
||||
{
|
||||
return (x.uiobj->checked());
|
||||
});
|
||||
return static_cast<std::size_t>(i - ui_container_.cbegin());
|
||||
for (auto i = ui_container_.cbegin(); i != ui_container_.cend(); ++i)
|
||||
{
|
||||
if (i->uiobj->checked())
|
||||
return static_cast<std::size_t>(i - ui_container_.cbegin());
|
||||
}
|
||||
|
||||
return ui_container_.size();
|
||||
}
|
||||
|
||||
std::size_t radio_group::size() const
|
||||
{
|
||||
return ui_container_.size();
|
||||
}
|
||||
/*
|
||||
void radio_group::_m_checked(const arg_click& arg) //deprecated
|
||||
{
|
||||
for (auto & i : ui_container_)
|
||||
i.uiobj->check(arg.window_handle == i.uiobj->handle());
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void radio_group::_m_destroy(const arg_destroy& arg) //deprecated
|
||||
{
|
||||
auto i = std::find_if(ui_container_.begin(), ui_container_.end(), [&arg](decltype(*ui_container_.begin()) & x)
|
||||
{
|
||||
return (arg.window_handle == x.uiobj->handle());
|
||||
});
|
||||
if(i != ui_container_.end())
|
||||
ui_container_.erase(i);
|
||||
}
|
||||
*/
|
||||
//end class radio_group
|
||||
}//end namespace nana
|
||||
|
||||
Reference in New Issue
Block a user