123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- //
- // KMVerificationAlertViewController.m
- // PDF Reader Pro Edition
- //
- // Created by 王帅 on 2018/5/8.
- //
- #import "KMVerificationAlertViewController.h"
- #import <PDF_Reader_Pro-Swift.h>
- @interface KMVerificationAlertViewController ()
- @property (nonatomic,assign) IBOutlet NSTextField *label;
- @property (nonatomic,assign) IBOutlet NSTextField *sublabel;
- @property (assign) IBOutlet NSView *desView1;
- @property (assign) IBOutlet NSTextField *desLbl1;
- @property (assign) IBOutlet NSTextField *desLbl2;
- @property (assign) IBOutlet NSTextField *desLbl3;
- @property (assign) IBOutlet NSTextField *desLbl4;
- @property (assign) IBOutlet KMButton *buyNowBackBtn;
- @property (nonatomic, assign) IBOutlet KMCustomButton *continueButton;
- @property (assign) IBOutlet KMCustomButton *buyButton;
- @property (nonatomic, retain) CALayer *continueButtonLayer;
- @end
- @implementation KMVerificationAlertViewController
- #pragma mark Init Methods
- - (instancetype)init {
- if (self = [super initWithNibName:@"KMVerificationAlertViewController" bundle:nil]) {
-
- }
- return self;
- }
- - (void)dealloc {
-
- }
- #pragma mark Setter Methods
- - (void)setAlertTitle:(NSString *)alertTitle {
- _alertTitle = alertTitle;
-
- self.label.stringValue = alertTitle ? : @"";
- }
- - (void)setAlertMessage:(NSString *)alertMessage {
-
- _alertMessage = alertMessage;
- self.sublabel.stringValue = alertMessage ? : @"";
- }
- #pragma mark View Methods
- - (void)loadView {
- [super loadView];
- // Do view setup here.
-
- self.label.font = [NSFont systemFontOfSize:13.];
- self.sublabel.font = [NSFont systemFontOfSize:18.];
- self.desLbl1.font = self.desLbl2.font = self.desLbl3.font = self.desLbl4.font = [NSFont systemFontOfSize:12.];
-
- self.label.stringValue = self.alertTitle ? : @"";
- self.sublabel.stringValue = self.alertMessage ? : @"";
-
- self.desLbl1.stringValue = NSLocalizedString(@"Convert PDF from/to Word/Excel/PPT/HTML/Image, etc.", nil);
- self.desLbl2.stringValue = NSLocalizedString(@"Edit and Modify Texts in PDFs", nil);
- self.desLbl3.stringValue = NSLocalizedString(@"Optical Character Recognition (OCR)", nil);
- self.desLbl4.stringValue = NSLocalizedString(@"Create, Fill Forms, Sign PDFs", nil);
-
- self.continueButton.title = NSLocalizedString(@"Continue", nil);
-
- self.continueButton.wantsLayer = YES;
- self.continueButton.layer.masksToBounds = YES;
- self.continueButton.layer.cornerRadius = 1.0;
-
- self.continueButtonLayer = [CALayer layer];
- [self.continueButton.layer addSublayer:self.continueButtonLayer];
- self.continueButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_continueButton.bounds), CGRectGetHeight(_continueButton.bounds));
- self.continueButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor;
- self.continueButtonLayer.cornerRadius = 0;
- self.continueButtonLayer.hidden = YES;
- __block KMVerificationAlertViewController *blockSelf = self;
- self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered)
- blockSelf.continueButtonLayer.hidden = NO;
- else
- blockSelf.continueButtonLayer.hidden = YES;
- };
-
- self.buyNowBackBtn.mouseMoveCallback = ^(BOOL mouseEntered) {
- if (mouseEntered)
- blockSelf.buyNowBackBtn.image = [NSImage imageNamed:@"KMImageNameButtonBackground220Hov"];
- else
- blockSelf.buyNowBackBtn.image = [NSImage imageNamed:@"KMImageNameButtonBackground220"];
- };
-
- self.buyButton.wantsLayer = YES;
- self.buyButton.layer.masksToBounds = YES;
- self.buyButton.layer.cornerRadius = 1.0;
-
- if (@available(macOS 10.14, *)) {
- NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
- if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
- [self.label setTextColor:[NSColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]];
- [self.sublabel setTextColor:[NSColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.7]];
-
- self.desLbl1.textColor = self.desLbl2.textColor = self.desLbl3.textColor = self.desLbl4.textColor = [NSColor colorWithRed:255/255. green:255/255. blue:255/255. alpha:1];
-
- [self.continueButton setTitleColor:[NSColor whiteColor]];
- self.continueButton.layer.backgroundColor = [NSColor colorWithRed:86/255. green:88/255. blue:90/255. alpha:1].CGColor;
-
- NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Buy Now", nil)];
- NSRange range = NSMakeRange(0, attributedTitle.length);
- [attributedTitle addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:13.] range:range];
- [attributedTitle addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithRed:78/255. green:127/255. blue:219/255. alpha:1] range:range];
- self.buyButton.attributedTitle = attributedTitle;
-
- } else {
- self.label.textColor = [NSColor colorWithRed:66/255. green:70/255. blue:77/255. alpha:1];
- self.sublabel.textColor = [NSColor colorWithRed:14/255. green:17/255. blue:20/255. alpha:1];
-
- self.desLbl1.textColor = self.desLbl2.textColor = self.desLbl3.textColor = self.desLbl4.textColor = [NSColor colorWithRed:66/255. green:70/255. blue:77/255. alpha:1];
-
- [self.continueButton setTitleColor:[NSColor colorWithRed:14/255. green:17/255. blue:20/255. alpha:1]];
- self.continueButton.layer.backgroundColor = [NSColor colorWithRed:218/255. green:219/255. blue:222/255. alpha:1].CGColor;
- [self.buyButton setTitleColor:[NSColor colorWithRed:14/255. green:17/255. blue:20/255. alpha:1]];
- NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Buy Now", nil)];
- NSRange range = NSMakeRange(0, attributedTitle.length);
- [attributedTitle addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:13.] range:range];
- [attributedTitle addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithRed:14/255. green:17/255. blue:20/255. alpha:1] range:range];
- self.buyButton.attributedTitle = attributedTitle;
- }
- }
- }
- #pragma mark Button Actions
- - (IBAction)continueButtonAction:(id)sender {
- if (self.callback) {
- self.callback();
- }
- }
- - (IBAction)buyNowAction:(id)sender {
- if (self.buyActionHandle) {
- self.buyActionHandle();
- }
- }
- @end
|