Getting dimensions of an NSImageView's frame style?
Getting dimensions of an NSImageView's frame style?
- Subject: Getting dimensions of an NSImageView's frame style?
- From: Ken Tabb <email@hidden>
- Date: Wed, 27 Mar 2002 16:50:42 +0000
Hi,
I've got an app which needs to open images at 100% (assuming they're not
too big) inside an NSImageView, but I'd also like the NSImageView to
have one of the available frame styles:
(Taken from the NSImageView Obj-C docs):
NSImageFrameNone-an invisible frame
NSImageFramePhoto-a thin black outline and a dropped shadow
NSImageFrameGrayBezel-a gray, concave bezel that makes the image look
sunken
NSImageFrameGroove-a thin groove that looks etched around the image
NSImageFrameButton-a convex bezel that makes the image stand out in
relief, like a button
So what I do is:
[1] Open the image file
[2] Resize NSImageView to be correct size in window (i.e. 100% of image
size)
[3] Add border to the NSImageView (using setImageFrameStyle)
When I add a border to the NSImageView, however, the thickness of the
frame etching (which varies depending on which of the above you're
using) eats into the 100%, resulting in a 99-ish% image inside a
bordered NSImageView.
Is there any way of determining the thickness of the border etching (in
pixels) so that I can factor that in when I resize the NSImageView (i.e.
make the new width = 100% of image size + (2 * etchWidth), and the same
for height? Possibly dropshadows might make the 2 sides of the border
unequal (left vs. right or top vs. bottom)). I've looked in the
NSImageView docs and can find nothing telling me how to programatically
determine the thickness of the border, and I don't want to hardwire it
in the app in case Apple one day refines the Aqua UI by, for instance,
making the NSImageFrameButton border a little thicker etc.
Thanks in advance for any light (or methods) you can shed,
Ken
- - - - - - - - - -
Ken Tabb
Mac & UNIX Technical bloke (C, C++, Obj-C, Java) - Health & Human
Sciences
Machine Vision & Neural Network researcher - Computer Science Dept
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.