1 /* 2 * Copyright (c) 2023-2024 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_CONTROLLER_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_CONTROLLER_NG_H 18 19 #include "base/memory/referenced.h" 20 #include "core/components_ng/pattern/xcomponent/inner_xcomponent_controller.h" 21 22 namespace OHOS::Ace::NG { 23 class XComponentPattern; 24 25 class XComponentControllerNG : public OHOS::Ace::InnerXComponentController { 26 public: 27 XComponentControllerNG() = default; 28 ~XComponentControllerNG() override = default; 29 30 XComponentControllerErrorCode GetGlobalPosition(float& offsetX, float& offsetY) override; 31 32 XComponentControllerErrorCode GetSize(float& width, float& height) override; 33 34 XComponentControllerErrorCode SetExtController(std::shared_ptr<XComponentController> xcomponentController) override; 35 36 XComponentControllerErrorCode ResetExtController( 37 std::shared_ptr<XComponentController> xcomponentController) override; 38 39 void SetIdealSurfaceWidth(float surfaceWidth) override; 40 41 void SetIdealSurfaceHeight(float surfaceHeight) override; 42 43 void SetIdealSurfaceOffsetX(float offsetX) override; 44 45 void SetIdealSurfaceOffsetY(float offsetY) override; 46 47 void ClearIdealSurfaceOffset(bool isXAxis) override; 48 49 void UpdateSurfaceBounds() override; 50 51 void GetSurfaceSize(float& surfaceWidth, float& surfaceHeight) override; 52 53 void GetSurfaceOffset(float& offsetX, float& offsetY) override; 54 55 void SetPattern(const RefPtr<XComponentPattern>& pattern); 56 57 RefPtr<XComponentPattern> GetPattern(); 58 59 void StartImageAnalyzer(void* config, OnAnalyzedCallback& onAnalyzed) override; 60 61 void StopImageAnalyzer() override; 62 63 void SetSurfaceRotation(bool isLock) override; 64 65 bool GetSurfaceRotation() override; 66 67 private: 68 WeakPtr<XComponentPattern> pattern_; 69 }; 70 } // namespace OHOS::Ace::NG 71 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_CONTROLLER_NG_H 72