capture_window is deprecated in favor of set_capture/release_capture

This commit is contained in:
Jinhao
2016-04-17 06:06:33 +08:00
parent ca1fce932a
commit afa253f924
17 changed files with 114 additions and 72 deletions

View File

@@ -321,11 +321,12 @@ namespace nana{ namespace drawerbase
attr_.e_state = element_state::pressed;
attr_.keep_pressed = true;
API::capture_window(*wdg_, true);
wdg_->set_capture(true);
}
else
{
API::capture_window(*wdg_, false);
wdg_->release_capture();
attr_.keep_pressed = false;
if (attr_.enable_pushed && (false == attr_.pushed))
{

View File

@@ -469,8 +469,8 @@ namespace nana
float_listbox::float_listbox(window wd, const rectangle & r, bool is_ignore_first_mouse_up)
:base_type(wd, false, r, appear::bald<appear::floating, appear::no_activate>())
{
API::capture_window(handle(), true);
API::capture_ignore_children(false);
this->set_capture(false);
API::take_active(handle(), false, parent());
auto & impl = get_drawer_trigger().get_drawer_impl();
impl.clear_state();

View File

@@ -3343,7 +3343,8 @@ namespace nana
nana::point pos = arg.pos;
essence_->widget_to_header(pos);
drawer_header_->grab(pos, true);
API::capture_window(essence_->lister.wd_ptr()->handle(), true);
essence_->lister.wd_ptr()->set_capture(true);
update = 2;
}
}
@@ -3535,7 +3536,7 @@ namespace nana
drawer_header_->grab(pos, false);
refresh(graph);
API::lazy_refresh();
API::capture_window(essence_->lister.wd_ptr()->handle(), false);
essence_->lister.wd_ptr()->release_capture();
}
}

View File

@@ -1719,7 +1719,7 @@ namespace nana{ namespace widgets
if (::nana::mouse::left_button == arg.button)
{
API::capture_window(window_, true);
API::set_capture(window_, true);
text_area_.captured = true;
//Set caret pos by screen point and get the caret pos.
@@ -1764,7 +1764,8 @@ namespace nana{ namespace widgets
}
select_.dragged = false;
API::capture_window(window_, false);
API::release_capture(window_);
text_area_.captured = false;
if (hit_text_area(arg.pos) == false)
API::window_cursor(window_, nana::cursor::arrow);

View File

@@ -263,14 +263,15 @@ namespace nana
slider_state_.trace = slider_state_.TraceCapture;
slider_state_.snap_pos = static_cast<int>(attr_.pos);
slider_state_.refpos = pos;
API::capture_window(other_.wd, true);
API::set_capture(other_.wd, true);
}
bool release_slider()
{
if(slider_state_.trace == slider_state_.TraceCapture)
{
API::capture_window(other_.wd, false);
API::release_capture(other_.wd);
if(other_.wd != API::find_window(API::cursor_position()))
{
slider_state_.trace = slider_state_.TraceNone;

View File

@@ -351,7 +351,8 @@ namespace nana
{
if (!pressed)
{
API::capture_window(editor_->window_handle(), false);
API::release_capture(editor_->window_handle());
timer_.stop();
timer_.interval(600);
}
@@ -361,7 +362,7 @@ namespace nana
//Spins the value when mouse button is released
if (pressed)
{
API::capture_window(editor_->window_handle(), true);
API::set_capture(editor_->window_handle(), true);
range_->spin(buttons::increase == spin_stated_);
reset_text();
timer_.start();

View File

@@ -183,6 +183,16 @@ namespace nana
_m_size(sz);
}
void widget::set_capture(bool ignore_children)
{
API::set_capture(*this, ignore_children);
}
void widget::release_capture()
{
API::release_capture(*this);
}
nana::point widget::pos() const
{
return API::window_position(handle());