mirror of
https://gitee.com/openharmony/accessibility
synced 2025-03-03 09:50:36 +00:00
update config functions
Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
parent
714989c1b0
commit
3b87cfe093
@ -43,8 +43,8 @@ public:
|
||||
void SetScreenMagnificationState(const bool state);
|
||||
void SetShortKeyState(const bool state);
|
||||
void SetMouseKeyState(const bool state);
|
||||
void SetCaptionState(const bool state);
|
||||
void SetCaptionProperty(const CaptionProperty &caption);
|
||||
void SetCaptionsState(const bool state);
|
||||
void SetCaptionsProperty(const CaptionProperty &caption);
|
||||
void SetMouseAutoClick(const int32_t time);
|
||||
void SetShortkeyTarget(const std::string &name);
|
||||
void SetHighContrastTextState(bool state);
|
||||
@ -59,8 +59,8 @@ public:
|
||||
void GetScreenMagnificationState(bool &state);
|
||||
void GetShortKeyState(bool &state);
|
||||
void GetMouseKeyState(bool &state);
|
||||
void GetCaptionState(bool &state);
|
||||
void GetCaptionProperty(CaptionProperty &caption);
|
||||
void GetCaptionsState(bool &state);
|
||||
void GetCaptionsProperty(CaptionProperty &caption);
|
||||
void GetMouseAutoClick(int32_t &time);
|
||||
void GetShortkeyTarget(std::string &name);
|
||||
void GetInvertColorState(bool &state);
|
||||
@ -208,6 +208,7 @@ private:
|
||||
void UpdateAnimationOffEnabled(const bool enabled);
|
||||
void UpdateInvertColorEnabled(const bool enabled);
|
||||
void UpdateHighContrastTextEnabled(const bool enabled);
|
||||
void InitVar();
|
||||
|
||||
sptr<AccessibilityEnableAbilityListsObserverStubImpl> enableAbilityListsObserverStub_ = nullptr;
|
||||
sptr<Accessibility::IAccessibleAbilityManagerService> serviceProxy_ = nullptr;
|
||||
|
@ -94,16 +94,16 @@ void AccessibilityConfig::SetMouseKeyState(const bool state)
|
||||
pImpl_->SetMouseKeyState(state);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::SetCaptionState(const bool state)
|
||||
void AccessibilityConfig::SetCaptionsState(const bool state)
|
||||
{
|
||||
CHECK_IMPL_PTR()
|
||||
pImpl_->SetCaptionState(state);
|
||||
pImpl_->SetCaptionsState(state);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::SetCaptionProperty(const CaptionProperty &caption)
|
||||
void AccessibilityConfig::SetCaptionsProperty(const CaptionProperty &caption)
|
||||
{
|
||||
CHECK_IMPL_PTR()
|
||||
pImpl_->SetCaptionProperty(caption);
|
||||
pImpl_->SetCaptionsProperty(caption);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::SetMouseAutoClick(const int32_t time)
|
||||
@ -184,16 +184,16 @@ void AccessibilityConfig::GetMouseKeyState(bool &state) const
|
||||
pImpl_->GetMouseKeyState(state);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::GetCaptionState(bool &state) const
|
||||
void AccessibilityConfig::GetCaptionsState(bool &state) const
|
||||
{
|
||||
CHECK_IMPL_PTR()
|
||||
pImpl_->GetCaptionState(state);
|
||||
pImpl_->GetCaptionsState(state);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::GetCaptionProperty(CaptionProperty &caption) const
|
||||
void AccessibilityConfig::GetCaptionsProperty(CaptionProperty &caption) const
|
||||
{
|
||||
CHECK_IMPL_PTR()
|
||||
pImpl_->GetCaptionProperty(caption);
|
||||
pImpl_->GetCaptionsProperty(caption);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::GetMouseAutoClick(int32_t &time) const
|
||||
|
@ -49,6 +49,8 @@ AccessibilityConfig::Impl::Impl()
|
||||
return;
|
||||
}
|
||||
serviceProxy_->RegisterConfigObserver(configObserver_);
|
||||
|
||||
InitVar();
|
||||
}
|
||||
|
||||
bool AccessibilityConfig::Impl::ConnectToService()
|
||||
@ -128,7 +130,7 @@ bool AccessibilityConfig::Impl::DisableAbility(const std::string &name)
|
||||
return serviceProxy_->DisableAbility(name);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::Impl::GetCaptionState(bool &state)
|
||||
void AccessibilityConfig::Impl::GetCaptionsState(bool &state)
|
||||
{
|
||||
HILOG_INFO();
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@ -140,7 +142,7 @@ void AccessibilityConfig::Impl::GetCaptionState(bool &state)
|
||||
state = serviceProxy_->GetCaptionState();
|
||||
}
|
||||
|
||||
void AccessibilityConfig::Impl::GetCaptionProperty(CaptionProperty &caption)
|
||||
void AccessibilityConfig::Impl::GetCaptionsProperty(CaptionProperty &caption)
|
||||
{
|
||||
HILOG_INFO();
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@ -151,7 +153,7 @@ void AccessibilityConfig::Impl::GetCaptionProperty(CaptionProperty &caption)
|
||||
caption = serviceProxy_->GetCaptionProperty();
|
||||
}
|
||||
|
||||
void AccessibilityConfig::Impl::SetCaptionProperty(const CaptionProperty& caption)
|
||||
void AccessibilityConfig::Impl::SetCaptionsProperty(const CaptionProperty& caption)
|
||||
{
|
||||
HILOG_INFO();
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@ -162,7 +164,7 @@ void AccessibilityConfig::Impl::SetCaptionProperty(const CaptionProperty& captio
|
||||
serviceProxy_->SetCaptionProperty(caption);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::Impl::SetCaptionState(const bool state)
|
||||
void AccessibilityConfig::Impl::SetCaptionsState(const bool state)
|
||||
{
|
||||
HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
@ -1223,5 +1225,29 @@ void AccessibilityConfig::Impl::OnAccessibleAbilityManagerShortkeyTargetChanged(
|
||||
|
||||
NotifyShortkeyTargetChanged(observers, shortkeyTarget);
|
||||
}
|
||||
|
||||
void AccessibilityConfig::Impl::InitVar()
|
||||
{
|
||||
if(!serviceProxy_){
|
||||
HILOG_ERROR("AAMS Service is not connected");
|
||||
return;
|
||||
}
|
||||
highContrastText_ = serviceProxy_->GetHighContrastTextState();;
|
||||
invertColor_ = serviceProxy_->GetInvertColorState();
|
||||
animationOff_ = serviceProxy_->GetAnimationOffState();
|
||||
audioMono_ = serviceProxy_->GetAudioMonoState();
|
||||
mouseKey_ = serviceProxy_->GetMouseKeyState();
|
||||
captionState_ = serviceProxy_->GetCaptionState();
|
||||
screenMagnifier_ = serviceProxy_->GetScreenMagnificationState();
|
||||
shortkey_ = serviceProxy_->GetShortKeyState();
|
||||
mouseAutoClick_ = serviceProxy_->GetMouseAutoClick();
|
||||
daltonizationColorFilter_ = serviceProxy_->GetDaltonizationColorFilter();
|
||||
contentTimeout_ = serviceProxy_->GetContentTimeout();
|
||||
brightnessDiscount_ = serviceProxy_->GetBrightnessDiscount();
|
||||
audioBalance_ = serviceProxy_->GetAudioBalance();
|
||||
shortkeyTarget_ = serviceProxy_->GetShortkeyTarget();
|
||||
captionProperty_ = serviceProxy_->GetCaptionProperty();
|
||||
|
||||
}
|
||||
} // namespace AccessibilityConfig
|
||||
} // namespace OHOS
|
@ -176,14 +176,14 @@ public:
|
||||
* @param state true:enable caption function; false:disable caption function
|
||||
* @return -
|
||||
*/
|
||||
void SetCaptionState(const bool state);
|
||||
void SetCaptionsState(const bool state);
|
||||
|
||||
/**
|
||||
* @brief Set caption properties
|
||||
* @param caption caption properties
|
||||
* @return -
|
||||
*/
|
||||
void SetCaptionProperty(const CaptionProperty &caption);
|
||||
void SetCaptionsProperty(const CaptionProperty &caption);
|
||||
|
||||
/**
|
||||
* @brief Set the time for the cursor to stop for the mouse to automatically perform the click action
|
||||
@ -281,14 +281,14 @@ public:
|
||||
* @param state(out) true:the caption function is enabled; false:the caption function is disabled
|
||||
* @return -
|
||||
*/
|
||||
void GetCaptionState(bool &state) const;
|
||||
void GetCaptionsState(bool &state) const;
|
||||
|
||||
/**
|
||||
* @brief Get caption properties
|
||||
* @param caption(out) caption properties
|
||||
* @return -
|
||||
*/
|
||||
void GetCaptionProperty(CaptionProperty &caption) const;
|
||||
void GetCaptionsProperty(CaptionProperty &caption) const;
|
||||
|
||||
/**
|
||||
* @brief Get the time for the cursor to stop for the mouse to automatically perform the click action
|
||||
|
@ -78,7 +78,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
abConfig.SetScreenMagnificationState(data[startPos++] & 0x01);
|
||||
abConfig.SetShortKeyState(data[startPos++] & 0x01);
|
||||
abConfig.SetMouseKeyState(data[startPos++] & 0x01);
|
||||
abConfig.SetCaptionState(data[startPos++] & 0x01);
|
||||
abConfig.SetCaptionsState(data[startPos++] & 0x01);
|
||||
abConfig.SetHighContrastTextState(data[startPos++] & 0x01);
|
||||
abConfig.SetInvertColorState(data[startPos++] & 0x01);
|
||||
abConfig.SetAnimationOffState(data[startPos++] & 0x01);
|
||||
@ -110,7 +110,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
|
||||
OHOS::AccessibilityConfig::CaptionProperty property;
|
||||
startPos += GenerateCaptionProperty(property, &data[startPos], size - startPos);
|
||||
abConfig.SetCaptionProperty(property);
|
||||
abConfig.SetCaptionsProperty(property);
|
||||
|
||||
std::memcpy(&name, &data[startPos], LEN);
|
||||
std::string abilityName1(name);
|
||||
|
125
interfaces/kits/js/@ohos.accessibility.config.d.ts
vendored
125
interfaces/kits/js/@ohos.accessibility.config.d.ts
vendored
@ -1,27 +1,75 @@
|
||||
import accessibility from './@ohos.accessibility';
|
||||
import { AsyncCallback, Callback } from './basic';
|
||||
|
||||
|
||||
/**
|
||||
* Configuration of the accessibility.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.BarrierFree.Accessibility.Core
|
||||
* @systemapi
|
||||
*/
|
||||
declare namespace config {
|
||||
/**
|
||||
* Indicates the configuration of high-contrast text.
|
||||
*/
|
||||
var highContrastText: Config<boolean>;
|
||||
/**
|
||||
* Indicates the configuration of invert color.
|
||||
*/
|
||||
var invertColor: Config<boolean>;
|
||||
/**
|
||||
* Indicates the configuration of daltonization color filter.
|
||||
*/
|
||||
var daltonizationColorFilter: Config<DaltonizationColorFilter>;
|
||||
// number int scope: 0 - 5000 ms
|
||||
/**
|
||||
* Indicates the configuration of content timeout.
|
||||
*/
|
||||
var contentTimeout: Config<number>;
|
||||
/**
|
||||
* Indicates the configuration of animation state.
|
||||
*/
|
||||
var animationOff: Config<boolean>;
|
||||
// number float scope: 0.0 - 1.0
|
||||
/**
|
||||
* Indicates the configuration of brightness discount.
|
||||
*/
|
||||
var brightnessDiscount: Config<number>;
|
||||
/**
|
||||
* Indicates the configuration of screen magnifier.
|
||||
*/
|
||||
var screenMagnifier: Config<boolean>;
|
||||
/**
|
||||
* Indicates the configuration of audio mono.
|
||||
*/
|
||||
var audioMono: Config<boolean>;
|
||||
// number float scope: -1.0 - 1.0
|
||||
/**
|
||||
* Indicates the configuration of audio balance.
|
||||
*/
|
||||
var audioBalance: Config<number>;
|
||||
/**
|
||||
* Indicates the configuration of monse key state.
|
||||
*/
|
||||
var mouseKey: Config<boolean>;
|
||||
// number int scope: -1 off / 0 - 5000 ms on
|
||||
/**
|
||||
* Indicates the configuration of mouse auto click.
|
||||
*/
|
||||
var mouseAutoClick: Config<number>;
|
||||
/**
|
||||
* Indicates the configuration of shortkey state.
|
||||
*/
|
||||
var shortkey: Config<boolean>;
|
||||
var shortkey_target: Config<string>;
|
||||
var caption: Config<boolean>;
|
||||
var captionStyle: Config<accessibility.CaptionsStyle>;
|
||||
|
||||
/**
|
||||
* Indicates the configuration of shortkey target.
|
||||
*/
|
||||
var shortkeyTarget: Config<string>;
|
||||
/**
|
||||
* Indicates the configuration of captions state.
|
||||
*/
|
||||
var captions: Config<boolean>;
|
||||
/**
|
||||
* Indicates the configuration of captions style.
|
||||
*/
|
||||
var captionsStyle: Config<accessibility.CaptionsStyle>;
|
||||
|
||||
/**
|
||||
* Enable the acceessibility extension ability.
|
||||
* @param name Indicates the accessibility extension name, in "bundleName/abilityName" format.
|
||||
@ -38,35 +86,52 @@ declare namespace config {
|
||||
function disableAbility(name: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Register the observe of the AbilityLists enable status changed.
|
||||
* @since 9
|
||||
* @sysCap Accessibility
|
||||
* @param -
|
||||
* @return -
|
||||
*/
|
||||
* Register the listener to listen for for changes in the enabled status of accessibility extensions.
|
||||
* @param type Indicates the enableAbilityListsStateChanged type.
|
||||
* @param callback Indicates the listener.
|
||||
*/
|
||||
function on(type: 'enableAbilityListsStateChanged', callback: Callback<void>): void;
|
||||
|
||||
/**
|
||||
* Deregister the observe of the AbilityLists enable status changed.
|
||||
* @since 9
|
||||
* @sysCap Accessibility
|
||||
* @param -
|
||||
* @return -
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deregister listener that watch for changes in the enabled status of accessibility extensions.
|
||||
* @param type Indicates the enableAbilityListsStateChanged type.
|
||||
* @param callback Indicates the listener.
|
||||
*/
|
||||
function off(type: 'enableAbilityListsStateChanged', callback?: Callback<void>): void;
|
||||
|
||||
|
||||
/**
|
||||
* Indicates setting, getting, and listening to changes in configuration.
|
||||
*/
|
||||
interface Config<T> {
|
||||
// permission: accessibility.config.write
|
||||
set(value: T, callback: AsyncCallback<void>): void;
|
||||
/**
|
||||
* Setting configuration value.
|
||||
* @param value Indicates the value.
|
||||
*/
|
||||
set(value: T): Promise<void>;
|
||||
// permission: accessibility.config.read
|
||||
get(callback: AsyncCallback<T>): void;
|
||||
set(value: T, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Getting configuration value.
|
||||
*/
|
||||
get(): Promise<T>;
|
||||
// permission: accessibility.config.read
|
||||
get(callback: AsyncCallback<T>): void;
|
||||
|
||||
/**
|
||||
* Register the listener to listen for configuration changes.
|
||||
* @param callback Indicates the listener.
|
||||
*/
|
||||
on(callback: Callback<T>): void;
|
||||
|
||||
/**
|
||||
* Deregister the listener to listen for configuration changes.
|
||||
* @param callback Indicates the listener.
|
||||
*/
|
||||
off(callback?: Callback<T>): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicates the type of daltonization color filter.
|
||||
*/
|
||||
type DaltonizationColorFilter = 'Normal' | 'Protanomaly' | 'Deuteranomaly' | 'Tritanomaly';
|
||||
}
|
||||
export default config;
|
@ -239,7 +239,11 @@ void NAccessibilityConfig::SetConfigComplete(napi_env env, napi_status status, v
|
||||
napi_get_undefined(env, &undefined);
|
||||
napi_get_undefined(env, &ret);
|
||||
if (callbackInfo->callback_) {
|
||||
result[PARAM0] = GetErrorValue(env, CODE_SUCCESS);
|
||||
if (callbackInfo->ret_) {
|
||||
result[PARAM0] = GetErrorValue(env, CODE_SUCCESS);
|
||||
} else {
|
||||
result[PARAM0] = GetErrorValue(env, CODE_FAILED);
|
||||
}
|
||||
result[PARAM1] = ret;
|
||||
napi_get_reference_value(env, callbackInfo->callback_, &callback);
|
||||
napi_value returnVal;
|
||||
@ -247,7 +251,11 @@ void NAccessibilityConfig::SetConfigComplete(napi_env env, napi_status status, v
|
||||
napi_delete_reference(env, callbackInfo->callback_);
|
||||
HILOG_DEBUG("complete function callback mode");
|
||||
} else {
|
||||
napi_resolve_deferred(env, callbackInfo->deferred_, undefined);
|
||||
if (callbackInfo->ret_) {
|
||||
napi_resolve_deferred(env, callbackInfo->deferred_, undefined);
|
||||
} else {
|
||||
napi_reject_deferred(env, callbackInfo->deferred_, undefined);
|
||||
}
|
||||
HILOG_DEBUG("complete function promise mode");
|
||||
}
|
||||
napi_delete_async_work(env, callbackInfo->work_);
|
||||
@ -263,6 +271,10 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data)
|
||||
HILOG_ERROR("callbackInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
if (!callbackInfo->ret_) {
|
||||
HILOG_ERROR("check param error");
|
||||
return;
|
||||
}
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
switch (callbackInfo->id_) {
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_HIGH_CONTRASTE_TEXT:
|
||||
@ -287,7 +299,7 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data)
|
||||
instance.SetShortKeyState(callbackInfo->boolConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE:
|
||||
instance.SetCaptionState(callbackInfo->boolConfig_);
|
||||
instance.SetCaptionsState(callbackInfo->boolConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT:
|
||||
instance.SetContentTimeout(callbackInfo->uint32Config_);
|
||||
@ -311,7 +323,7 @@ void NAccessibilityConfig::SetConfigExecute(napi_env env, void* data)
|
||||
instance.SetShortkeyTarget(callbackInfo->stringConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE:
|
||||
instance.SetCaptionProperty(callbackInfo->captionProperty_);
|
||||
instance.SetCaptionsProperty(callbackInfo->captionProperty_);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -343,8 +355,6 @@ void NAccessibilityConfig::GetConfigComplete(napi_env env, napi_status status, v
|
||||
napi_get_boolean(env, callbackInfo->boolConfig_, &result[PARAM1]);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT:
|
||||
napi_create_uint32(env, callbackInfo->uint32Config_, &result[PARAM1]);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK:
|
||||
napi_create_int32(env, callbackInfo->int32Config_, &result[PARAM1]);
|
||||
break;
|
||||
@ -411,10 +421,14 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data)
|
||||
instance.GetShortKeyState(callbackInfo->boolConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE:
|
||||
instance.GetCaptionState(callbackInfo->boolConfig_);
|
||||
instance.GetCaptionsState(callbackInfo->boolConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT:
|
||||
instance.GetContentTimeout(callbackInfo->uint32Config_);
|
||||
{
|
||||
uint32_t timeout = 0;
|
||||
instance.GetContentTimeout(timeout);
|
||||
callbackInfo->int32Config_ = static_cast<int32_t>(timeout);
|
||||
}
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK:
|
||||
instance.GetMouseAutoClick(callbackInfo->int32Config_);
|
||||
@ -436,7 +450,7 @@ void NAccessibilityConfig::GetConfigExecute(napi_env env, void* data)
|
||||
instance.GetShortkeyTarget(callbackInfo->stringConfig_);
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE:
|
||||
instance.GetCaptionProperty(callbackInfo->captionProperty_);
|
||||
instance.GetCaptionsProperty(callbackInfo->captionProperty_);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -478,21 +492,21 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STATE:
|
||||
{
|
||||
bool state = false;
|
||||
ParseBool(env, state, parameters[PARAM0]);
|
||||
callbackInfo->ret_ = ParseBool(env, state, parameters[PARAM0]);
|
||||
callbackInfo->boolConfig_ = state;
|
||||
}
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CONTENT_TIMEOUT:
|
||||
{
|
||||
uint32_t timeout = 0;
|
||||
ParseUint32(env, timeout, parameters[PARAM0]);
|
||||
callbackInfo->uint32Config_ = timeout;
|
||||
int32_t timeout = 0;
|
||||
callbackInfo->ret_ = ParseInt32(env, timeout, parameters[PARAM0]);
|
||||
callbackInfo->uint32Config_ = static_cast<uint32_t>(timeout);
|
||||
}
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_MOUSE_AUTOCLICK:
|
||||
{
|
||||
int32_t time = 0;
|
||||
ParseInt32(env, time, parameters[PARAM0]);
|
||||
callbackInfo->ret_ = ParseInt32(env, time, parameters[PARAM0]);
|
||||
callbackInfo->int32Config_ = time;
|
||||
}
|
||||
break;
|
||||
@ -500,7 +514,7 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_BRIGHTNESS_DISCOUNT:
|
||||
{
|
||||
double doubleTemp = 0;
|
||||
napi_get_value_double(env, parameters[PARAM0], &doubleTemp);
|
||||
callbackInfo->ret_ = ParseDouble(env, doubleTemp, parameters[PARAM0]);
|
||||
callbackInfo->floatConfig_ = static_cast<float>(doubleTemp);
|
||||
}
|
||||
break;
|
||||
@ -508,12 +522,12 @@ napi_value NAccessibilityConfig::SetConfig(napi_env env, napi_callback_info info
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_SHORT_KEY_TARGET:
|
||||
{
|
||||
std::string target = "";
|
||||
ParseString(env, target, parameters[PARAM0]);
|
||||
callbackInfo->ret_ = ParseString(env, target, parameters[PARAM0]) && target.length() > 0;
|
||||
callbackInfo->stringConfig_ = target;
|
||||
}
|
||||
break;
|
||||
case OHOS::AccessibilityConfig::CONFIG_ID::CONFIG_CAPTION_STYLE:
|
||||
ConvertObjToCaptionProperty(env, parameters[PARAM0], &callbackInfo->captionProperty_);
|
||||
callbackInfo->ret_ = ConvertObjToCaptionProperty(env, parameters[PARAM0], &callbackInfo->captionProperty_);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -283,11 +283,11 @@ static napi_value InitShortKeyTarget(napi_env env)
|
||||
return shortKeyTargetValue;
|
||||
}
|
||||
|
||||
static napi_value InitCaptionState(napi_env env)
|
||||
static napi_value InitCaptionsState(napi_env env)
|
||||
{
|
||||
napi_value captionValue;
|
||||
napi_create_object(env, &captionValue);
|
||||
NAPI_CALL(env, napi_define_properties(env, captionValue,
|
||||
napi_value captionsValue;
|
||||
napi_create_object(env, &captionsValue);
|
||||
NAPI_CALL(env, napi_define_properties(env, captionsValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
NAccessibilityConfigClass* nativeObj =
|
||||
@ -297,16 +297,16 @@ static napi_value InitCaptionState(napi_env env)
|
||||
return nullptr;
|
||||
}
|
||||
nativeObj->SetEnv(env);
|
||||
NAPI_CALL(env, napi_wrap(env, captionValue, reinterpret_cast<void*>(nativeObj),
|
||||
NAPI_CALL(env, napi_wrap(env, captionsValue, reinterpret_cast<void*>(nativeObj),
|
||||
NAccessibilityConfigClass::Destructor, nullptr, nativeObj->GetWrapper()));
|
||||
return captionValue;
|
||||
return captionsValue;
|
||||
}
|
||||
|
||||
static napi_value InitCaptionStyle(napi_env env)
|
||||
static napi_value InitCaptionsStyle(napi_env env)
|
||||
{
|
||||
napi_value captionStyleValue;
|
||||
napi_create_object(env, &captionStyleValue);
|
||||
NAPI_CALL(env, napi_define_properties(env, captionStyleValue,
|
||||
napi_value captionsStyleValue;
|
||||
napi_create_object(env, &captionsStyleValue);
|
||||
NAPI_CALL(env, napi_define_properties(env, captionsStyleValue,
|
||||
sizeof(configDesc) / sizeof(configDesc[0]),
|
||||
configDesc));
|
||||
NAccessibilityConfigClass* nativeObj =
|
||||
@ -316,9 +316,9 @@ static napi_value InitCaptionStyle(napi_env env)
|
||||
return nullptr;
|
||||
}
|
||||
nativeObj->SetEnv(env);
|
||||
NAPI_CALL(env, napi_wrap(env, captionStyleValue, reinterpret_cast<void*>(nativeObj),
|
||||
NAPI_CALL(env, napi_wrap(env, captionsStyleValue, reinterpret_cast<void*>(nativeObj),
|
||||
NAccessibilityConfigClass::Destructor, nullptr, nativeObj->GetWrapper()));
|
||||
return captionStyleValue;
|
||||
return captionsStyleValue;
|
||||
}
|
||||
|
||||
static napi_value InitConfigModule(napi_env env, napi_value exports)
|
||||
@ -336,8 +336,8 @@ static napi_value InitConfigModule(napi_env env, napi_value exports)
|
||||
napi_value mouseAutoClickValue = InitMouseAutoClick(env);
|
||||
napi_value shortKeyValue = InitShortKey(env);
|
||||
napi_value shortKeyTargetValue = InitShortKeyTarget(env);
|
||||
napi_value captionValue = InitCaptionState(env);
|
||||
napi_value captionStyleValue = InitCaptionStyle(env);
|
||||
napi_value captionsValue = InitCaptionsState(env);
|
||||
napi_value captionsStyleValue = InitCaptionsStyle(env);
|
||||
|
||||
napi_property_descriptor desc[] = {
|
||||
DECLARE_NAPI_FUNCTION("on", NAccessibilityConfig::SubscribeState),
|
||||
@ -356,9 +356,9 @@ static napi_value InitConfigModule(napi_env env, napi_value exports)
|
||||
DECLARE_NAPI_STATIC_PROPERTY("mouseKey", mouseKeyValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("mouseAutoClick", mouseAutoClickValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("shortkey", shortKeyValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("shortkey_target", shortKeyTargetValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("caption", captionValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("captionStyle", captionStyleValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("shortkeyTarget", shortKeyTargetValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("captions", captionsValue),
|
||||
DECLARE_NAPI_STATIC_PROPERTY("captionsStyle", captionsStyleValue),
|
||||
};
|
||||
|
||||
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc));
|
||||
|
@ -50,13 +50,13 @@ bool ParseBool(napi_env env, bool& param, napi_value args);
|
||||
bool ParseString(napi_env env, std::string& param, napi_value args);
|
||||
bool ParseUint32(napi_env env, uint32_t& param, napi_value args);
|
||||
bool ParseInt32(napi_env env, int32_t& param, napi_value args);
|
||||
bool ParseDouble(napi_env env, double& param, napi_value args);
|
||||
napi_value GetErrorValue(napi_env env, int errCode);
|
||||
|
||||
std::string ConvertWindowTypeToString(OHOS::Accessibility::AccessibilityWindowType type);
|
||||
std::string ConvertDaltonizationTypeToString(OHOS::AccessibilityConfig::DALTONIZATION_TYPE type);
|
||||
void ConvertOperationToJS(napi_env env, napi_value result, const OHOS::Accessibility::AccessibleAction& operation);
|
||||
void ConvertGridInfoToJS(napi_env env, napi_value nGrid, const OHOS::Accessibility::GridInfo& grid);
|
||||
void ConvertRangeInfoToJS(napi_env env, napi_value nRangeInfo, const OHOS::Accessibility::RangeInfo& rangeInfo);
|
||||
void ConvertGridItemToJS(napi_env env, napi_value nGridItem, const OHOS::Accessibility::GridItemInfo& gridItem);
|
||||
void ConvertRectToJS(napi_env env, napi_value result, const OHOS::Accessibility::Rect& rect);
|
||||
void ConvertAccessibleAbilityInfosToJS(napi_env env, napi_value& result,
|
||||
@ -69,7 +69,7 @@ void ConvertActionArgsJSToNAPI(
|
||||
void ConvertKeyEventToJS(napi_env env, napi_value result, const std::shared_ptr<OHOS::MMI::KeyEvent> &keyEvent);
|
||||
void ConvertCaptionPropertyToJS(napi_env env, napi_value& result,
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty);
|
||||
void ConvertObjToCaptionProperty(
|
||||
bool ConvertObjToCaptionProperty(
|
||||
napi_env env, napi_value object, OHOS::AccessibilityConfig::CaptionProperty* ptrCaptionProperty);
|
||||
void ConvertJSToStringVec(napi_env env, napi_value arrayValue, std::vector<std::string> &values);
|
||||
void ConvertStringVecToJS(napi_env env, napi_value &result, std::vector<std::string> values);
|
||||
|
@ -52,10 +52,10 @@ void NAccessibilityConfigObserver::OnConfigChanged(const ConfigValue &value)
|
||||
NotifyIntChanged2JS(value.mouseAutoClick);
|
||||
break;
|
||||
case CONFIG_DALTONIZATION_COLOR_FILTER:
|
||||
NotifyUintChanged2JS(value.daltonizationColorFilter);
|
||||
NotifyStringChanged2JS(ConvertDaltonizationTypeToString(value.daltonizationColorFilter));
|
||||
break;
|
||||
case CONFIG_CONTENT_TIMEOUT:
|
||||
NotifyUintChanged2JS(value.contentTimeout);
|
||||
NotifyIntChanged2JS(static_cast<int32_t>(value.contentTimeout));
|
||||
break;
|
||||
case CONFIG_BRIGHTNESS_DISCOUNT:
|
||||
NotifyFloatChanged2JS(value.brightnessDiscount);
|
||||
@ -110,6 +110,7 @@ void NAccessibilityConfigObserver::NotifyStateChanged2JS(bool enabled)
|
||||
[](uv_work_t *work, int status) {
|
||||
StateCallbackInfo *callbackInfo = static_cast<StateCallbackInfo*>(work->data);
|
||||
napi_value jsEvent;
|
||||
napi_create_object(callbackInfo->env_, &jsEvent);
|
||||
napi_get_boolean(callbackInfo->env_, callbackInfo->state_, &jsEvent);
|
||||
|
||||
napi_value handler = nullptr;
|
||||
|
@ -539,7 +539,7 @@ napi_value NAccessibilityClient::SetCaptionStateEnabled(napi_env env, napi_callb
|
||||
HILOG_INFO("captionState = %{public}s", captionState ? "True" : "False");
|
||||
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
instance.SetCaptionState(captionState);
|
||||
instance.SetCaptionsState(captionState);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -556,7 +556,7 @@ napi_value NAccessibilityClient::GetCaptionStateEnabled(napi_env env, napi_callb
|
||||
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
bool captionState = false;
|
||||
instance.GetCaptionState(captionState);
|
||||
instance.GetCaptionsState(captionState);
|
||||
napi_get_boolean(env, captionState, &captionStateEnabled);
|
||||
|
||||
HILOG_INFO("captionState = %{public}s", captionState ? "True" : "False");
|
||||
@ -574,7 +574,7 @@ napi_value NAccessibilityClient::SetCaptionStyle(napi_env env, napi_callback_inf
|
||||
if (argc >= ARGS_SIZE_ONE) {
|
||||
ConvertObjToCaptionProperty(env, parameters[PARAM0], &captionProperty);
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
instance.SetCaptionProperty(captionProperty);
|
||||
instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -697,7 +697,7 @@ napi_value NAccessibilityClient::GetCaptionsFontFamily(napi_env env, napi_callba
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
napi_create_string_utf8(env, captionProperty.GetFontFamily().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
return returnValue;
|
||||
}
|
||||
@ -717,10 +717,10 @@ napi_value NAccessibilityClient::SetCaptionsFontFamily(napi_env env, napi_callba
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontFamily(std::string(outBuffer));
|
||||
instance.SetCaptionProperty(captionProperty);
|
||||
instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -735,7 +735,7 @@ napi_value NAccessibilityClient::GetCaptionsFontScale(napi_env env, napi_callbac
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
napi_create_int32(env, captionProperty.GetFontScale(), &returnValue);
|
||||
return returnValue;
|
||||
}
|
||||
@ -754,10 +754,10 @@ napi_value NAccessibilityClient::SetCaptionsFontScale(napi_env env, napi_callbac
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontScale(num);
|
||||
instance.SetCaptionProperty(captionProperty);
|
||||
instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -772,7 +772,7 @@ napi_value NAccessibilityClient::GetCaptionFrontColor(napi_env env, napi_callbac
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
uint32_t color = captionProperty.GetFontColor();
|
||||
std::string colorStr = ConvertColorToString(color);
|
||||
napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
@ -790,10 +790,10 @@ napi_value NAccessibilityClient::SetCaptionFrontColor(napi_env env, napi_callbac
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontColor(color);
|
||||
(void)instance.SetCaptionProperty(captionProperty);
|
||||
(void)instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -808,7 +808,7 @@ napi_value NAccessibilityClient::GetCaptionFontEdgeType(napi_env env, napi_callb
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
napi_create_string_utf8(env, captionProperty.GetFontEdgeType().c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
return returnValue;
|
||||
}
|
||||
@ -829,10 +829,10 @@ napi_value NAccessibilityClient::SetCaptionFontEdgeType(napi_env env, napi_callb
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetFontEdgeType(std::string(outBuffer));
|
||||
instance.SetCaptionProperty(captionProperty);
|
||||
instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -847,7 +847,7 @@ napi_value NAccessibilityClient::GetCaptionBackgroundColor(napi_env env, napi_ca
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
uint32_t color = captionProperty.GetBackgroundColor();
|
||||
std::string colorStr = ConvertColorToString(color);
|
||||
napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
@ -865,10 +865,10 @@ napi_value NAccessibilityClient::SetCaptionBackgroundColor(napi_env env, napi_ca
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetBackgroundColor(color);
|
||||
(void)instance.SetCaptionProperty(captionProperty);
|
||||
(void)instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
@ -883,7 +883,7 @@ napi_value NAccessibilityClient::GetCaptionWindowColor(napi_env env, napi_callba
|
||||
napi_value returnValue = nullptr;
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
uint32_t color = captionProperty.GetWindowColor();
|
||||
std::string colorStr = ConvertColorToString(color);
|
||||
napi_create_string_utf8(env, colorStr.c_str(), NAPI_AUTO_LENGTH, &returnValue);
|
||||
@ -901,10 +901,10 @@ napi_value NAccessibilityClient::SetCaptionWindowColor(napi_env env, napi_callba
|
||||
// Get CaptionProperty
|
||||
auto &instance = Singleton<OHOS::AccessibilityConfig::AccessibilityConfig>::GetInstance();
|
||||
OHOS::AccessibilityConfig::CaptionProperty captionProperty = {};
|
||||
instance.GetCaptionProperty(captionProperty);
|
||||
instance.GetCaptionsProperty(captionProperty);
|
||||
// Change the input info and then set the CaptionProperty
|
||||
captionProperty.SetWindowColor(color);
|
||||
(void)instance.SetCaptionProperty(captionProperty);
|
||||
(void)instance.SetCaptionsProperty(captionProperty);
|
||||
} else {
|
||||
HILOG_ERROR("argc size Error");
|
||||
}
|
||||
|
@ -128,6 +128,25 @@ bool ParseInt32(napi_env env, int32_t& param, napi_value args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseDouble(napi_env env, double& param, napi_value args)
|
||||
{
|
||||
napi_status status;
|
||||
napi_valuetype valuetype;
|
||||
status = napi_typeof(env, args, &valuetype);
|
||||
if (status != napi_ok) {
|
||||
HILOG_ERROR("napi_typeof error and status is %{public}d", status);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (valuetype != napi_number) {
|
||||
HILOG_ERROR("Wrong argument type. uint32 expected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_get_value_double(env, args, ¶m);
|
||||
return true;
|
||||
}
|
||||
|
||||
napi_value GetErrorValue(napi_env env, int errCode)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
@ -1365,7 +1384,7 @@ uint32_t GetColorValue(napi_env env, napi_value value)
|
||||
return color;
|
||||
}
|
||||
|
||||
void ConvertObjToCaptionProperty(
|
||||
bool ConvertObjToCaptionProperty(
|
||||
napi_env env, napi_value object, OHOS::AccessibilityConfig::CaptionProperty* ptrCaptionProperty)
|
||||
{
|
||||
HILOG_DEBUG("start");
|
||||
@ -1382,6 +1401,8 @@ void ConvertObjToCaptionProperty(
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_string_utf8(env, value, outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
ptrCaptionProperty->SetFontFamily(std::string(outBuffer));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "fontScale", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
@ -1391,12 +1412,16 @@ void ConvertObjToCaptionProperty(
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_int32(env, value, &num);
|
||||
ptrCaptionProperty->SetFontScale(num);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "fontColor", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
ptrCaptionProperty->SetFontColor(GetColorValue(env, object, propertyNameValue));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "fontEdgeType", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
@ -1408,19 +1433,27 @@ void ConvertObjToCaptionProperty(
|
||||
napi_get_property(env, object, propertyNameValue, &value);
|
||||
napi_get_value_string_utf8(env, value, outBuffer, CHAE_BUFFER_MAX, &outSize);
|
||||
ptrCaptionProperty->SetFontEdgeType(std::string(outBuffer));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "backgroundColor", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
ptrCaptionProperty->SetBackgroundColor(GetColorValue(env, object, propertyNameValue));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
napi_create_string_utf8(env, "windowColor", NAPI_AUTO_LENGTH, &propertyNameValue);
|
||||
napi_has_property(env, object, propertyNameValue, &hasProperty);
|
||||
if (hasProperty) {
|
||||
ptrCaptionProperty->SetWindowColor(GetColorValue(env, object, propertyNameValue));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConvertJSToStringVec(napi_env env, napi_value arrayValue, std::vector<std::string>& values)
|
||||
|
Loading…
x
Reference in New Issue
Block a user