mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 00:41:58 +08:00
Fix for SPE-1991 : New ComboBox: InsertItem issue (item was added twice)
This commit is contained in:
parent
7f1db8aa48
commit
0df5faff34
@ -88,7 +88,7 @@ static choice_ctrl* create_word_local_combo(wxWindow *parent)
|
||||
temp->SetTextCtrlStyle(wxTE_READONLY);
|
||||
temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
|
||||
#else
|
||||
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY/* | wxBORDER_SIMPLE*/);
|
||||
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY | DD_NO_CHECK_ICON);
|
||||
#endif //__WXOSX__
|
||||
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
|
@ -186,14 +186,9 @@ int ComboBox::Insert(const wxString& item,
|
||||
int ComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void* clientData)
|
||||
{
|
||||
const int n = wxItemContainer::Insert(item, pos);
|
||||
if (n != wxNOT_FOUND) {
|
||||
texts.insert(texts.begin() + n, item);
|
||||
icons.insert(icons.begin() + n, bitmap);
|
||||
datas.insert(datas.begin() + n, clientData);
|
||||
types.insert(types.begin() + n, wxClientData_None);
|
||||
drop.Invalidate();
|
||||
}
|
||||
const int n = wxItemContainer::Insert(item, pos, clientData);
|
||||
if (n != wxNOT_FOUND)
|
||||
icons[n] = bitmap;
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -213,7 +208,9 @@ void ComboBox::DoDeleteOneItem(unsigned int pos)
|
||||
icons.erase(icons.begin() + pos);
|
||||
datas.erase(datas.begin() + pos);
|
||||
types.erase(types.begin() + pos);
|
||||
const int selection = drop.GetSelection();
|
||||
drop.Invalidate(true);
|
||||
drop.SetSelection(selection);
|
||||
}
|
||||
|
||||
unsigned int ComboBox::GetCount() const { return texts.size(); }
|
||||
@ -249,7 +246,9 @@ int ComboBox::DoInsertItems(const wxArrayStringsAdapter &items,
|
||||
types.insert(types.begin() + pos, type);
|
||||
++pos;
|
||||
}
|
||||
const int selection = drop.GetSelection();
|
||||
drop.Invalidate(true);
|
||||
drop.SetSelection(selection);
|
||||
return int(pos) - 1;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
DropDown & GetDropDown() { return drop; }
|
||||
|
||||
virtual bool SetFont(wxFont const & font) override;
|
||||
bool SetFont(wxFont const & font) override;
|
||||
|
||||
bool SetBackgroundColour(const wxColour& colour) override;
|
||||
bool SetForegroundColour(const wxColour& colour) override;
|
||||
@ -38,7 +38,6 @@ public:
|
||||
void SetBorderColor(StateColor const& color);
|
||||
|
||||
int Append(const wxString &item, const wxBitmapBundle &bitmap = wxNullBitmap);
|
||||
|
||||
int Append(const wxString &item, const wxBitmapBundle &bitmap, void *clientData);
|
||||
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
||||
@ -72,7 +71,7 @@ protected:
|
||||
unsigned int pos,
|
||||
void ** clientData,
|
||||
wxClientDataType type) override;
|
||||
virtual void DoClear() override;
|
||||
void DoClear() override;
|
||||
|
||||
void DoDeleteOneItem(unsigned int pos) override;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user