- // see trac #11128 for a thorough discussion
- if ( (style & wxBORDER_MASK) == wxBORDER_RAISED )
- [v setBezelStyle:NSRegularSquareBezelStyle];
- else if ( (style & wxBORDER_MASK) == wxBORDER_SUNKEN )
- [v setBezelStyle:NSSmallSquareBezelStyle];
- else
- [v setBezelStyle:NSShadowlessSquareBezelStyle];
+ // We can't use rounded bezel styles neither for multiline buttons nor
+ // for buttons containing (big) icons as they are only meant to be used
+ // at certain sizes, so the style used depends on whether the label is
+ // single or multi line.
+ const bool
+ isSimpleText = (label.find_first_of("\n\r") == wxString::npos)
+ && (!bitmap.IsOk() || bitmap.GetHeight() < 20);
+
+ NSBezelStyle bezel;
+ switch ( style & wxBORDER_MASK )
+ {
+ case wxBORDER_NONE:
+ bezel = NSShadowlessSquareBezelStyle;
+ [v setBordered:NO];
+ break;
+
+ case wxBORDER_SIMPLE:
+ bezel = NSShadowlessSquareBezelStyle;
+ break;
+
+ case wxBORDER_SUNKEN:
+ bezel = isSimpleText ? NSTexturedRoundedBezelStyle
+ : NSSmallSquareBezelStyle;
+ break;
+
+ default:
+ wxFAIL_MSG( "Unknown border style" );
+ // fall through
+
+ case 0:
+ case wxBORDER_STATIC:
+ case wxBORDER_RAISED:
+ case wxBORDER_THEME:
+ bezel = isSimpleText ? NSRoundedBezelStyle
+ : NSRegularSquareBezelStyle;
+ break;
+ }
+
+ [v setBezelStyle:bezel];