Skip to content

Conversation

@RobertRoeb
Copy link

  • 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
Copy link
Contributor

@vadz vadz left a 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?

{
if ([GetNSButton() bezelStyle] == NSRoundedBezelStyle)
[GetNSButton() setBezelStyle:NSRegularSquareBezelStyle];
[GetNSButton() setBezelStyle:NSRegularSquareBezelStyle];
Copy link
Contributor

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?

@vadz vadz added the macOS Specific to Cocoa macOS port label Dec 10, 2025
@csomor
Copy link
Contributor

csomor commented Dec 11, 2025

@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 SetBezelStyleFromBorderFlags() to keep all our HIG wisdom at one place and consistent, would just calling this instead of manipulating the style directly also solve your problem ?

According to the docs NSRegularSquareBezelStyle and NSSmallSquareBezelStyle are perfect for bitmaps and other cases because they can scale to any size, while NSRoundedBezelStyle a.k.a NSBezelStylePush are for text content, so I think it's decision tree is still valid. Otherwise I'd prefer to fix it there.

@RobertRoeb
Copy link
Author

RobertRoeb commented Dec 16, 2025

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?
[Edit myself]: I realize that I was under the assumption that the control would resize itself after setting a new, longer label and DoGetBestSize() correctly reported the new size. But I actually had to call the parent window's wxSizer::Layout() for the button to change size. This, sort of, makes sense, but I anticipated an immediate change of the button size. Anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS Specific to Cocoa macOS port

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants