turbobadger
turbobadger copied to clipboard
tooltips on onenter/onexit events
Hi,
I learning your turbo badger gui library and I think it amazing, light, and elegant gui library. Thank you very much for your work! Just one question: I trying to implement tooltips for my custom widget (derived from TBWidget) used in desktop application. I created my TBTooltip derived from TBPopupWindow but I need event (or something like) where I can show and hide tooltip. I think the best way are events on mouse enter and mouse exit to widget, but I didn't found them in turbo badger. It would be great if you implement this events in future, it will be useful for custom widgets in desktop applications.
Could you point me simplest way to implement tooltips? I think about "EVENT_TYPE_POINTER_MOVE and timers" solution but I don't like this.
Thank you!
I don't think you'll need onenter/onexit events to implement tooltips.
This is the plan i've had to implement tooltip support (i still haven't gotten around to do it):
TBTooltipManager: -Register itself as an global event listener (TBWidgetListener::AddGlobalListener) -Look at TBWidget::hovered_widget from EVENT_TYPE_POINTER_MOVE to update the show timeout or hide. -Deal with the show timeout using PostMessageDelayed.
TBWidget should get something like this: virtual const char *GetContentDescriptionString() { return g_tb_lng->GetString(m_content_desc_id); } All widgets may then optionally specify an language string id that will be fetched by the tooltip manager when showing the tooltip (and then updated every X ms). An custom widget may even override and return something generated programmatically (like "40% done").
I thought about making an TBPopupBubble subclassing TBPopupWindow (or just extending it) to handle edge arrow pointing at the target widget, and then use that for tooltips and stuff. But that is much less prioritized.
-Extra wishlist: Long-press shows tooltips on Android, so it would be great if TBTooltipManager supported that for events that has the touch flag set.
Thanks! Sounds easy :) I can try to implement this in main branch, if you want.