// // KMActivityALertViewController.m // PDF Reader Pro Edition // // Created by Niehaoyu on 2023/4/4. // #import "KMActivityALertViewController.h" #import @interface KMActivityALertViewController () @property (nonatomic,assign) IBOutlet NSTextField *label; @property (nonatomic,assign) IBOutlet NSTextField *sublabel; @property (nonatomic,assign) IBOutlet KMCustomButton *continueButton; @property (nonatomic, retain) CALayer *continueButtonLayer; @end @implementation KMActivityALertViewController #pragma mark Init Methods - (instancetype)init { if (self = [super initWithNibName:@"KMActivityALertViewController" 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.continueButton.wantsLayer = YES; self.continueButton.layer.masksToBounds = YES; self.continueButton.layer.cornerRadius = 1.0; self.label.stringValue = self.alertTitle ? : @""; self.sublabel.stringValue = self.alertMessage ? : @""; self.continueButton.title = NSLocalizedString(@"Continue", nil); [self.continueButton setTitleColor:[NSColor whiteColor]]; 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 KMActivityALertViewController *blockSelf = self; self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) { if (mouseEntered) blockSelf.continueButtonLayer.hidden = NO; else blockSelf.continueButtonLayer.hidden = YES; }; [self.label setTextColor:[KMAppearance KMColor_Layout_H0]]; [self.sublabel setTextColor:[KMAppearance KM_242424_Color75]]; } #pragma mark - IBAction - (IBAction)continueButtonAction:(id)sender { if (self.callback) { self.callback(); } } @end