1 /* 2 * Copyright (c) 2023-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 OHOS_PIP_OPTION_H 17 #define OHOS_PIP_OPTION_H 18 #include <refbase.h> 19 #include <string> 20 #include "xcomponent_controller.h" 21 #include "napi/native_api.h" 22 #include "wm_common.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 using namespace Ace; 27 class PipOption : virtual public RefBase { 28 public: 29 explicit PipOption(); 30 virtual ~PipOption() = default; 31 void SetContext(void* contextPtr); 32 void SetNavigationId(const std::string& navigationId); 33 void SetPipTemplate(uint32_t templateType); 34 void SetContentSize(uint32_t width, uint32_t height); 35 void SetPiPControlStatus(PiPControlType controlType, PiPControlStatus status); 36 void SetPiPControlEnabled(PiPControlType controlType, PiPControlStatus enabled); 37 void SetXComponentController(std::shared_ptr<XComponentController> xComponentController); 38 void SetControlGroup(std::vector<std::uint32_t> controlGroup); 39 void* GetContext() const; 40 std::string GetNavigationId() const; 41 uint32_t GetPipTemplate(); 42 std::vector<std::uint32_t> GetControlGroup(); 43 std::vector<PiPControlStatusInfo> GetControlStatus(); 44 std::vector<PiPControlEnableInfo> GetControlEnable(); 45 void GetContentSize(uint32_t& width, uint32_t& height); 46 std::shared_ptr<XComponentController> GetXComponentController(); 47 void SetNodeControllerRef(napi_ref ref); 48 napi_ref GetNodeControllerRef() const; 49 void SetTypeNodeRef(napi_ref ref); 50 napi_ref GetTypeNodeRef() const; 51 void SetTypeNodeEnabled(bool enable); 52 bool IsTypeNodeEnabled() const; 53 private: 54 void* contextPtr_ = nullptr; 55 uint32_t templateType_ = 0; 56 std::string navigationId_ = ""; 57 uint32_t contentWidth_ = 0; 58 uint32_t contentHeight_ = 0; 59 std::vector<PiPControlStatusInfo> pipControlStatusInfoList_; 60 std::vector<PiPControlEnableInfo> pipControlEnableInfoList_; 61 std::vector<std::uint32_t> controlGroup_; 62 std::shared_ptr<XComponentController> xComponentController_ = nullptr; 63 napi_ref customNodeController_ = nullptr; 64 napi_ref typeNode_ = nullptr; 65 bool useTypeNode_ = false; 66 }; 67 } 68 } 69 #endif //OHOS_PIP_OPTION_H 70