kenz-gelsoft / wxRust2

re-exploration Rust binding to wx
MIT License
78 stars 10 forks source link

Handle specially wxSearchCtrl which isn't wxTextCtrl on MSW #110

Closed kenz-gelsoft closed 2 years ago

kenz-gelsoft commented 2 years ago

This class is documented as it is-a wxTextCtrl,

https://docs.wxwidgets.org/3.2/classwx_search_ctrl.html

but it isn't.

https://github.com/wxWidgets/wxWidgets/blob/v3.2.0/include/wx/srchctrl.h#L26

it actually mimic the wxTextCtrl API through wxTextCtrlIface. so can't static_cast<wxTextCtrl*>().

This result the generated code fails to compile:

// Mix-in(s) to wxSearchCtrl
wxTextEntry *wxSearchCtrl_AsTextEntry(wxSearchCtrl* obj) {
    return static_cast<wxTextEntry*>(obj);
}
kenz-gelsoft commented 2 years ago

pending to generate binding for the wxSearchCtrl for now.

kenz-gelsoft commented 2 years ago

https://github.com/wxWidgets/wxWidgets/blob/61340fcc82cea1c7bbb66a3d34f5a958d3c58e9f/include/wx/textctrl.h#L718

In fact, wxTextCtrl is not a wxTextEntry.

In this case, this is the problem.

Using wxTextEntryBase here instead of wxTextEntry may work.