More Auto Layout test work.
This commit is contained in:
parent
046a7303c4
commit
32905f5989
|
@ -0,0 +1,37 @@
|
||||||
|
// 31 july 2015
|
||||||
|
#import "osxaltest.h"
|
||||||
|
|
||||||
|
@interface tButton : NSObject<tControl> {
|
||||||
|
NSButton *b;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation tButton
|
||||||
|
|
||||||
|
- (id)initWithText:(NSString *)text
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self) {
|
||||||
|
self->b = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||||
|
[self->b setTitle:text];
|
||||||
|
[self->b setButtonType:NSMomentaryPushInButton];
|
||||||
|
[self->b setBordered:YES];
|
||||||
|
[self->b setBezelStyle:NSRoundedBezelStyle];
|
||||||
|
[self->b setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tAddToView:(NSView *)v
|
||||||
|
{
|
||||||
|
[v addSubview:self->b];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n
|
||||||
|
{
|
||||||
|
[views setObject:self->b forKey:tAutoLayoutKey(n)];
|
||||||
|
n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -1,2 +1,11 @@
|
||||||
// 31 july 2015
|
// 31 july 2015
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <stdint.h>
|
||||||
|
|
||||||
|
@protocol tControl
|
||||||
|
@required
|
||||||
|
- (void)tAddToView:(NSView *)v;
|
||||||
|
- (uintmax_t)tAddToAutoLayoutDictionary:(NSMutableDictionary *)views keyNumber:(uintmax_t)n;
|
||||||
|
@end
|
||||||
|
|
||||||
|
extern NSString *tAutoLayoutKey(uintmax_t);
|
||||||
|
|
Loading…
Reference in New Issue