Merge branch 'stc-simplify-width' of https://github.com/MaartenBent/wxWidgets

Remove some recently added unneeded code for wxSTC auto-complete listbox
(see https://github.com/wxWidgets/wxWidgets/pull/2250).

See https://github.com/wxWidgets/wxWidgets/pull/2277
This commit is contained in:
Vadim Zeitlin
2021-03-13 13:28:28 +01:00
3 changed files with 2 additions and 35 deletions

View File

@@ -2647,7 +2647,6 @@ public:
// Setters
void SetContainerBorderSize(int);
void SetMaxListBoxWidth(int);
// ListBoxImpl implementation
virtual void SetListBoxFont(Font &font);
@@ -2699,7 +2698,6 @@ protected:
int m_textHeight;
int m_itemHeight;
int m_textTopGap;
int m_maxBoxWidth; // 0 means no max width
// These drawing parameters are set internally and can be changed if needed
// to better match the appearance of a list box on a specific platform.
@@ -2713,7 +2711,7 @@ wxSTCListBox::wxSTCListBox(wxWindow* parent, wxSTCListBoxVisualData* v, int ht)
m_visualData(v), m_maxStrWidth(0), m_currentRow(wxNOT_FOUND),
m_doubleClickAction(NULL), m_doubleClickActionData(NULL),
m_aveCharWidth(8), m_textHeight(ht), m_itemHeight(ht),
m_textTopGap(0), m_maxBoxWidth(350)
m_textTopGap(0)
{
wxVListBox::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE, "AutoCompListBox");
@@ -2759,11 +2757,6 @@ void wxSTCListBox::SetContainerBorderSize(int s)
m_borderSize = s;
}
void wxSTCListBox::SetMaxListBoxWidth(int maxWidth)
{
m_maxBoxWidth = maxWidth;
}
void wxSTCListBox::SetListBoxFont(Font &font)
{
SetFont(*((wxFont*)font.GetID()));
@@ -2788,10 +2781,6 @@ PRectangle wxSTCListBox::GetDesiredRect() const
maxw += TextBoxFromClientEdge() + m_textBoxToTextGap + m_aveCharWidth * 3;
// m_maxBoxWidth == 0 or negative means no maximum
if ( ( m_maxBoxWidth > 0 ) && ( maxw > m_maxBoxWidth ) )
maxw = m_maxBoxWidth;
// estimate a desired height
const int count = Length();
const int desiredVisibleRows = m_visualData->GetDesiredVisibleRows();
@@ -3282,7 +3271,7 @@ void wxSTCListBoxWin::OnPaint(wxPaintEvent& WXUNUSED(evt))
//----------------------------------------------------------------------
ListBoxImpl::ListBoxImpl()
:m_listBox(NULL), m_visualData(new wxSTCListBoxVisualData(5)), m_listBoxWidth(-1)
:m_listBox(NULL), m_visualData(new wxSTCListBoxVisualData(5))
{
}
@@ -3301,19 +3290,6 @@ void ListBoxImpl::Create(Window &parent, int WXUNUSED(ctrlID),
bool WXUNUSED(unicodeMode_), int technology_) {
wid = new wxSTCListBoxWin(GETWIN(parent.GetID()), &m_listBox, m_visualData,
lineHeight_, technology_);
if ( m_listBoxWidth >= 0 )
m_listBox->SetMaxListBoxWidth(m_listBoxWidth);
}
void ListBoxImpl::SetMaxListBoxWidth(int width) {
// Store the setting for future list box creations
m_listBoxWidth = width;
// Update the listbox if it currently exists, but allow this to be called before it is created
if ( m_listBox )
m_listBox->SetMaxListBoxWidth(m_listBoxWidth);
}

View File

@@ -23,10 +23,6 @@ private:
wxSTCListBox* m_listBox;
wxSTCListBoxVisualData* m_visualData;
// Allow the implementation to control the width of the underlying listbox.
// If this is negative, then the underlying listbox retains control over the max width.
int m_listBoxWidth;
public:
ListBoxImpl();
~ListBoxImpl();
@@ -34,7 +30,6 @@ public:
virtual void SetFont(Font &font) wxOVERRIDE;
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) wxOVERRIDE;
void SetMaxListBoxWidth(int width);
virtual void SetAverageCharWidth(int width) wxOVERRIDE;
virtual void SetVisibleRows(int rows) wxOVERRIDE;
virtual int GetVisibleRows() const wxOVERRIDE;
@@ -42,7 +37,6 @@ public:
virtual int CaretFromEdge() wxOVERRIDE;
virtual void Clear() wxOVERRIDE;
virtual void Append(char *s, int type = -1) wxOVERRIDE;
void Append(const wxString& text, int type);
virtual int Length() wxOVERRIDE;
virtual void Select(int n) wxOVERRIDE;
virtual int GetSelection() wxOVERRIDE;

View File

@@ -293,9 +293,6 @@ void ScintillaWX::Initialise() {
#endif // __WXMAC__
ListBoxImpl* autoCompleteLB = static_cast<ListBoxImpl*>( ac.lb );
// Let the Scintilla autocomplete engine determine the max size for the listbox
autoCompleteLB->SetMaxListBoxWidth( 0 );
autoCompleteLB->SetListInfo( &listType, &(ac.posStart), &(ac.startLen) );
}