roll-over on NSAttributedString within an NSOutlineView.
roll-over on NSAttributedString within an NSOutlineView.
- Subject: roll-over on NSAttributedString within an NSOutlineView.
- From: John Clayton <email@hidden>
- Date: Thu, 2 Feb 2006 00:25:04 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all...
I would love to have a roll-over style in an NSOutlineView, but I'm
not entirely sure where to begin to achieve this. This is for my
Symbol Explorer project (welcome to browse / download at http://
symbolexplorer.tryrabbit.com), which essentially shows a list of the
objective-c classes available at runtime.
In the NSOutlineView, each row represents a class or method within
that class. For a row that represents a class, I list also the super-
classes - and it's these super-classes which I want to have rollovers
for. I want to be able to click on the super class name and jump to
that super-class definition in the NSOutlineView.
I reckon this job consists of the following:
1 - specifying the 'rollover' areas
2 - reacting to a rollover by displaying the ubiquitous 'blue
underline' within the link when the mouse moves over the super-class
name
3 - determining the row under the mouse when a down-click is received
4 - re-position the nsoutlineview selection to be that of the super-
class
I think I have a handle on 3 & 4 - it's 1 & 2 that have me stumped.
I tried specifying the mouse cursor property as an NSAttributedString
property - along with the underline property - but the mouse-cursor-
style gets ignored, my current code looks like this:
while( (superClassName = [scnEnum nextObject]) != nil )
{
NSDictionary *attribs =
[NSDictionary dictionaryWithObjectsAndKeys:
[NSColor blueColor], NSUnderlineColorAttributeName,
[NSNumber numberWithInt:NSSingleUnderlineStyle],
NSUnderlineStyleAttributeName,
[NSCursor openHandCursor], NSCursorAttributeName,
nil, nil];
NSAttributedString *superClassNameAsAS =
[[NSAttributedString alloc] initWithString:superClassName
attributes:attribs];
[as appendAttributedString:OVAdapter_Everything_ColonSep];
[as appendAttributedString:superClassNameAsAS];
[superClassNameAsAS autorelease];
}
again, the NSCursor / NSCursorAttributeName setting seems to be
ignored, but the underlining works.
The NSOutlineView lives in a scroll-pane, and I wonder if I should
simply be listening for mouse-move events and then finding the
current word under the mouse-cursor and simply changing it's
NSAttributedString properties on the fly... but is there an easier way?
If anyone has an idea of how I can get 'rollover style' underlines to
work in an NSOutlineView - or can point me in the direction of some
sample code, that'd be fantastic.
Thanks - happy coding.
John Clayton
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFD4UNQp5OOqU+VYFgRAof4AJ9/y1tggzP0rKLF2RB+ZlHEY3gc7QCdGGrK
KIaT0N+25xj4uhlUXbaOKxI=
=gQo2
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden