Allow using custom main window in wxComboCtrl

Add wxComboCtrl::SetMainControl() which can be used to use some other
window instead of the default wxTextCtrl as the main window of the
combo control.

Update the sample and the documentation to show the new function.
This commit is contained in:
Vadim Zeitlin
2021-09-08 19:38:28 +01:00
parent 13c6c619ac
commit 573e4fa0ec
4 changed files with 137 additions and 32 deletions

View File

@@ -197,6 +197,10 @@ public:
// get the popup window containing the popup control
wxWindow *GetPopupWindow() const { return m_winPopup; }
// Set the control to use instead of the default text control for the main
// (always visible) part of the combobox.
void SetMainControl(wxWindow* win);
// Get the text control which is part of the combobox.
wxTextCtrl *GetTextCtrl() const { return m_text; }
@@ -623,8 +627,12 @@ protected:
// This is used when control is unfocused and m_valueString is empty
wxString m_hintText;
// the text control and button we show all the time
// This pointer is non-null if we use a text control, and not some other
// window, as the main control.
wxTextCtrl* m_text;
// the window and button we show all the time
wxWindow* m_mainWindow;
wxWindow* m_btn;
// wxPopupWindow or similar containing the window managed by the interface.