mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-22 19:50:44 +00:00
ENH:add "text to image" function in TextInput
jira: none Change-Id: Ibdb57b74511432e81faa0c556bb6e639d5a174f5 (cherry picked from commit 09323aeed34f29f105b95d3d6a2c7a151e17e42a)
This commit is contained in:
@@ -121,8 +121,18 @@ void ComboBox::SetLabel(const wxString &value)
|
||||
{
|
||||
if (GetTextCtrl()->IsShown() || text_off)
|
||||
GetTextCtrl()->SetValue(value);
|
||||
else
|
||||
TextInput::SetLabel(value);
|
||||
else {
|
||||
if (is_replace_text_to_image) {
|
||||
auto new_value = value;
|
||||
new_value.Replace(replace_text, "", false);//replace first text
|
||||
TextInput::SetIcon_1(image_for_text);
|
||||
TextInput::SetLabel(new_value);
|
||||
}
|
||||
else {
|
||||
TextInput::SetIcon_1("");
|
||||
TextInput::SetLabel(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString ComboBox::GetLabel() const
|
||||
@@ -201,6 +211,13 @@ void ComboBox::DoDeleteOneItem(unsigned int pos)
|
||||
|
||||
unsigned int ComboBox::GetCount() const { return items.size(); }
|
||||
|
||||
void ComboBox::set_replace_text(wxString text, wxString image_name)
|
||||
{
|
||||
replace_text = text;
|
||||
image_for_text = image_name;
|
||||
is_replace_text_to_image = true;
|
||||
}
|
||||
|
||||
wxString ComboBox::GetString(unsigned int n) const
|
||||
{ return n < items.size() ? items[n].text : wxString{}; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user