forked from overtake/telegram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTGSNoAuthModalView.m
72 lines (47 loc) · 2.12 KB
/
TGSNoAuthModalView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// TGSNoAuthModalView.m
// Telegram
//
// Created by keepcoder on 19.05.15.
// Copyright (c) 2015 keepcoder. All rights reserved.
//
#import "TGSNoAuthModalView.h"
#import "BTRButton.h"
#import "ShareViewController.h"
@interface TGSNoAuthModalView ()
@property (nonatomic,strong) BTRButton *cancelButton;
@end
@implementation TGSNoAuthModalView
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
-(instancetype)initWithFrame:(NSRect)frameRect {
if(self = [super initWithFrame:frameRect]) {
self.backgroundColor = [NSColor whiteColor];
NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, NSWidth(frameRect), 40)];
[textField setStringValue:NSLocalizedString(@"NoAuthDescription", nil)];
[textField setFont:TGSystemFont(14)];
[textField setBackgroundColor:GRAY_TEXT_COLOR];
[textField setDrawsBackground:NO];
[textField setAlignment:NSCenterTextAlignment];
[textField setDrawsBackground:NO];
[textField setSelectable:NO];
[textField setBordered:NO];
[textField setCenterByView:self];
[self addSubview:textField];
_cancelButton = [[BTRButton alloc] initWithFrame:NSMakeRect(0, 0, NSWidth(self.frame), 50)];
_cancelButton.layer.backgroundColor = [NSColor whiteColor].CGColor;
[_cancelButton setTitleColor:LINK_COLOR forControlState:BTRControlStateNormal];
[_cancelButton setTitle:NSLocalizedString(@"Cancel", nil) forControlState:BTRControlStateNormal];
[_cancelButton addBlock:^(BTRControlEvents events) {
[ShareViewController close];
} forControlEvents:BTRControlEventClick];
TMView *topSeparator = [[TMView alloc] initWithFrame:NSMakeRect(0, 49, NSWidth(self.frame), DIALOG_BORDER_WIDTH)];
topSeparator.backgroundColor = DIALOG_BORDER_COLOR;
[self addSubview:_cancelButton];
[self addSubview:topSeparator];
}
return self;
}
@end