1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 18 19 #include "bridge/declarative_frontend/jsview/js_view_common_def.h" 20 #include "core/components_v2/pattern_lock/pattern_lock_component.h" 21 #include "core/components_v2/pattern_lock/pattern_lock_theme.h" 22 #include "frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h" 23 #include "frameworks/bridge/declarative_frontend/jsview/js_view_common_def.h" 24 25 namespace OHOS::Ace::Framework { 26 class JSPatternLock : public JSViewAbstract { 27 public: 28 static void Create(const JSCallbackInfo& info); 29 static void JSBind(BindingTarget globalObj); 30 static void SetSelectedColor(const JSCallbackInfo& info); 31 static void SetActiveColor(const JSCallbackInfo& info); 32 static void SetPathColor(const JSCallbackInfo& info); 33 static void SetRegularColor(const JSCallbackInfo& info); 34 static void SetCircleRadius(const JSCallbackInfo& info); 35 static void SetSideLength(const JSCallbackInfo& info); 36 static void SetPathStrokeWidth(const JSCallbackInfo& info); 37 static void SetAutoReset(const JSCallbackInfo& info); 38 39 protected: 40 static void SetPatternComplete(const JSCallbackInfo& info); 41 42 private: 43 static void SetDefaultTheme(OHOS::Ace::RefPtr<OHOS::Ace::V2::PatternLockComponent>& patternLock); 44 static JSRef<JSArray> ChoosePointToJSValue(std::vector<int> input); 45 }; 46 47 class JSPatternLockController final : public Referenced { 48 public: 49 JSPatternLockController() = default; 50 ~JSPatternLockController() override = default; 51 static void JSBind(BindingTarget globalObj); 52 static void Constructor(const JSCallbackInfo& args); 53 static void Destructor(JSPatternLockController* controller); 54 void Reset(const JSCallbackInfo& args); SetController(const RefPtr<V2::PatternLockController> & controller)55 void SetController(const RefPtr<V2::PatternLockController>& controller) 56 { 57 controller_ = controller; 58 } 59 60 private: 61 RefPtr<V2::PatternLockController> controller_; 62 ACE_DISALLOW_COPY_AND_MOVE(JSPatternLockController); 63 }; 64 } // namespace OHOS::Ace::Framework 65 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H