Changeset 1327
- Timestamp:
- 05/23/04 16:13:44 (5 years ago)
- Files:
-
- WiredClient/trunk/NSTextFieldAdditions.m (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/NSTextFieldAdditions.m
r1320 r1327 1 /* $Id: NSTextFieldAdditions.m,v 1. 6 2004/05/23 13:33:29morris Exp $ */1 /* $Id: NSTextFieldAdditions.m,v 1.7 2004/05/23 14:13:44 morris Exp $ */ 2 2 3 3 /* … … 35 35 NSRect rect, controlRect; 36 36 NSSize size; 37 int width, height, factor ;37 int width, height, factor = 1; 38 38 39 39 // --- default offset … … 41 41 *offset = 18; 42 42 43 // --- set frame of self43 // --- get string bounding box 44 44 rect = [self frame]; 45 45 size = [[self font] sizeOfString:[self stringValue]]; 46 width = (int) (size.width / rect.size.width) + 1;47 height = (int) (size.height / rect.size.height) + 1;48 factor = width > height ? width : height;49 46 47 // --- has to exceed current size by at least 50% if we are to make a new line 48 if(size.width >= 1.5 * rect.size.width || 49 size.height >= 1.5 * rect.size.height) { 50 width = (int) (size.width / rect.size.width) + 1; 51 height = (int) (size.height / rect.size.height) + 1; 52 factor = width > height ? width : height; 53 } 54 55 // --- set frame of self 50 56 rect.origin.y = *offset + 2; 51 57 rect.size.height *= factor;
