当前位置: 首页 > news >正文

怎么换自己的网站服务器低代码网站开发平台

怎么换自己的网站服务器,低代码网站开发平台,秦皇岛网站建设多少钱,余姚建设网站的公司文章目录 关于 MASShortcut项目结构 快速使用源码学习检测是否有热键冲突处理 Event macOS 开发交流 秋秋群:644096295,V : ez-code 关于 MASShortcut MASShortcut 是一款快捷键管理工具,替代和兼容 ShortcutRecorder github : https://git…

文章目录

    • 关于 MASShortcut
      • 项目结构
    • 快速使用
    • 源码学习
      • 检测是否有热键冲突
      • 处理 Event


macOS 开发交流 秋秋群:644096295,V : ez-code


关于 MASShortcut

MASShortcut 是一款快捷键管理工具,替代和兼容 ShortcutRecorder

  • github : https://github.com/cocoabits/MASShortcut

在这里插入图片描述


项目结构

  • model
    • MASKeyCodes : 功能键和快捷键 枚举
    • MASShortcut : 管理 key 的组合(不管是否可用)
    • MASShortcutValidator 验证shortcut 是否可用
  • Monitoring
    • MASHotKey : 初始化和注册 MASShortcut
    • MASShortcutMonitor : 注册/解除/检测 MASShortcut,监控更新
  • User Defaults Storage
    • MASDictionaryTransformer : 转换 shortcut 数据格式,以便于存储
    • MASShortcutBinder : 绑定用户操作和 shortcut
  • UI
    • MASLocalization : 替代 NSLocalizedString,以便退出 app 时,能从 framework 种读取字符串。
    • MASShortcutView : Shortcut 视图图
    • MASShortcutViewButtonCell : MASShortcutView 内部的 cell 样式,可调整和重绘
    • MASShortcutView+Bindings : 设置关联的默认键

快速使用

单独使用一个 MASShortcutView
你可以修改 它的属性,来改变显示的样式

MASShortcutView *shortCutView = [[MASShortcutView alloc] initWithFrame:NSMakeRect(10, 10, 200, 50)];[self.window.contentView addSubview:shortCutView];shortCutView.wantsLayer = YES;shortCutView.layer.backgroundColor = [NSColor blueColor].CGColor;

源码学习

检测是否有热键冲突

MASShortcutValidator.m

- (BOOL) isShortcutAlreadyTakenBySystem:(MASShortcut *)shortcut explanation: (NSString**) explanation
{CFArrayRef globalHotKeys;if (CopySymbolicHotKeys(&globalHotKeys) == noErr) {// Enumerate all global hotkeys and check if any of them matches current shortcutfor (CFIndex i = 0, count = CFArrayGetCount(globalHotKeys); i < count; i++) {CFDictionaryRef hotKeyInfo = CFArrayGetValueAtIndex(globalHotKeys, i);CFNumberRef code = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode);CFNumberRef flags = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers);CFNumberRef enabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled);if (([(__bridge NSNumber *)code integerValue] == [shortcut keyCode]) &&([(__bridge NSNumber *)flags unsignedIntegerValue] == [shortcut carbonFlags]) &&([(__bridge NSNumber *)enabled boolValue])) {if (explanation) {*explanation = MASLocalizedString(@"This combination cannot be used because it is already used by a system-wide "@"keyboard shortcut.\nIf you really want to use this key combination, most shortcuts "@"can be changed in the Keyboard & Mouse panel in System Preferences.",@"Message for alert when shortcut is already used by the system");}return YES;}}CFRelease(globalHotKeys);}return [self isShortcut:shortcut alreadyTakenInMenu:[NSApp mainMenu] explanation:explanation];
}
  • CopySymbolicHotKeys 来自 Carbon – HiToolbox – CarbonEvents.h

处理 Event

- (void) handleEvent: (EventRef) event
{if (GetEventClass(event) != kEventClassKeyboard) {return;}EventHotKeyID hotKeyID;OSStatus status = GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotKeyID), NULL, &hotKeyID);if (status != noErr || hotKeyID.signature != MASHotKeySignature) {return;}[_hotKeys enumerateKeysAndObjectsUsingBlock:^(MASShortcut *shortcut, MASHotKey *hotKey, BOOL *stop) {if (hotKeyID.id == [hotKey carbonID]) {if ([hotKey action]) {dispatch_async(dispatch_get_main_queue(), [hotKey action]);}*stop = YES;}}];
}

https://music.163.com/#/song?id=865632948
伊织 2023-12-22

http://www.yayakq.cn/news/138245/

相关文章:

  • 如何申请一个网站域名如何创建网址
  • 外贸服装接单网站罗湖网站(建设深圳信科)
  • 建设银行网站怎么开通手机通知wordpress多设备网页生成
  • 网站平台怎么建立的福州网站建设自助建站
  • 创新的响应式网站建设wordpress稳定版本号
  • 短视频运营培训学校温州seo教程
  • 网站开发软件 d微同网 我的网站移动版
  • 青阳网站建设电子商务网站的推广方法
  • 广州网站建设品牌莞城短视频seo优化
  • 地方网站用wordPress搭建图片库
  • 东莞网站建设_东莞网页设计门户网站建设理由
  • 聊城哪里可以学网站建设呢维度网络网站建设
  • 专业餐饮网站建设建筑有限公司
  • 扶余手机网站开发企业应该如何建设网站
  • 国外做免费的视频网站有哪些如何做网站页面
  • 最专业的网站建设组织angular2做的网站有
  • 绍兴网站推广优化国内服务器
  • 大连免费建站模板百度云网页版登录入口
  • 海南七星彩网站建设网站开发规划方案
  • godaddy域名买的网站网络安全专业学什么
  • 做泵阀到哪个网站好建设网站硬件
  • 黄浦网站制作阿里云主机价格表
  • 网站自然优化自学互联网公司大厂排名
  • 想做一个自己的网站怎么做的golang 网站开发 开源
  • 优秀网站设计平台中国最大的家装网站
  • 加强机关门户网站建设方案网络管理中心网站
  • 做网站注册几类商标可以自己设计装修的免费软件
  • 广东同江医院网站建设百度网站排名提升工具
  • 做网站应该注意哪些方面桂林漓江景区门票
  • 网站制作用什么语言做网站店铺怎样打理