button alignment

This commit is contained in:
yw4z
2026-07-21 23:57:32 +03:00
parent e9d7f5ed48
commit 3fc7461071

View File

@@ -299,7 +299,7 @@ void Button::render(wxDC& dc)
else else
icon = inactive_icon; icon = inactive_icon;
wxSize padding = this->paddingSize; wxSize padding = this->paddingSize;
int spacing = 5; int spacing = GetLabel().IsEmpty() ? 0 : 5; // ORCA dont add spacing when no text in use. fixes alignment
// Wrap text // Wrap text
auto text = GetLabel(); auto text = GetLabel();
if (vertical && textSize.x + padding.x * 2 > size.x) { if (vertical && textSize.x + padding.x * 2 > size.x) {
@@ -379,14 +379,15 @@ void Button::messureSize()
{ {
wxClientDC dc(this); wxClientDC dc(this);
dc.GetTextExtent(GetLabel(), &textSize.width, &textSize.height, &textSize.x, &textSize.y); dc.GetTextExtent(GetLabel(), &textSize.width, &textSize.height, &textSize.x, &textSize.y);
int spacing = GetLabel().IsEmpty() ? 0 : 5; // ORCA dont add spacing when no text in use. fixes alignment
wxSize szContent = textSize.GetSize(); wxSize szContent = textSize.GetSize();
if (this->active_icon.bmp().IsOk()) { if (this->active_icon.bmp().IsOk()) {
if (szContent.y > 0) { if (szContent.y > 0) {
//BBS norrow size between text and icon //BBS norrow size between text and icon
if (vertical) if (vertical)
szContent.y += 5; szContent.y += spacing; // ORCA use spacing instead static value
else else
szContent.x += 5; szContent.x += spacing; // ORCA use spacing instead static value
} }
wxSize szIcon = this->active_icon.GetBmpSize(); wxSize szIcon = this->active_icon.GetBmpSize();
if (vertical) { if (vertical) {