-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix wxButton::SetBitmap() to keep correct button style in OS X #26025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
RobertRoeb
commented
Dec 10, 2025
- Before, when setting a new bitmap (e.g. from Play bitmap to Pause bitmap) the button would be recreated in pure text button style, much too narrow.
- Then secondly, when taking into account the bitmap, it switch from slightly rounded to unrounded corners. I assume that the initial look with slightly rounded corners was intented (and intended to be kept) and now it is preserved after setting a new bitmap
- Before, when setting a new bitmap (e.g. from Play bitmap
to Pause bitmap) the button would be recreated in pure
text button style, much too narrow.
- Then secondly, when taking into account the bitmap, it
switch from slightly rounded to unrounded corners. I assume
that the initial look with slightly rounded corners was
intented (and intended to be kept) and now it is preserved
after setting a new bitmap
vadz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't test this but from reading the code it looks like it should do the right thing. @csomor Do you have any objections to merging this?
src/osx/cocoa/button.mm
Outdated
| { | ||
| if ([GetNSButton() bezelStyle] == NSRoundedBezelStyle) | ||
| [GetNSButton() setBezelStyle:NSRegularSquareBezelStyle]; | ||
| [GetNSButton() setBezelStyle:NSRegularSquareBezelStyle]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we perhaps use SetBezelStyleFromBorderFlags() here too to ensure that the bezel is always set consistently?
|
@RobertRoeb Thanks! I haven't fully understood the sequence yet, where would it be recreated with pure text, I thought that SetBitmap() would call the implementation's SetBitmap without first re-creating something. But since it happens to you, then I understand that unconditionally changing the style make sense. But I'd also prefer to call the common According to the docs |
|
Yes, that works as well. While testing that, I noticed that when changing the button from "play" to "pause", since "play" is shorter, "pause" gets wrapped. So can we invalidate the size calculation somehow? |