Maybe if still too slow we might also copy this cache to the canvas so it can reuse our results, but for now it seems fast enough. Unfortunately that would make the dependency between the classes bigger as wanted.
In the MP lobby it can happen that a listbox has first zero items, then gets filled and since there are no visible items the second assert after this block will be triggered. Use this ugly hack to avoid that case. (This hack also added the gui/widgets/window.hpp include.)
There's still a bug left. When you select a text which is in the ellipses on the right side the text gets reformatted with ellipses on the left and the selected character is not the one under the cursor. Other widget toolkits don't show ellipses and have no indication more text is available. Haven't found what the best thing to do would be. Until that time leave it as is.
since there is no mouse event nesting (or event nesting at all) we need to capture all events. This means items on the panel will never receive an event, which gives problems with for example the intended button on the addon panel. So we need to chain mouse events as well and also add a handled flag for them.
For now the linked group is initialized when the layout of the widget is initialized. The best time to set it would be upon adding the widget in the window. Need to look whether it's possible in a clean way. Maybe a signal just prior to showing a window where the widget can do some of it's on things, would also be nice for widgets that need a finalizer function.
This function enables the wml markup for all items, but the interface is a bit hacky. Especially the fiddling in the internals of the listbox is ugly. There needs to be a clean interface to set whether a widget has a markup and what kind of markup. These fixes will be post 1.6.
FixMe YogiHH: This is only made to have the buttons store their background information, otherwise the background will appear completely black. It would more straightforward to call bg_update, but that is not public and there seems to be no other way atm to call it. I will check if bg_update can be made public.
Validate the code it seems a down event with a captured mouse doesn't really work as wanted. (Rare case but should work properly.) In general the mouse event handling needs testing to see whether the proper events are send all the time.