本文整理汇总了C++中WebKeyboardEvent类的典型用法代码示例。如果您正苦于以下问题:C++ WebKeyboardEvent类的具体用法?C++ WebKeyboardEvent怎么用?C++ WebKeyboardEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebKeyboardEvent类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WebKit2PlatformKeyboardEvent
WebKit2PlatformKeyboardEvent(const WebKeyboardEvent& webEvent)
{
// PlatformEvent
switch (webEvent.type()) {
case WebEvent::KeyDown:
m_type = WebCore::PlatformEvent::KeyDown;
break;
case WebEvent::KeyUp:
m_type = WebCore::PlatformEvent::KeyUp;
break;
case WebEvent::RawKeyDown:
m_type = WebCore::PlatformEvent::RawKeyDown;
break;
case WebEvent::Char:
m_type = WebCore::PlatformEvent::Char;
break;
default:
ASSERT_NOT_REACHED();
}
m_modifiers = 0;
if (webEvent.shiftKey())
m_modifiers |= ShiftKey;
if (webEvent.controlKey())
m_modifiers |= CtrlKey;
if (webEvent.altKey())
m_modifiers |= AltKey;
if (webEvent.metaKey())
m_modifiers |= MetaKey;
m_timestamp = webEvent.timestamp();
// PlatformKeyboardEvent
m_text = webEvent.text();
m_unmodifiedText = webEvent.unmodifiedText();
m_keyIdentifier = webEvent.keyIdentifier();
m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode();
m_nativeVirtualKeyCode = webEvent.nativeVirtualKeyCode();
m_macCharCode = webEvent.macCharCode();
#if USE(APPKIT) || PLATFORM(GTK)
m_handledByInputMethod = webEvent.handledByInputMethod();
m_commands = webEvent.commands();
#endif
m_autoRepeat = webEvent.isAutoRepeat();
m_isKeypad = webEvent.isKeypad();
m_isSystemKey = webEvent.isSystemKey();
}
开发者ID:mu326668629,项目名称:webkit,代码行数:47,代码来源:WebEventConversion.cpp
示例2: keyboardEvent
WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
{
WebKeyboardEvent result;
// TODO(pkasting): http://b/1117926 Are we guaranteed that the message that
// GetMessageTime() refers to is the same one that we're passed in? Perhaps
// one of the construction parameters should be the time passed by the
// caller, who would know for sure.
result.timeStampSeconds = GetMessageTime() / 1000.0;
result.windowsKeyCode = result.nativeKeyCode = static_cast<int>(wparam);
switch (message) {
case WM_SYSKEYDOWN:
result.isSystemKey = true;
case WM_KEYDOWN:
result.type = WebInputEvent::RawKeyDown;
break;
case WM_SYSKEYUP:
result.isSystemKey = true;
case WM_KEYUP:
result.type = WebInputEvent::KeyUp;
break;
case WM_IME_CHAR:
result.type = WebInputEvent::Char;
break;
case WM_SYSCHAR:
result.isSystemKey = true;
result.type = WebInputEvent::Char;
case WM_CHAR:
result.type = WebInputEvent::Char;
break;
default:
ASSERT_NOT_REACHED();
}
if (result.type == WebInputEvent::Char || result.type == WebInputEvent::RawKeyDown) {
result.text[0] = result.windowsKeyCode;
result.unmodifiedText[0] = result.windowsKeyCode;
}
if (result.type != WebInputEvent::Char)
result.setKeyIdentifierFromWindowsKeyCode();
if (GetKeyState(VK_SHIFT) & 0x8000)
result.modifiers |= WebInputEvent::ShiftKey;
if (GetKeyState(VK_CONTROL) & 0x8000)
result.modifiers |= WebInputEvent::ControlKey;
if (GetKeyState(VK_MENU) & 0x8000)
result.modifiers |= WebInputEvent::AltKey;
// NOTE: There doesn't seem to be a way to query the mouse button state in
// this case.
if (LOWORD(lparam) > 1)
result.modifiers |= WebInputEvent::IsAutoRepeat;
if (isKeyPad(wparam, lparam))
result.modifiers |= WebInputEvent::IsKeyPad;
SetToggleKeyState(&result);
return result;
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:61,代码来源:WebInputEventFactory.cpp
注:本文中的WebKeyboardEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论