IKeyboard::AddHotKeyResult RDOKeyboard::addHotKey(const LPRDORuntime& pRuntime, const std::string& hotKey) { RDOHotKey::KeyCode scanCode = pRuntime->hotkey().toolkit().codeFromString(hotKey); if (scanCode == RDOHotKey::UNDEFINED_KEY) return IKeyboard::AddHotKeyResult::NOTFOUND; if (m_scan_code != RDOHotKey::UNDEFINED_KEY && scanCode != VK_SHIFT && scanCode != VK_CONTROL) return IKeyboard::AddHotKeyResult::ALREADY; switch (scanCode) { case VK_SHIFT: m_shift = true; pRuntime->hotkey().keyInModel().insert(VK_SHIFT); break; case VK_CONTROL: m_control = true; pRuntime->hotkey().keyInModel().insert(VK_CONTROL); break; default: m_scan_code = scanCode; if (m_scan_code) { pRuntime->hotkey().keyInModel().insert(scanCode); } break; } return IKeyboard::AddHotKeyResult::OK; }
bool RDOKeyboard::choiceFrom(const LPRDORuntime& pRuntime) { pRuntime->setCurrentActivity(this); if (!pRuntime->hotkey().areaList().check(m_oprName)) { if (!pRuntime->hotkey().keyDown().isPressed(m_scan_code, m_shift, m_control)) return false; } return RDOOperation::choiceFrom(pRuntime); }