BOutlineListView: fix ItemUnderAt and accept NULL as superitem

ItemUnderAt was returning items that were not under the superitem (this
was fixed for EachItemUnder in hrev52210).
Make a NULL superitem mean the parent of the topmost items. Despite not
being explicitly documented in the BeBook, that's how BeOS works, the
MenuWorld test app uses it and, well, it's handy.

Change-Id: I2551e8ce874a6238c5e5fb1eb742e68e62d3928a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7359
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Máximo Castañeda
2024-01-29 18:58:03 +00:00
committed by waddlesplash
parent 787179956b
commit 621200ebbd
4 changed files with 279 additions and 65 deletions
+6 -3
View File
@@ -580,7 +580,8 @@
bool oneLevelOnly) const
\brief Returns the number of items under \a superItem.
\param superItem The base item.
\param superItem The base item, or NULL to use the virtual super item
of level 0 items.
\param oneLevelOnly if \c true, only items located one level under
superItem are considered.
@@ -596,7 +597,8 @@
void* arg)
\brief Calls \a eachFunc for each item under \a superItem.
\param superItem The base item.
\param superItem The base item, or NULL to use the virtual super item
of level 0 items.
\param oneLevelOnly if \c true, only items located one level under
superItem are considered.
\param eachFunc The function to call on each item.
@@ -611,7 +613,8 @@
bool oneLevelOnly, int32 index) const
\brief Returns a pointer to the item at \a index under \a superItem.
\param superItem The base item.
\param superItem The base item, or NULL to use the virtual super item
of level 0 items.
\param oneLevelOnly if \c true, only items located one level under
superItem are considered.
\param index The index of the item to get.