Update TextInput to use bitmap bundles

This commit is contained in:
Ocraftyone 2023-11-08 11:42:31 -05:00
parent 7cfa854981
commit 510a4a02ab
No known key found for this signature in database
GPG key ID: 85836ED21AD4D125
3 changed files with 7 additions and 7 deletions

View file

@ -85,7 +85,7 @@ void ComboBox::SetSelection(int n)
drop.SetSelection(n);
SetLabel(drop.GetValue());
if (drop.selection >= 0 && drop.iconSize.y > 0)
SetIcon(icons[drop.selection].GetBitmapFor(m_parent));//OcraftyoneTODO: dirty conversion
SetIcon(icons[drop.selection]);
}
void ComboBox::SelectAndNotify(int n) {
SetSelection(n);
@ -108,7 +108,7 @@ void ComboBox::SetValue(const wxString &value)
drop.SetValue(value);
SetLabel(value);
if (drop.selection >= 0 && drop.iconSize.y > 0)
SetIcon(icons[drop.selection].GetBitmapFor(m_parent));//OcraftyoneTODO: dirty conversion
SetIcon(icons[drop.selection]);
}
void ComboBox::SetLabel(const wxString &value)

View file

@ -94,10 +94,10 @@ void TextInput::SetLabel(const wxString& label)
Refresh();
}
void TextInput::SetIcon(const wxBitmap &icon)
void TextInput::SetIcon(const wxBitmapBundle &icon_in)
{
this->icon = ScalableBitmap();
this->icon.bmp() = icon;
this->icon.bmp() = icon_in;
Rescale();
}
@ -153,7 +153,7 @@ void TextInput::DoSetSize(int x, int y, int width, int height, int sizeFlags)
wxSize size = GetSize();
wxPoint textPos = {5, 0};
if (this->icon.bmp().IsOk()) {
wxSize szIcon = this->icon.GetBmpSize();
wxSize szIcon = this->icon.GetSize();
textPos.x += szIcon.x;
}
bool align_right = GetWindowStyle() & wxRIGHT;
@ -194,7 +194,7 @@ void TextInput::render(wxDC& dc)
// start draw
wxPoint pt = {5, 0};
if (icon.bmp().IsOk()) {
wxSize szIcon = icon.GetBmpSize();
wxSize szIcon = icon.GetSize();
pt.y = (size.y - szIcon.y) / 2;
dc.DrawBitmap(icon.get_bitmap(), pt);
pt.x += szIcon.x + 0;

View file

@ -40,7 +40,7 @@ public:
void SetLabel(const wxString& label);
void SetIcon(const wxBitmap & icon);
void SetIcon(const wxBitmapBundle & icon);
void SetLabelColor(StateColor const &color);