Merge from main and fix merge conflicts

This commit is contained in:
Lam Wei Lun
2026-08-19 16:16:21 +08:00
79 changed files with 2567 additions and 655 deletions
+9 -18
View File
@@ -96,21 +96,18 @@ void Button::SetIcon(const wxString& icon)
}
}
void Button::SetBitmap(const wxBitmap& bitmap)
void Button::SetIcon(const wxBitmap& icon)
{
custom_icon = bitmap;
this->active_icon = ScalableBitmap();
this->active_icon.bmp() = icon;
messureSize();
Refresh();
}
void Button::SetInactiveIcon(const wxString &icon)
void Button::SetBitmap(const wxBitmap& bitmap)
{
if (!icon.IsEmpty()) {
// BBS set button icon default size to 20
this->inactive_icon = ScalableBitmap(this, icon.ToStdString(), this->active_icon.px_cnt());
} else {
this->inactive_icon = ScalableBitmap();
}
custom_icon = bitmap;
messureSize();
Refresh();
}
@@ -265,12 +262,10 @@ void Button::SetStyle(const ButtonStyle style, const ButtonType type)
void Button::Rescale()
{
if (this->active_icon.bmp().IsOk())
// Only a named icon can be re-rasterized; one set from a wxBitmap has no source file,
if (!this->active_icon.name().empty())
this->active_icon.msw_rescale();
if (this->inactive_icon.bmp().IsOk())
this->inactive_icon.msw_rescale();
messureSize();
if(m_has_style)
@@ -301,11 +296,7 @@ void Button::render(wxDC& dc)
wxSize szIcon;
wxSize textSize = this->textSize.GetSize();
ScalableBitmap icon;
if (m_selected || ((states & (int)StateColor::State::Hovered) != 0))
icon = active_icon;
else
icon = inactive_icon;
const ScalableBitmap& icon = active_icon;
wxSize padding = this->paddingSize;
int spacing = 5;
// Wrap text