diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index f069dfe2fb..94ce11aa2c 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -5187,6 +5187,16 @@ public: // Register an image for use in autocompletion lists. void RegisterImage(int type, const wxBitmap& bmp); + // Set the colours used to display the items in an autocompletion list. + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + // Use a wxListCtrl to display autocompletion lists. + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + // The following methods are nearly equivalent to their similarly named diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 21a3a4cac4..f7ca8e70c6 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -7423,6 +7423,54 @@ public: */ void RegisterImage(int type, const wxBitmap& bmp); + /** + Set the colours used to display the items in an autocompletion list. + + This method can be used if the default colours make the list hard to + read or if specific colours are desired for whatever reason. + @param background + The colour used for the background of the list. + @param text + The colour used for all text except for the selected item. + @param highlight + The colour used to highlight the selected item in the list. + @param highlightText + The colour used for the text of the selected item. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompSetColours(const wxColour& background, const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText); + + /** + Use a wxListCtrl to display autocompletion and user lists. + + By default lists will be displayed in a wxListBox. Use this method to + display them in a wxListCtrl instead. The primary difference is that + wxListCtrl has hot tracking to highlight the item under the mouse cursor. + @param useListCtrl + Set this to true to use a wxListCtrl and to false to use a + wxListBox. + @param currentBgColour + The colour used to highlight the item under the mouse cursor. + @param currentTextColour + The colour used for the text of the item under the mouse cursor. + @remarks + To reset one or more of the colours to its default, + call this method with wxNullColour for the colour or colours + to be reset. + + @since 3.1.3 + */ + void AutoCompUseListCtrl(bool useListCtrl = true, + const wxColour& currentBgColour = wxNullColour, + const wxColour& currentTextColour = wxNullColour); + //@} diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index b01802915c..54695d5466 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5046,6 +5046,22 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) m_swx->DoRegisterImage(type, bmp); } +void wxStyledTextCtrl::AutoCompSetColours(const wxColour& background, + const wxColour& text, + const wxColour& highlight, + const wxColour& highlightText) +{ + m_swx->SetListBoxColours(background, text, highlight, highlightText); +} + +void wxStyledTextCtrl::AutoCompUseListCtrl(bool useListCtrl, + const wxColour& currentBgColour, + const wxColour& currentTextColour) +{ + m_swx->UseListCtrlStyleForLists(useListCtrl, currentBgColour, + currentTextColour); +} +