author | Jens Alfke <jens@mooseyard.com> |
Thu Jul 17 13:29:04 2008 -0700 (2008-07-17) | |
changeset 19 | 3b750982ff39 |
parent 4 | d781b00f3ed4 |
permissions | -rw-r--r-- |
jens@1 | 1 |
// |
jens@1 | 2 |
// GGBTextLayer.h |
jens@1 | 3 |
// GGB-iPhone |
jens@1 | 4 |
// |
jens@1 | 5 |
// Created by Jens Alfke on 3/10/08. |
jens@1 | 6 |
// Copyright 2008 __MyCompanyName__. All rights reserved. |
jens@1 | 7 |
// |
jens@1 | 8 |
|
jens@1 | 9 |
#import "GGBLayer.h" |
jens@1 | 10 |
|
jens@1 | 11 |
|
jens@8 | 12 |
#if TARGET_OS_IPHONE |
jens@1 | 13 |
@interface GGBTextLayer : GGBLayer |
jens@1 | 14 |
{ |
jens@1 | 15 |
NSString *_string; |
jens@4 | 16 |
UIFont *_font; |
jens@1 | 17 |
CGColorRef _foregroundColor; |
jens@1 | 18 |
NSString *_alignmentMode; |
jens@1 | 19 |
} |
jens@1 | 20 |
|
jens@1 | 21 |
@property(copy) id string; |
jens@4 | 22 |
@property (retain) UIFont *font; |
jens@1 | 23 |
@property CGColorRef foregroundColor; |
jens@1 | 24 |
@property (copy) NSString *alignmentMode; |
jens@1 | 25 |
|
jens@1 | 26 |
#else |
jens@1 | 27 |
@interface GGBTextLayer : CATextLayer |
jens@1 | 28 |
#endif |
jens@1 | 29 |
|
jens@1 | 30 |
+ (GGBTextLayer*) textLayerInSuperlayer: (CALayer*)superlayer |
jens@1 | 31 |
withText: (NSString*)text |
jens@1 | 32 |
fontSize: (float) fontSize |
jens@1 | 33 |
alignment: (enum CAAutoresizingMask) align; |
jens@4 | 34 |
+ (GGBTextLayer*) textLayerInSuperlayer: (CALayer*)superlayer |
jens@4 | 35 |
withText: (NSString*)text |
jens@4 | 36 |
font: (id)inputFont |
jens@4 | 37 |
alignment: (enum CAAutoresizingMask) align; |
jens@1 | 38 |
|
jens@1 | 39 |
@end |
jens@1 | 40 |
|
jens@1 | 41 |
|
jens@8 | 42 |
#if TARGET_OS_IPHONE |
jens@4 | 43 |
/* Bit definitions for `autoresizingMask' property. */ |
jens@4 | 44 |
|
jens@4 | 45 |
enum CAAutoresizingMask |
jens@4 | 46 |
{ |
jens@4 | 47 |
kCALayerNotSizable = 0, |
jens@4 | 48 |
kCALayerMinXMargin = 1U << 0, |
jens@4 | 49 |
kCALayerWidthSizable = 1U << 1, |
jens@4 | 50 |
kCALayerMaxXMargin = 1U << 2, |
jens@4 | 51 |
kCALayerMinYMargin = 1U << 3, |
jens@4 | 52 |
kCALayerHeightSizable = 1U << 4, |
jens@4 | 53 |
kCALayerMaxYMargin = 1U << 5 |
jens@4 | 54 |
}; |
jens@4 | 55 |
|
jens@4 | 56 |
enum |
jens@4 | 57 |
{ |
jens@4 | 58 |
kCALayerBottomMargin = kCALayerMaxYMargin, |
jens@4 | 59 |
kCALayerTopMargin = kCALayerMinYMargin |
jens@4 | 60 |
}; |
jens@4 | 61 |
|
jens@4 | 62 |
#else |
jens@4 | 63 |
enum |
jens@4 | 64 |
{ |
jens@4 | 65 |
kCALayerBottomMargin = kCALayerMinYMargin, |
jens@4 | 66 |
kCALayerTopMargin = kCALayerMaxYMargin |
jens@4 | 67 |
}; |
jens@4 | 68 |
#endif |