Re: NSComboBoxCell subclass pointers?

2016-11-22 Thread Robert Monaghan
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  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 (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/bob%40gluetools.com
> 
> This email sent to b...@gluetools.com


___

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

Re: NSComboBoxCell subclass pointers?

2016-11-21 Thread James Walker

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 (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

NSComboBoxCell subclass pointers?

2016-11-20 Thread Robert Monaghan
Hi Everyone!

This one has me stumped..

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..)

Thanks in advance!

bob..



___

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