fix issue that selection box appears in single selection listbox(#204)

This commit is contained in:
Jinhao 2017-05-04 05:08:07 +08:00
parent aab3686037
commit abda8e55ec
2 changed files with 8 additions and 5 deletions

View File

@ -164,11 +164,9 @@ namespace nana {
speed_horz = (std::min)(5, (std::max)(speed_horz, -5));
speed_vert = (std::min)(5, (std::max)(speed_vert, -5));
view.move_origin({
return view.move_origin({
speed_horz, speed_vert
});
return true;
}
void size_changed(bool try_update)
@ -435,10 +433,12 @@ namespace nana {
}
}
void content_view::move_origin(const point& skew)
bool content_view::move_origin(const point& skew)
{
auto imd_area = this->view_area();
auto pre_origin = impl_->origin;
impl_->origin.x += skew.x;
if (impl_->origin.x + imd_area.width > impl_->content_size.width)
impl_->origin.x = static_cast<int>(impl_->content_size.width) - static_cast<int>(imd_area.width);
@ -451,6 +451,8 @@ namespace nana {
impl_->origin.y = static_cast<int>(impl_->content_size.height) - static_cast<int>(imd_area.height);
if (impl_->origin.y < 0) impl_->origin.y = 0;
return (pre_origin != impl_->origin);
}
void content_view::sync(bool try_update)

View File

@ -70,7 +70,8 @@ namespace skeletons
void change_position(int pos, bool aligned, bool horz);
void move_origin(const point& skew);
/// Returns true if the origin is moved
bool move_origin(const point& skew);
void sync(bool try_update);