Hierarchical menu sublevels

I need to create a hierarchicalMenu with indicators that show where there are sublevels before selecting any item. It would also be a plus if I could start with one top level item “opened” without it being selected (to show the most important sublevel items from the start). I have not found any way of achieving this since the item in hierarchicalMenu doesn’t seem to contain that info. However, the results from the query seem to contain everything that’s needed. Is there any way to get that info with a custom hierarchicalMenu widget or can I access the results object somehow? Because if I can access the results object while inside the custom hierarchicalMenu widget code, I think I can get it done.