Suggestion: Tooltip in ListBox


#1

Hello Jules,
following the modifications suggested by francis in http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=4597&p=24318 concerning individual table cells tooltips, I ask you if you could do the same for the ListBox / ListBoxModel classes.

Make ListBoxRowComponent inherit from TooltipClient:

class ListBoxRowComponent : public Component, public TooltipClient
Implement the getTooltip() function in ListBoxRowComponent:

[code] const String getTooltip()
{
if (owner.getModel() != 0)
return owner.getModel()->getRowTooltip (row);

    return String::empty;
}

[/code]
Add a new virtual function in ListBoxModel:

/** Returns a tooltip for a particular row in the list. */ virtual const String getRowTooltip (int rowNumber);
With the following default implementation:

const String ListBoxModel::getRowTooltip (int /*rowNumber*/) { return String::empty; }
This also allows you to easily show the tooltip of the listbox when the mouse is on one row, not only when it is on the empty space.
Thanks

Amedeo


#2

Good suggestion! Thanks!


#3