Re: NSComboBoxCell subclass pointers?
Re: NSComboBoxCell subclass pointers?
- Subject: Re: NSComboBoxCell subclass pointers?
- From: Robert Monaghan <email@hidden>
- Date: Tue, 22 Nov 2016 08:07:39 -0800
- Dkim-filter: OpenDKIM Filter v2.9.2 mail.gluetools.com 5C7846260D69
Hi James,
Very clever way of getting the boundaries of each cell!
I was wondering if this was possible. I’ll take a shot at this and how far I get.
Thanks!
bob.
> On Nov 21, 2016, at 5:46 PM, James Walker <email@hidden> wrote:
>
> On 11/20/2016 8:15 PM, Robert Monaghan wrote:
>> I have been working on a custom UI for my Cocoa application. By looking around the internet, I have managed to learn how to subclass a large number of UI objects on MacOSX. In many cases I could make the appearance work the way I want.
>>
>> The last UI element that I am working on, is NSComboBoxCell. It appears to be a NSTextFieldCell with an NSButtonCell attached. It seems fairly easy to override
>> “drawWithFrame:inView" and draw a replacement artwork. But there are a bunch of unknowns/pitfalls..
>>
>> The part that I suspect that I have to subclass is the NSButtonCell that I believe is drawing the "Arrow Button”.
>> But how is this done, along side the NSTextField that makes up the NSComboBoxCell class? When I look at the NSComboBoxCell header files, I don’t see any obvious clues to figure out the geometry of the NSButtonCell, that is apparently being used alongside the NSTextField, itself.
>>
>> Are there any ways to get to the NSButtonCell stored inside the NSComboBoxCell Object? (Ideally so that I can override and install my own NSButtonCell..)
>
> In my NSComboBoxCell subclass, I figured out where the "button" part ought to be as follows:
>
> NSRect drawingRect = [self drawingRectForBounds: cellFrame];
> NSRect titleBounds = [self titleRectForBounds: drawingRect];
> NSRect buttonBounds = NSMakeRect( NSMaxX( titleBounds ),
> NSMinY(drawingRect),
> NSMaxX(drawingRect) - NSMaxX( titleBounds ),
> NSHeight(drawingRect) );
>
> And then I drew my own button content.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden