1 /* 2 * Copyright (c) 2022-2023 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_SIDE_BAR_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_SIDE_BAR_H 18 19 #include "frameworks/bridge/declarative_frontend/jsview/js_stack.h" 20 #include "core/components/side_bar/side_bar_container_component.h" 21 22 namespace OHOS::Ace::Framework { 23 24 enum class SideBarControlButtonType { 25 SHOWN = 0, 26 HIDDEN, 27 SWITCHING, 28 }; 29 30 class JSSideBar : public JSStack { 31 public: 32 static void JSBind(BindingTarget globalObj); 33 static void Create(const JSCallbackInfo& info); 34 static void SetShowControlButton(const JSCallbackInfo& info); 35 static void OnChange(const JSCallbackInfo& info); 36 static void JsSideBarWidth(const JSCallbackInfo& info); 37 static void JsMaxSideBarWidth(const JSCallbackInfo& info); 38 static void JsMinSideBarWidth(const JSCallbackInfo& info); 39 static void JsShowSideBar(const JSCallbackInfo& info); 40 static void JsControlButton(const JSCallbackInfo& info); 41 static void JsDivider(const JSCallbackInfo& info); 42 static void JsMinContentWidth(const JSCallbackInfo& info); 43 static void JsAutoHide(bool autoHide); 44 static void JsSideBarPosition(const JSCallbackInfo& info); 45 static void CreateForNG(const JSCallbackInfo& info); 46 static void JsControlButtonForNG(const JSCallbackInfo& info); 47 private: 48 static void SetControlButtonIcon(SideBarControlButtonType iconType, JSRef<JSVal> icon); 49 static void ParseControlButtonOG(JSRef<JSObject> value); 50 static void ParseControlButtonNG(JSRef<JSObject> value); 51 }; 52 53 } // namespace OHOS::Ace::Framework 54 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_SIDE_BAR_H 55