161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci* Copyright (C) 2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci* you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci* You may obtain a copy of the License at 661847f8eSopenharmony_ci* 761847f8eSopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci* 961847f8eSopenharmony_ci* Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci* See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci* limitations under the License. 1461847f8eSopenharmony_ci*/ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file Defines FoldSplitContainer component. 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport display from '@ohos.display'; 2261847f8eSopenharmony_ciimport window from '@ohos.window'; 2361847f8eSopenharmony_ciimport { Position, Size } from '@ohos.arkui.node'; 2461847f8eSopenharmony_ciimport { Callback } from '@ohos.base'; 2561847f8eSopenharmony_ci 2661847f8eSopenharmony_ci/** 2761847f8eSopenharmony_ci * Position enum of the extra region 2861847f8eSopenharmony_ci * 2961847f8eSopenharmony_ci * @enum { number } 3061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3161847f8eSopenharmony_ci * @atomicservice 3261847f8eSopenharmony_ci * @since 12 3361847f8eSopenharmony_ci */ 3461847f8eSopenharmony_ciexport declare enum ExtraRegionPosition { 3561847f8eSopenharmony_ci /** 3661847f8eSopenharmony_ci * The extra region position is in the top. 3761847f8eSopenharmony_ci * 3861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3961847f8eSopenharmony_ci * @atomicservice 4061847f8eSopenharmony_ci * @since 12 4161847f8eSopenharmony_ci */ 4261847f8eSopenharmony_ci TOP = 1, 4361847f8eSopenharmony_ci /** 4461847f8eSopenharmony_ci * The extra region position is in the bottom. 4561847f8eSopenharmony_ci * 4661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4761847f8eSopenharmony_ci * @atomicservice 4861847f8eSopenharmony_ci * @since 12 4961847f8eSopenharmony_ci */ 5061847f8eSopenharmony_ci BOTTOM = 2 5161847f8eSopenharmony_ci} 5261847f8eSopenharmony_ci/** 5361847f8eSopenharmony_ci * The layout options for the container when the foldable screen is expanded. 5461847f8eSopenharmony_ci * 5561847f8eSopenharmony_ci * @interface ExpandedRegionLayoutOptions 5661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5761847f8eSopenharmony_ci * @atomicservice 5861847f8eSopenharmony_ci * @since 12 5961847f8eSopenharmony_ci */ 6061847f8eSopenharmony_ciexport interface ExpandedRegionLayoutOptions { 6161847f8eSopenharmony_ci /** 6261847f8eSopenharmony_ci * The ratio of the widths of two areas in the horizontal direction. 6361847f8eSopenharmony_ci * 6461847f8eSopenharmony_ci * @type { ?number } 6561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6661847f8eSopenharmony_ci * @atomicservice 6761847f8eSopenharmony_ci * @since 12 6861847f8eSopenharmony_ci */ 6961847f8eSopenharmony_ci horizontalSplitRatio?: number; 7061847f8eSopenharmony_ci /** 7161847f8eSopenharmony_ci * The ratio of the heights of two areas in the vertical direction. 7261847f8eSopenharmony_ci * 7361847f8eSopenharmony_ci * @type { ?number } 7461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7561847f8eSopenharmony_ci * @atomicservice 7661847f8eSopenharmony_ci * @since 12 7761847f8eSopenharmony_ci */ 7861847f8eSopenharmony_ci verticalSplitRatio?: number; 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Does the extended area span from top to bottom within the container? 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @type { ?boolean } 8361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8461847f8eSopenharmony_ci * @atomicservice 8561847f8eSopenharmony_ci * @since 12 8661847f8eSopenharmony_ci */ 8761847f8eSopenharmony_ci isExtraRegionPerpendicular?: boolean; 8861847f8eSopenharmony_ci /** 8961847f8eSopenharmony_ci * Specify the position of the extra area when the extra area does not vertically span the container. 9061847f8eSopenharmony_ci * 9161847f8eSopenharmony_ci * @type { ?ExtraRegionPosition } 9261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9361847f8eSopenharmony_ci * @atomicservice 9461847f8eSopenharmony_ci * @since 12 9561847f8eSopenharmony_ci */ 9661847f8eSopenharmony_ci extraRegionPosition?: ExtraRegionPosition; 9761847f8eSopenharmony_ci} 9861847f8eSopenharmony_ci/** 9961847f8eSopenharmony_ci * The layout options for the container when the foldable screen is in hover mode. 10061847f8eSopenharmony_ci * 10161847f8eSopenharmony_ci * @typedef HoverModeRegionLayoutOptions 10261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10361847f8eSopenharmony_ci * @atomicservice 10461847f8eSopenharmony_ci * @since 12 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ciexport interface HoverModeRegionLayoutOptions { 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * The ratio of the widths of two areas in the horizontal direction. 10961847f8eSopenharmony_ci * 11061847f8eSopenharmony_ci * @type { ?number } 11161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11261847f8eSopenharmony_ci * @atomicservice 11361847f8eSopenharmony_ci * @since 12 11461847f8eSopenharmony_ci */ 11561847f8eSopenharmony_ci horizontalSplitRatio?: number; 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * Does the foldable screen display an extra area when it's in the half-folded state? 11861847f8eSopenharmony_ci * 11961847f8eSopenharmony_ci * @type { ?boolean } 12061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12161847f8eSopenharmony_ci * @atomicservice 12261847f8eSopenharmony_ci * @since 12 12361847f8eSopenharmony_ci */ 12461847f8eSopenharmony_ci showExtraRegion?: boolean; 12561847f8eSopenharmony_ci /** 12661847f8eSopenharmony_ci * Specify the position of the extra area when the foldable screen is in the half-folded state. 12761847f8eSopenharmony_ci * 12861847f8eSopenharmony_ci * @type { ?ExtraRegionPosition } 12961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13061847f8eSopenharmony_ci * @atomicservice 13161847f8eSopenharmony_ci * @since 12 13261847f8eSopenharmony_ci */ 13361847f8eSopenharmony_ci extraRegionPosition?: ExtraRegionPosition; 13461847f8eSopenharmony_ci} 13561847f8eSopenharmony_ci/** 13661847f8eSopenharmony_ci * The layout options for the container when the foldable screen is folded. 13761847f8eSopenharmony_ci * 13861847f8eSopenharmony_ci * @interface FoldedRegionLayoutOptions 13961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14061847f8eSopenharmony_ci * @atomicservice 14161847f8eSopenharmony_ci * @since 12 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ciexport interface FoldedRegionLayoutOptions { 14461847f8eSopenharmony_ci /** 14561847f8eSopenharmony_ci * The ratio of the heights of two areas in the vertical direction. 14661847f8eSopenharmony_ci * 14761847f8eSopenharmony_ci * @type { ?number } 14861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14961847f8eSopenharmony_ci * @atomicservice 15061847f8eSopenharmony_ci * @since 12 15161847f8eSopenharmony_ci */ 15261847f8eSopenharmony_ci verticalSplitRatio?: number; 15361847f8eSopenharmony_ci} 15461847f8eSopenharmony_ci/** 15561847f8eSopenharmony_ci * Preset split ratio. 15661847f8eSopenharmony_ci * 15761847f8eSopenharmony_ci * @enum { number } 15861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15961847f8eSopenharmony_ci * @atomicservice 16061847f8eSopenharmony_ci * @since 12 16161847f8eSopenharmony_ci */ 16261847f8eSopenharmony_ciexport declare enum PresetSplitRatio { 16361847f8eSopenharmony_ci /** 16461847f8eSopenharmony_ci * 1:1 16561847f8eSopenharmony_ci * 16661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16761847f8eSopenharmony_ci * @atomicservice 16861847f8eSopenharmony_ci * @since 12 16961847f8eSopenharmony_ci */ 17061847f8eSopenharmony_ci LAYOUT_1V1 = 1, 17161847f8eSopenharmony_ci /** 17261847f8eSopenharmony_ci * 2:3 17361847f8eSopenharmony_ci * 17461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17561847f8eSopenharmony_ci * @atomicservice 17661847f8eSopenharmony_ci * @since 12 17761847f8eSopenharmony_ci */ 17861847f8eSopenharmony_ci LAYOUT_2V3 = 0.6666666666666666, 17961847f8eSopenharmony_ci /** 18061847f8eSopenharmony_ci * 3:2 18161847f8eSopenharmony_ci * 18261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18361847f8eSopenharmony_ci * @atomicservice 18461847f8eSopenharmony_ci * @since 12 18561847f8eSopenharmony_ci */ 18661847f8eSopenharmony_ci LAYOUT_3V2 = 1.5 18761847f8eSopenharmony_ci} 18861847f8eSopenharmony_ci/** 18961847f8eSopenharmony_ci * The status of hover mode. 19061847f8eSopenharmony_ci * 19161847f8eSopenharmony_ci * @interface HoverStatus 19261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19361847f8eSopenharmony_ci * @atomicservice 19461847f8eSopenharmony_ci * @since 12 19561847f8eSopenharmony_ci */ 19661847f8eSopenharmony_ciexport interface HoverModeStatus { 19761847f8eSopenharmony_ci /** 19861847f8eSopenharmony_ci * The fold status of devices. 19961847f8eSopenharmony_ci * 20061847f8eSopenharmony_ci * @type { display.FoldStatus } 20161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 20261847f8eSopenharmony_ci * @atomicservice 20361847f8eSopenharmony_ci * @since 12 20461847f8eSopenharmony_ci */ 20561847f8eSopenharmony_ci foldStatus: display.FoldStatus; 20661847f8eSopenharmony_ci /** 20761847f8eSopenharmony_ci * Is the app currently in hover mode? 20861847f8eSopenharmony_ci * In hover mode, the upper half of the screen is used for display, and the lower half is used for operation. 20961847f8eSopenharmony_ci * 21061847f8eSopenharmony_ci * @type { boolean } 21161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21261847f8eSopenharmony_ci * @atomicservice 21361847f8eSopenharmony_ci * @since 12 21461847f8eSopenharmony_ci */ 21561847f8eSopenharmony_ci isHoverMode: boolean; 21661847f8eSopenharmony_ci /** 21761847f8eSopenharmony_ci * The angle of rotation applied. 21861847f8eSopenharmony_ci * 21961847f8eSopenharmony_ci * @type { number } 22061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 22161847f8eSopenharmony_ci * @atomicservice 22261847f8eSopenharmony_ci * @since 12 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci appRotation: number; 22561847f8eSopenharmony_ci /** 22661847f8eSopenharmony_ci * The status of window. 22761847f8eSopenharmony_ci * 22861847f8eSopenharmony_ci * @type { window.WindowStatusType } 22961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23061847f8eSopenharmony_ci * @atomicservice 23161847f8eSopenharmony_ci * @since 12 23261847f8eSopenharmony_ci */ 23361847f8eSopenharmony_ci windowStatusType: window.WindowStatusType; 23461847f8eSopenharmony_ci} 23561847f8eSopenharmony_ci/** 23661847f8eSopenharmony_ci * The handler of onHoverStatusChange event 23761847f8eSopenharmony_ci * 23861847f8eSopenharmony_ci * @typedef { function } OnHoverStatusChangeHandler 23961847f8eSopenharmony_ci * @param { HoverModeStatus } status - The status of hover mode 24061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24161847f8eSopenharmony_ci * @atomicservice 24261847f8eSopenharmony_ci * @since 12 24361847f8eSopenharmony_ci */ 24461847f8eSopenharmony_ciexport type OnHoverStatusChangeHandler = (status: HoverModeStatus) => void; 24561847f8eSopenharmony_ci/** 24661847f8eSopenharmony_ci * Defines FoldSplitContainer container. 24761847f8eSopenharmony_ci * 24861847f8eSopenharmony_ci * @interface FoldSplitContainer 24961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 25061847f8eSopenharmony_ci * @atomicservice 25161847f8eSopenharmony_ci * @since 12 25261847f8eSopenharmony_ci */ 25361847f8eSopenharmony_ci@Component 25461847f8eSopenharmony_ciexport declare struct FoldSplitContainer { 25561847f8eSopenharmony_ci /** 25661847f8eSopenharmony_ci * The builder function which will be rendered in the major region of container. 25761847f8eSopenharmony_ci * 25861847f8eSopenharmony_ci * @type { Callback<void> } 25961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26061847f8eSopenharmony_ci * @atomicservice 26161847f8eSopenharmony_ci * @since 12 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci @BuilderParam 26461847f8eSopenharmony_ci primary: Callback<void>; 26561847f8eSopenharmony_ci /** 26661847f8eSopenharmony_ci * The builder function which will be rendered in the minor region of container. 26761847f8eSopenharmony_ci * 26861847f8eSopenharmony_ci * @type { Callback<void> } 26961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 27061847f8eSopenharmony_ci * @atomicservice 27161847f8eSopenharmony_ci * @since 12 27261847f8eSopenharmony_ci */ 27361847f8eSopenharmony_ci @BuilderParam 27461847f8eSopenharmony_ci secondary: Callback<void>; 27561847f8eSopenharmony_ci /** 27661847f8eSopenharmony_ci * The builder function which will be rendered in the extra region of container. 27761847f8eSopenharmony_ci * 27861847f8eSopenharmony_ci * @type { ?Callback<void> } 27961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 28061847f8eSopenharmony_ci * @atomicservice 28161847f8eSopenharmony_ci * @since 12 28261847f8eSopenharmony_ci */ 28361847f8eSopenharmony_ci @BuilderParam 28461847f8eSopenharmony_ci extra?: Callback<void>; 28561847f8eSopenharmony_ci /** 28661847f8eSopenharmony_ci * The layout options for the container when the foldable screen is expanded. 28761847f8eSopenharmony_ci * 28861847f8eSopenharmony_ci * @type { ExpandedRegionLayoutOptions } 28961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29061847f8eSopenharmony_ci * @atomicservice 29161847f8eSopenharmony_ci * @since 12 29261847f8eSopenharmony_ci */ 29361847f8eSopenharmony_ci @Prop 29461847f8eSopenharmony_ci expandedLayoutOptions: ExpandedRegionLayoutOptions; 29561847f8eSopenharmony_ci /** 29661847f8eSopenharmony_ci * The layout options for the container when the foldable screen is in hover mode. 29761847f8eSopenharmony_ci * 29861847f8eSopenharmony_ci * @type { HoverModeRegionLayoutOptions } 29961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 30061847f8eSopenharmony_ci * @atomicservice 30161847f8eSopenharmony_ci * @since 12 30261847f8eSopenharmony_ci */ 30361847f8eSopenharmony_ci @Prop 30461847f8eSopenharmony_ci hoverModeLayoutOptions: HoverModeRegionLayoutOptions; 30561847f8eSopenharmony_ci /** 30661847f8eSopenharmony_ci * The layout options for the container when the foldable screen is folded. 30761847f8eSopenharmony_ci * 30861847f8eSopenharmony_ci * @type { FoldedRegionLayoutOptions } 30961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 31061847f8eSopenharmony_ci * @atomicservice 31161847f8eSopenharmony_ci * @since 12 31261847f8eSopenharmony_ci */ 31361847f8eSopenharmony_ci @Prop 31461847f8eSopenharmony_ci foldedLayoutOptions: FoldedRegionLayoutOptions; 31561847f8eSopenharmony_ci /** 31661847f8eSopenharmony_ci * The animation options of layout 31761847f8eSopenharmony_ci * 31861847f8eSopenharmony_ci * @type { ?(AnimateParam | null) } 31961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 32061847f8eSopenharmony_ci * @atomicservice 32161847f8eSopenharmony_ci * @since 12 32261847f8eSopenharmony_ci */ 32361847f8eSopenharmony_ci @Prop 32461847f8eSopenharmony_ci animationOptions?: AnimateParam | null; 32561847f8eSopenharmony_ci /** 32661847f8eSopenharmony_ci * The callback function that is triggered when the foldable screen enters or exits hover mode. 32761847f8eSopenharmony_ci * In hover mode, the upper half of the screen is used for display, and the lower half is used for operation. 32861847f8eSopenharmony_ci * 32961847f8eSopenharmony_ci * @type { ?OnHoverStatusChangeHandler } 33061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 33161847f8eSopenharmony_ci * @atomicservice 33261847f8eSopenharmony_ci * @since 12 33361847f8eSopenharmony_ci */ 33461847f8eSopenharmony_ci onHoverStatusChange?: OnHoverStatusChangeHandler; 33561847f8eSopenharmony_ci} 336