wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.29k stars 516 forks source link

Feature Request: allow arbitrary windows as label to StaticBox #2563

Open emersonrp opened 3 months ago

emersonrp commented 3 months ago

wxWidgets' C++ implementation has an overloaded constructor that allows building a StaticBox with a wxWindow object substituted for the default text label. This allows for adding, for instance, a checkbox that might be used to enable/disable the controls within the StaticBox. It would be extremely shiny if wxPython exposed / supported this functionality.

https://docs.wxwidgets.org/latest/classwx_static_box.html#aedd6c9352e976dcc55e8112143cca6f7

DietmarSchwertberger commented 3 months ago

The relevant section seems to be in etg\statbox.py:

    # TODO: The window-label ctor is only available on MSW and GTK so disable
    # for now. Maybe replace it with a factory function that returns None on
    # OSX??
    c.find('wxStaticBox').findOverload('wxWindow *label').ignore()

    # "unfix" the 2nd ctor and Create method so the required parameter lists
    # are different enough for them to be overloaded.
    #for name in ['wxStaticBox', 'Create']:
    #    m = c.find(name).findOverload('wxWindow *label')
    #    m.find('id').default = ''

And in e.g. ext\wxWidgets\include\wx\msw\statbox.h

// Indicate that we have the ctor overload taking wxWindow as label.
#define wxHAS_WINDOW_LABEL_IN_STATIC_BOX