Swiftgram/submodules/LegacyComponents/LegacyComponents/TGModernGalleryEmbeddedStickersHeaderView.m
Peter d153fe0f21 Add 'submodules/LegacyComponents/' from commit 'd5594346161c1b7f203d1e87068bbe77bcaac019'
git-subtree-dir: submodules/LegacyComponents
git-subtree-mainline: 608630530451e02e5aec48389d144dbf7a3625b9
git-subtree-split: d5594346161c1b7f203d1e87068bbe77bcaac019
2019-06-11 18:51:15 +01:00

47 lines
1.4 KiB
Objective-C

#import "TGModernGalleryEmbeddedStickersHeaderView.h"
#import <LegacyComponents/LegacyComponents.h>
#import <LegacyComponents/TGModernButton.h>
@interface TGModernGalleryEmbeddedStickersHeaderView () {
TGModernButton *_stickerButton;
}
@end
@implementation TGModernGalleryEmbeddedStickersHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self != nil) {
_stickerButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 50.0f, 44.0f)];
[_stickerButton setImage:TGTintedImage([UIImage imageNamed:@"GalleryEmbeddedStickersIcon"], [UIColor whiteColor]) forState:UIControlStateNormal];
[_stickerButton addTarget:self action:@selector(stickerButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_stickerButton];
}
return self;
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if (!_stickerButton.hidden && CGRectContainsPoint(_stickerButton.frame, point))
return true;
return [super pointInside:point withEvent:event];
}
- (void)layoutSubviews {
[super layoutSubviews];
_stickerButton.frame = CGRectMake(self.frame.size.width + 26.0f, -1.0f, _stickerButton.frame.size.width, _stickerButton.frame.size.height);
}
- (void)stickerButtonPressed {
if (_showEmbeddedStickers) {
_showEmbeddedStickers();
}
}
@end