1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //
- // KMActivityALertViewController.m
- // PDF Reader Pro Edition
- //
- // Created by Niehaoyu on 2023/4/4.
- //
- #import "KMActivityALertViewController.h"
- #import <PDF_Reader_Pro-Swift.h>
- @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
|