本文整理汇总了C++中nsCOMPtr::GetMetaKey方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::GetMetaKey方法的具体用法?C++ nsCOMPtr::GetMetaKey怎么用?C++ nsCOMPtr::GetMetaKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::GetMetaKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addKeyEventDataToProperties
nsresult EmbedEventListener::addKeyEventDataToProperties(nsCOMPtr<nsIDOMKeyEvent> keyEvent)
{
// if the initialization failed, don't modify the mProperties
if (!mProperties || !util_StringConstantsAreInitialized()) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
// Add modifiers, keys, etc, to the mProperties table
PRUint32 int32Val;
PRBool boolVal;
char buf[20];
jstring strVal;
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
// PENDING(edburns): perhaps use a macro to speed this up?
rv = keyEvent->GetCharCode(&int32Val);
if (NS_SUCCEEDED(rv)) {
buf[0] = (char) int32Val;
buf[1]= nsnull;
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, CHAR_CODE,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = keyEvent->GetKeyCode(&int32Val);
if (NS_SUCCEEDED(rv)) {
memset(buf, 0, 20);
WC_ITOA(int32Val, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, KEY_CODE,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = keyEvent->GetAltKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, ALT_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = keyEvent->GetCtrlKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, CTRL_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = keyEvent->GetShiftKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, SHIFT_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = keyEvent->GetMetaKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, META_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
return rv;
}
示例2: addMouseEventDataToProperties
//.........这里部分代码省略.........
jstring strVal;
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
// PENDING(edburns): perhaps use a macro to speed this up?
rv = mouseEvent->GetScreenX(&intVal);
if (NS_SUCCEEDED(rv)) {
memset(buf, 0, 20);
WC_ITOA(intVal, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, SCREEN_X_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetScreenY(&intVal);
if (NS_SUCCEEDED(rv)) {
#if (defined(XP_MAC) || defined(XP_MACOSX)) && defined(MOZ_WIDGET_COCOA)
intVal -=5;
#endif
memset(buf, 0, 20);
WC_ITOA(intVal, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, SCREEN_Y_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetClientX(&intVal);
if (NS_SUCCEEDED(rv)) {
memset(buf, 0, 20);
WC_ITOA(intVal, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, CLIENT_X_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetClientY(&intVal);
if (NS_SUCCEEDED(rv)) {
memset(buf, 0, 20);
WC_ITOA(intVal, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, CLIENT_Y_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
int16Val = 0;
rv = mouseEvent->GetButton(&int16Val);
if (NS_SUCCEEDED(rv)) {
memset(buf, 0, 20);
WC_ITOA(int16Val, buf, 10);
strVal = ::util_NewStringUTF(env, buf);
::util_StoreIntoPropertiesObject(env, mProperties, BUTTON_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetAltKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, ALT_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetCtrlKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, CTRL_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetShiftKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, SHIFT_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
rv = mouseEvent->GetMetaKey(&boolVal);
if (NS_SUCCEEDED(rv)) {
strVal = boolVal ? (jstring) TRUE_VALUE : (jstring) FALSE_VALUE;
::util_StoreIntoPropertiesObject(env, mProperties, META_KEY,
(jobject) strVal,
(jobject)
&(mOwner->GetWrapperFactory()->shareContext));
}
return rv;
}