make all internal event handlers unignorable

This commit is contained in:
cnjinhao 2015-02-04 01:34:50 +08:00
parent 9627a05280
commit 38552b855b
14 changed files with 58 additions and 55 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Basis Implementation * Basis Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,6 +1,7 @@
/* /*
* Basis Implementation * Basis Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,7 +1,7 @@
/* /*
* A Drawing Implementation * A Drawing Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -123,7 +123,7 @@ namespace nana
{ {
path_.create(*this); path_.create(*this);
path_.splitstr(STR("/")); path_.splitstr(STR("/"));
path_.events().selected([this](const arg_categorize<int>&) path_.events().selected.connect_unignorable([this](const arg_categorize<int>&)
{ {
auto path = path_.caption(); auto path = path_.caption();
auto root = path.substr(0, path.find(STR('/'))); auto root = path.substr(0, path.find(STR('/')));
@ -142,7 +142,7 @@ namespace nana
filter_.multi_lines(false); filter_.multi_lines(false);
filter_.tip_string(STR("Filter")); filter_.tip_string(STR("Filter"));
filter_.events().key_release([this](const arg_keyboard&) filter_.events().key_release.connect_unignorable([this](const arg_keyboard&)
{ {
_m_list_fs(); _m_list_fs();
}); });
@ -150,7 +150,7 @@ namespace nana
btn_folder_.create(*this); btn_folder_.create(*this);
btn_folder_.caption(STR("&New Folder")); btn_folder_.caption(STR("&New Folder"));
btn_folder_.events().click([this](const arg_mouse&) btn_folder_.events().click.connect_unignorable([this](const arg_mouse&)
{ {
form fm(this->handle(), API::make_center(*this, 300, 35)); form fm(this->handle(), API::make_center(*this, 300, 35));
fm.caption(STR("Name the new folder")); fm.caption(STR("Name the new folder"));
@ -161,12 +161,12 @@ namespace nana
button btn(fm, nana::rectangle(170, 5, 60, 25)); button btn(fm, nana::rectangle(170, 5, 60, 25));
btn.caption(STR("Create")); btn.caption(STR("Create"));
btn.events().click(folder_creator(*this, fm, folder)); btn.events().click.connect_unignorable(folder_creator(*this, fm, folder));
button btn_cancel(fm, nana::rectangle(235, 5, 60, 25)); button btn_cancel(fm, nana::rectangle(235, 5, 60, 25));
btn_cancel.caption(STR("Cancel")); btn_cancel.caption(STR("Cancel"));
btn_cancel.events().click([&fm](const arg_mouse&) btn_cancel.events().click.connect_unignorable([&fm](const arg_mouse&)
{ {
fm.close(); fm.close();
}); });
@ -184,8 +184,8 @@ namespace nana
auto fn_sel_file = [this](const arg_mouse& arg){ auto fn_sel_file = [this](const arg_mouse& arg){
_m_sel_file(arg); _m_sel_file(arg);
}; };
ls_file_.events().dbl_click(fn_sel_file); ls_file_.events().dbl_click.connect_unignorable(fn_sel_file);
ls_file_.events().mouse_down(fn_sel_file); ls_file_.events().mouse_down.connect_unignorable(fn_sel_file);
ls_file_.set_sort_compare(0, [](const nana::string& a, nana::any* fs_a, const nana::string& b, nana::any* fs_b, bool reverse) -> bool ls_file_.set_sort_compare(0, [](const nana::string& a, nana::any* fs_a, const nana::string& b, nana::any* fs_b, bool reverse) -> bool
{ {
int dira = fs_a->get<item_fs>()->directory ? 1 : 0; int dira = fs_a->get<item_fs>()->directory ? 1 : 0;
@ -262,7 +262,7 @@ namespace nana
tb_file_.create(*this); tb_file_.create(*this);
tb_file_.multi_lines(false); tb_file_.multi_lines(false);
tb_file_.events().key_char([this](const arg_keyboard& arg) tb_file_.events().key_char.connect_unignorable([this](const arg_keyboard& arg)
{ {
if(arg.key == nana::keyboard::enter) if(arg.key == nana::keyboard::enter)
_m_ok(); _m_ok();
@ -270,19 +270,19 @@ namespace nana
cb_types_.create(*this); cb_types_.create(*this);
cb_types_.editable(false); cb_types_.editable(false);
cb_types_.events().selected([this](const arg_combox&){ _m_list_fs(); }); cb_types_.events().selected.connect_unignorable([this](const arg_combox&){ _m_list_fs(); });
btn_ok_.create(*this); btn_ok_.create(*this);
btn_ok_.caption(STR("&OK")); btn_ok_.caption(STR("&OK"));
btn_ok_.events().click([this](const arg_mouse&) btn_ok_.events().click.connect_unignorable([this](const arg_mouse&)
{ {
_m_ok(); _m_ok();
}); });
btn_cancel_.create(*this); btn_cancel_.create(*this);
btn_cancel_.caption(STR("&Cancel")); btn_cancel_.caption(STR("&Cancel"));
btn_cancel_.events().click([this](const arg_mouse&) btn_cancel_.events().click.connect_unignorable([this](const arg_mouse&)
{ {
API::close_window(handle()); API::close_window(handle());
}); });
@ -440,12 +440,12 @@ namespace nana
} }
} }
tree_.events().expanded([this](const arg_treebox& arg) tree_.events().expanded.connect_unignorable([this](const arg_treebox& arg)
{ {
_m_tr_expand(arg.item, arg.operated); _m_tr_expand(arg.item, arg.operated);
}); });
tree_.events().selected([this](const arg_treebox& arg) tree_.events().selected.connect_unignorable([this](const arg_treebox& arg)
{ {
if(arg.operated && (arg.item.value<kind::t>() == kind::filesystem)) if(arg.operated && (arg.item.value<kind::t>() == kind::filesystem))
{ {

View File

@ -53,7 +53,7 @@ namespace nana
place_.bind(*this); place_.bind(*this);
yes_.create(*this); yes_.create(*this);
yes_.events().click([this](const arg_mouse& arg) yes_.events().click.connect_unignorable([this](const arg_mouse& arg)
{ {
_m_click(arg); _m_click(arg);
}); });
@ -65,7 +65,7 @@ namespace nana
yes_.caption(STR("Yes")); yes_.caption(STR("Yes"));
no_.create(*this); no_.create(*this);
no_.caption(STR("No")); no_.caption(STR("No"));
no_.events().click([this](const arg_mouse& arg) no_.events().click.connect_unignorable([this](const arg_mouse& arg)
{ {
_m_click(arg); _m_click(arg);
}); });
@ -76,7 +76,7 @@ namespace nana
{ {
cancel_.create(*this); cancel_.create(*this);
cancel_.caption(STR("Cancel")); cancel_.caption(STR("Cancel"));
cancel_.events().click([this](const arg_mouse& arg) cancel_.events().click.connect_unignorable([this](const arg_mouse& arg)
{ {
_m_click(arg); _m_click(arg);
}); });
@ -482,14 +482,14 @@ namespace nana
btn_ok_.create(*this); btn_ok_.create(*this);
btn_ok_.i18n(i18n_eval("OK")); btn_ok_.i18n(i18n_eval("OK"));
btn_ok_.events().click([this]{ btn_ok_.events().click.connect_unignorable([this]{
close(); close();
valid_input_ = true; valid_input_ = true;
}); });
btn_cancel_.create(*this); btn_cancel_.create(*this);
btn_cancel_.i18n(i18n_eval("Cancel")); btn_cancel_.i18n(i18n_eval("Cancel"));
btn_cancel_.events().click([this]{ btn_cancel_.events().click.connect_unignorable([this]{
close(); close();
}); });
@ -611,13 +611,13 @@ namespace nana
ss << impl->value; ss << impl->value;
impl->spinbox.value(ss.str()); impl->spinbox.value(ss.str());
impl->dock.events().resized([impl, label_px, value_px](const ::nana::arg_resized& arg) impl->dock.events().resized.connect_unignorable([impl, label_px, value_px](const ::nana::arg_resized& arg)
{ {
impl->label.size({ label_px, arg.height }); impl->label.size({ label_px, arg.height });
impl->spinbox.size({ value_px, arg.height }); impl->spinbox.size({ value_px, arg.height });
}); });
impl->spinbox.events().destroy([impl] impl->spinbox.events().destroy.connect_unignorable([impl]
{ {
impl->value = impl->spinbox.to_int(); impl->value = impl->spinbox.to_int();
}); });
@ -698,13 +698,13 @@ namespace nana
ss << impl->value; ss << impl->value;
impl->spinbox.value(ss.str()); impl->spinbox.value(ss.str());
impl->dock.events().resized([impl, label_px, value_px](const ::nana::arg_resized& arg) impl->dock.events().resized.connect_unignorable([impl, label_px, value_px](const ::nana::arg_resized& arg)
{ {
impl->label.size({ label_px, arg.height }); impl->label.size({ label_px, arg.height });
impl->spinbox.size({ value_px, arg.height }); impl->spinbox.size({ value_px, arg.height });
}); });
impl->spinbox.events().destroy([impl] impl->spinbox.events().destroy.connect_unignorable([impl]
{ {
impl->value = impl->spinbox.to_int(); impl->value = impl->spinbox.to_int();
}); });
@ -792,7 +792,7 @@ namespace nana
impl->combox.push_back(s); impl->combox.push_back(s);
} }
impl->dock.events().resized([impl, label_px, value_px](const ::nana::arg_resized& arg) impl->dock.events().resized.connect_unignorable([impl, label_px, value_px](const ::nana::arg_resized& arg)
{ {
impl->label.size({ label_px, arg.height }); impl->label.size({ label_px, arg.height });
if (value_px) if (value_px)
@ -802,7 +802,7 @@ namespace nana
}); });
auto & wdg = (value_px ? static_cast<widget&>(impl->combox) : static_cast<widget&>(impl->textbox)); auto & wdg = (value_px ? static_cast<widget&>(impl->combox) : static_cast<widget&>(impl->textbox));
wdg.events().destroy([&wdg, impl] wdg.events().destroy.connect_unignorable([&wdg, impl]
{ {
impl->value = wdg.caption(); impl->value = wdg.caption();
}); });
@ -906,7 +906,7 @@ namespace nana
ss << date.year; ss << date.year;
impl->wdg_year.value(ss.str()); impl->wdg_year.value(ss.str());
impl->dock.events().resized([impl, label_px](const ::nana::arg_resized& arg) impl->dock.events().resized.connect_unignorable([impl, label_px](const ::nana::arg_resized& arg)
{ {
impl->label.size({ label_px, arg.height }); impl->label.size({ label_px, arg.height });
auto sz = impl->wdg_month.size(); auto sz = impl->wdg_month.size();
@ -922,13 +922,13 @@ namespace nana
impl->wdg_year.size(sz); impl->wdg_year.size(sz);
}); });
impl->wdg_day.events().destroy([impl] impl->wdg_day.events().destroy.connect_unignorable([impl]
{ {
impl->day = impl->wdg_day.to_int(); impl->day = impl->wdg_day.to_int();
impl->month = impl->wdg_month.option() + 1; impl->month = impl->wdg_month.option() + 1;
}); });
impl->wdg_year.events().destroy([impl] impl->wdg_year.events().destroy.connect_unignorable([impl]
{ {
impl->year = impl->wdg_year.to_int(); impl->year = impl->wdg_year.to_int();
}); });
@ -956,8 +956,8 @@ namespace nana
impl->wdg_day.value(ss.str()); impl->wdg_day.value(ss.str());
}; };
impl->wdg_year.events().text_changed(make_days); impl->wdg_year.events().text_changed.connect_unignorable(make_days);
impl->wdg_month.events().selected(make_days); impl->wdg_month.events().selected.connect_unignorable(make_days);
return impl->dock; return impl->dock;
} }

View File

@ -1556,7 +1556,7 @@ namespace nana
splitter_.cursor(splitter_cursor_); splitter_.cursor(splitter_cursor_);
dragger_.trigger(splitter_); dragger_.trigger(splitter_);
splitter_.events().mouse_down.connect([this](const arg_mouse& arg) splitter_.events().mouse_down.connect_unignorable([this](const arg_mouse& arg)
{ {
if (false == arg.left_button) if (false == arg.left_button)
return; return;
@ -1584,7 +1584,7 @@ namespace nana
right_pixels_ = area_right.*px_ptr; right_pixels_ = area_right.*px_ptr;
}); });
splitter_.events().mouse_move.connect([this](const arg_mouse& arg) splitter_.events().mouse_move.connect_unignorable([this](const arg_mouse& arg)
{ {
if (false == arg.left_button) if (false == arg.left_button)
return; return;

View File

@ -1,7 +1,7 @@
/* /*
* A Button Implementation * A Button Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -479,7 +479,7 @@ namespace nana{ namespace drawerbase
void button::_m_complete_creation() void button::_m_complete_creation()
{ {
events().shortkey.connect([this] events().shortkey.connect_unignorable([this]
{ {
_m_shortkey(); _m_shortkey();
}); });

View File

@ -1,7 +1,7 @@
/* /*
* A Categorize Implementation * A Categorize Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -593,7 +593,7 @@ namespace nana
r.width = r.height = 100; r.width = r.height = 100;
style_.listbox = &(form_loader<nana::float_listbox>()(window_, r, true)); style_.listbox = &(form_loader<nana::float_listbox>()(window_, r, true));
style_.listbox->set_module(style_.module, 16); style_.listbox->set_module(style_.module, 16);
style_.listbox->events().destroy.connect([this] style_.listbox->events().destroy.connect_unignorable([this]
{ {
_m_list_closed(); _m_list_closed();
}); });

View File

@ -1,6 +1,7 @@
/* /*
* A CheckBox Implementation * A CheckBox Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -207,8 +208,8 @@ namespace checkbox
element_tag el; element_tag el;
el.uiobj = &uiobj; el.uiobj = &uiobj;
el.eh_checked = uiobj.events().click.connect_front(std::bind(&radio_group::_m_checked, this, std::placeholders::_1)); el.eh_checked = uiobj.events().click.connect_unignorable(std::bind(&radio_group::_m_checked, this, std::placeholders::_1), true);
el.eh_destroy = uiobj.events().destroy.connect(std::bind(&radio_group::_m_destroy, this, std::placeholders::_1)); el.eh_destroy = uiobj.events().destroy.connect_unignorable(std::bind(&radio_group::_m_destroy, this, std::placeholders::_1));
ui_container_.push_back(el); ui_container_.push_back(el);
} }

View File

@ -240,7 +240,7 @@ namespace nana
//The lister window closes by itself. I just take care about the destroy event. //The lister window closes by itself. I just take care about the destroy event.
//The event should be destroy rather than unload. Because the unload event is invoked while //The event should be destroy rather than unload. Because the unload event is invoked while
//the lister is not closed, if popuping a message box, the lister will cover the message box. //the lister is not closed, if popuping a message box, the lister will cover the message box.
state_.lister->events().destroy.connect([this] state_.lister->events().destroy.connect_unignorable([this]
{ {
_m_lister_close_sig(); _m_lister_close_sig();
}); });

View File

@ -1,7 +1,7 @@
/* /*
* A float_listbox Implementation * A float_listbox Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -242,7 +242,7 @@ namespace nana
if(wd) if(wd)
{ {
widget_ = wd; widget_ = wd;
wd->events().mouse_wheel.connect([this](const arg_wheel& arg){ wd->events().mouse_wheel.connect_unignorable([this](const arg_wheel& arg){
scroll_items(arg.upwards); scroll_items(arg.upwards);
}); });
} }

View File

@ -2020,10 +2020,10 @@ namespace nana
{ {
scroll.h.create(wd, r); scroll.h.create(wd, r);
API::take_active(scroll.h.handle(), false, wd); API::take_active(scroll.h.handle(), false, wd);
scroll.h.events().mouse_move.connect([this](const nana::arg_mouse& arg){ scroll.h.events().mouse_move.connect_unignorable([this](const nana::arg_mouse& arg){
_m_answer_scroll(arg); _m_answer_scroll(arg);
}); });
scroll.h.events().mouse_up.connect([this](const nana::arg_mouse& arg){ scroll.h.events().mouse_up.connect_unignorable([this](const nana::arg_mouse& arg){
_m_answer_scroll(arg); _m_answer_scroll(arg);
}); });
} }
@ -2040,12 +2040,12 @@ namespace nana
{ {
scroll.v.create(wd, r); scroll.v.create(wd, r);
API::take_active(scroll.v.handle(), false, wd); API::take_active(scroll.v.handle(), false, wd);
scroll.v.events().mouse_move.connect([this](const ::nana::arg_mouse& arg) scroll.v.events().mouse_move.connect_unignorable([this](const ::nana::arg_mouse& arg)
{ {
_m_answer_scroll(arg); _m_answer_scroll(arg);
}); });
scroll.v.events().mouse_up.connect([this](const ::nana::arg_mouse& arg) scroll.v.events().mouse_up.connect_unignorable([this](const ::nana::arg_mouse& arg)
{ {
_m_answer_scroll(arg); _m_answer_scroll(arg);
}); });

View File

@ -741,21 +741,21 @@ namespace nana
API::register_menu_window(this->handle(), !owner_menubar); API::register_menu_window(this->handle(), !owner_menubar);
} }
events().destroy.connect([this]{ events().destroy.connect_unignorable([this]{
_m_destroy(); _m_destroy();
}); });
events().key_press.connect([this](const arg_keyboard& arg){ events().key_press.connect_unignorable([this](const arg_keyboard& arg){
_m_key_down(arg); _m_key_down(arg);
}); });
events().mouse_up.connect([this]{ events().mouse_up.connect_unignorable([this]{
pick(); pick();
}); });
if (want_focus_) if (want_focus_)
{ {
event_focus_ = events().focus.connect([this](const arg_focus& arg) event_focus_ = events().focus.connect_unignorable([this](const arg_focus& arg)
{ {
_m_focus_changed(arg); _m_focus_changed(arg);
}); });
@ -993,7 +993,7 @@ namespace nana
void _m_make_mouse_event() void _m_make_mouse_event()
{ {
state_.mouse_pos = API::cursor_position(); state_.mouse_pos = API::cursor_position();
events().mouse_move.connect([this]{ events().mouse_move.connect_unignorable([this]{
_m_mouse_event(); _m_mouse_event();
}); });
} }
@ -1324,7 +1324,7 @@ namespace nana
{ {
close(); close();
impl_->uiobj = &(form_loader<drawerbase::menu::menu_window, false>()(wd, point(x, y), &(*impl_->mbuilder.renderer()))); impl_->uiobj = &(form_loader<drawerbase::menu::menu_window, false>()(wd, point(x, y), &(*impl_->mbuilder.renderer())));
impl_->uiobj->events().destroy.connect([this]{ impl_->uiobj->events().destroy.connect_unignorable([this]{
_m_destroy_menu_window(); _m_destroy_menu_window();
}); });
impl_->uiobj->popup(impl_->mbuilder.data(), called_by_menubar); impl_->uiobj->popup(impl_->mbuilder.data(), called_by_menubar);

View File

@ -1,5 +1,6 @@
/* /*
* A Toolbar Implementation * A Toolbar Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
@ -277,7 +278,7 @@ namespace nana
widget_ = static_cast< ::nana::toolbar*>(&widget); widget_ = static_cast< ::nana::toolbar*>(&widget);
widget.caption(STR("Nana Toolbar")); widget.caption(STR("Nana Toolbar"));
impl_->event_size = widget.events().resized.connect(std::bind(&drawer::_m_owner_sized, this, std::placeholders::_1)); impl_->event_size = widget.events().resized.connect_unignorable(std::bind(&drawer::_m_owner_sized, this, std::placeholders::_1));
} }