diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-03-09 20:36:55 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-03-09 20:36:55 +0000 |
commit | f736aed5642b3c7f19533653e1ddfd4599f1ee7d (patch) | |
tree | 22b044ba2b807e5903853958c2bb9d6de9561751 /AppKit/GTMUILocalizerAndLayoutTweaker.h | |
parent | 0f6b25f7efe11c2a4102b2d74c5f57ddfab341c1 (diff) |
[Author: thomasvl]
Add an api for forcing a NSTextField to a fixed height but what ever width is needed.
R=dmaclach
DELTA=634 (631 added, 0 deleted, 3 changed)
Diffstat (limited to 'AppKit/GTMUILocalizerAndLayoutTweaker.h')
-rw-r--r-- | AppKit/GTMUILocalizerAndLayoutTweaker.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.h b/AppKit/GTMUILocalizerAndLayoutTweaker.h index edbfc25..4a9b666 100644 --- a/AppKit/GTMUILocalizerAndLayoutTweaker.h +++ b/AppKit/GTMUILocalizerAndLayoutTweaker.h @@ -56,11 +56,21 @@ // Returns the amount the field changed height. + (CGFloat)sizeToFitFixedWidthTextField:(NSTextField *)textField; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 +// If you call sizeToFit on a NSTextField it will try not to word wrap, so it +// can get really wide. This method will keep the height fixed, but figure out +// how wide the textfield needs to be to fit its text. +// Returns the amount the field changed width. ++ (CGFloat)sizeToFitFixedHeightTextField:(NSTextField *)textField; ++ (CGFloat)sizeToFitFixedHeightTextField:(NSTextField *)textField + minWidth:(NSUInteger)minWidth; +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + // Insert newlines into the title of the button (radio or checkbox) or all cells // in the radio group (NSMatrix) so they will word wrap to the item's current -// width. Then +sizeToFitView can be called to have then resize to the exact -// width and height needed. Note: any existing Opt-Return forced wraps are -// removed from the existing titles. +// width. Then +sizeToFitView can be called to then resize to the exact width +// and height needed. Note: any existing Opt-Return forced wraps are removed +// from the existing titles. + (void)wrapButtonTitleForWidth:(NSButton *)button; + (void)wrapRadioGroupForWidth:(NSMatrix *)radioGroup; |