Switch to single top-level function for bitmap and bundle code
Description:
I'm going to combine two unrelated issues into a single PR, referencing this issue for a more detailed description as well as tracking if it causes problems. Note that this is a significant redesign of all the code that requires a bitmap or bitmap bundle as a function parameter.
wxWidgets 3.2 (as of 9/18/23) still doesn't support wxBitmapBundle for wxRibbonBar tools. That's a problem when using a ribbon bar on Windows high DPI display monitors (wxUiEditor has this problem for it's own UI). I've got a workaround for C++, but it needs to be extended to support wxPython and wxRuby.
There is an issue with toolbar tools when there are 3+ bitmaps to create a bundle from. In C++, this creates a bracketed section so that we can create a vector to add the bitmaps and pass that to wxBitmapBundle. That fails if we need the return value from AddTool because we can't access the vector outside of the bracketed section, and we lose the return value if AddTool is within the bracketed section.
There currently is a fix for the C++ code generation for ribbon tools which uses a lambda if there are 3+ bitmaps for the tool. That would also solve the bracketed section problem described above, but we currently can't use the same function because it ends the parameter by calling GetBitmap().
I'm in the process of creating a single function that combines the code for ribbon tools with the code for regular tools, with an option controlling whether GetBitmap() is added or not. That function will provide high-DPI support for ribbon tools, and for C++ using a lambda instead of a bracketed section to deal with 3+ bitmap images. Instead of having C++, Python and Ruby bundle functions in three different source files (and toolbar and ribbon functions in two additional functions), the goal is to have a single source file with a single top-level function for all bundle code generation for a function parameter.
For ribbon tools which require a single bitmap, I am using wxImage::Rescale(FromDPI, wxIMAGE_QUALITY_BILINEAR) if only a single bitmap is supplied. The reason for this is that toolbar tools are generally going to be small graphics. Scaling up using wxIMAGE_QUALITY_BILINEAR will usually produce the best results. Note that if a second, larger image is provided, then wxBitmapBundle::GetBitmap() is used which will scale down fromn the second image using whatever scaling flag it deems best. This will usually produce better results then scaling up.
This now works for C++ and wxRuby3, but not for wxPython (label added to flag it)