listbox::hovered now returns absolute position

fix related issue #528
This commit is contained in:
Jinhao
2020-03-27 07:28:48 +08:00
parent c9b9451443
commit 419d615505
2 changed files with 24 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
/*
* A List Box Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2020 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -5736,6 +5736,14 @@ namespace nana
return index_pair{ npos, npos };
}
listbox::index_pair listbox::index_cast(index_pair idx, bool from_display_order) const
{
internal_scope_guard lock;
idx.item = at(idx.cat).index_cast(idx.item, from_display_order);
return idx;
}
listbox::index_pair listbox::hovered(bool return_end) const
{
using parts = drawerbase::listbox::essence::parts;
@@ -5755,9 +5763,11 @@ namespace nana
if (0 < pos.cat)
--pos.cat;
pos.item = this->size_item(pos.cat);
}
return pos;
return pos;
}
return index_cast(pos, true);
}
else if (return_end)
return index_pair{ this->size_categ() - 1, this->size_item(this->size_categ() - 1) };