On Mon, Oct 12, 2015 at 4:19 PM, Richard Charles <rcharles...@gmail.com> wrote:
>
>> On Oct 11, 2015, at 3:07 PM, Jacek Oleksy <jole...@opera.com> wrote:
>>
>> I am not subclassing NSToolbar, I am using NSView (and putting
>> NSButton as a subview).
>
> Why would you not use NSToolbar? I would bet that Apple “native” toolbars use 
> NSToolbar or a subclass there of.
>
NSToolbar is not a view, it is a class designed to "provide the
mechanism for a titled window to display a toolbar just below its
title bar" (from the doc). I need to display the toolbar in different
place, that is why I need to use custom NSView (please correct me if I
am wrong...).

>> Sadly, that is not true. From the documentation on 
>> NSTexturedRoundedBezelStyle:
>>
>> "A textured (metal) bezel style similar in appearance to the Finder’s
>> action (gear) button. The height of this button is fixed."
>>
>> Setting programatically the height does nothing.
>
> I have a NSTexturedRoundedBezelStyle button in a toolbar (actually as Jens 
> pointed out a NSToolbarItem that displays a button).
>
> The height of my button is 22 points. If I programmatically set the height to 
> 60 points the button’s position shifts vertically by half that amount in the 
> tool bar. You are right that the graphics or image of the button does not 
> change. When the documentation states that “the height of this button is 
> fixed” I think that really means that visually the height of the image is 
> fixed. But the frame height of the button can be use to adjust the vertical 
> position of the button with respect to it’s superview which is a 
> NSToolbarItem.

NSToolbarItem is not really a superview (it's not a view at all
AFAICT). And yes, I know the containing frame can be resized, but I
need to set the visual appearance of the button (or make it behave
like in NSToolbar).

>
> Several years ago when this was fresher in my mind I believe I was also 
> struggling with the 24pt vs 22pt height. Perhaps this is Apple’s way of 
> adjusting the vertical position of the button image within the superview.
>

Still, I have no idea why the 22 vs 24px :/

/Jacek

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to