1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-12 09:29:55 +01:00
Telegram/Watch/Extension/TGNeoViewModel.m

62 lines
1.1 KiB
Mathematica
Raw Normal View History

2015-10-01 18:19:52 +02:00
#import "TGNeoViewModel.h"
@interface TGNeoViewModel ()
{
NSMutableArray *_submodels;
}
@end
@implementation TGNeoViewModel
- (instancetype)init
{
self = [super init];
if (self != nil)
{
_submodels = [[NSMutableArray alloc] init];
}
return self;
}
- (CGRect)bounds
{
return CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
}
- (NSArray *)submodels
{
return _submodels;
}
- (void)addSubmodel:(TGNeoViewModel *)viewModel
{
[_submodels addObject:viewModel];
}
- (void)removeSubmodel:(TGNeoViewModel *)viewModel
{
[_submodels removeObject:viewModel];
}
- (void)drawInContext:(CGContextRef)context
{
[self drawSubmodelsInContext:context];
}
- (void)drawSubmodelsInContext:(CGContextRef)context
{
for (TGNeoViewModel *submodel in self.submodels)
{
CGContextTranslateCTM(context, submodel.frame.origin.x, submodel.frame.origin.y);
[submodel drawInContext:context];
CGContextTranslateCTM(context, -submodel.frame.origin.x, -submodel.frame.origin.y);
}
}
- (CGSize)contentSizeWithContainerSize:(CGSize)containerSize
{
return CGSizeZero;
}
@end