【CAPI】新增CustomSpan接口

Signed-off-by: wanjining <wanjining@huawei.com>
This commit is contained in:
wanjining 2024-07-30 19:20:51 +08:00
parent 9b4f3e3f3c
commit 3d06e579f2
3 changed files with 240 additions and 0 deletions

View File

@ -1978,5 +1978,69 @@
{
"first_introduced": "12",
"name": "OH_ArkUI_DialogDismissEvent_GetDismissReason"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_NodeCustomEvent_GetCustomSpanMeasureInfo"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_NodeCustomEvent_SetCustomSpanMetrics"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_NodeCustomEvent_GetCustomSpanDrawInfo"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMeasureInfo_Create"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMeasureInfo_Dispose"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMeasureInfo_GetFontSize"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMetrics_Create"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMetrics_Dispose"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMetrics_SetWidth"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanMetrics_SetHeight"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_Create"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_Dispose"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_GetXOffset"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_GetLineTop"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_GetLineBottom"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_GetBaseline"
}
]

View File

@ -122,6 +122,8 @@ typedef enum {
ARKUI_NODE_GRID,
/** Grid item. */
ARKUI_NODE_GRID_ITEM,
/** Custom span. */
ARKUI_NODE_CUSTOM_SPAN,
} ArkUI_NodeType;
/**
@ -7389,6 +7391,45 @@ ArkUI_NodeHandle OH_ArkUI_NodeCustomEvent_GetNodeHandle(ArkUI_NodeCustomEvent* e
*/
ArkUI_NodeCustomEventType OH_ArkUI_NodeCustomEvent_GetEventType(ArkUI_NodeCustomEvent* event);
/**
* @brief Obtains the measurement information of a custom span through a custom component event.
*
* @param event Indicates the pointer to the custom component event.
* @param info Indicates the measurement information to be obtained.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 12
*/
int32_t OH_ArkUI_NodeCustomEvent_GetCustomSpanMeasureInfo(
ArkUI_NodeCustomEvent* event, ArkUI_CustomSpanMeasureInfo* info);
/**
* @brief Sets the measurement metrics of a custom span through a custom component event.
*
* @param event Indicates the pointer to the custom component event.
* @param metrics Indicates the measurement metrics to set.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 12
*/
int32_t OH_ArkUI_NodeCustomEvent_SetCustomSpanMetrics(
ArkUI_NodeCustomEvent* event, ArkUI_CustomSpanMetrics* metrics);
/**
* @brief Obtains the drawing information of a custom span through a custom component event.
*
* @param event Indicates the pointer to the custom component event.
* @param event Indicates the drawing information to obtain.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 12
*/
int32_t OH_ArkUI_NodeCustomEvent_GetCustomSpanDrawInfo(
ArkUI_NodeCustomEvent* event, ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Defines the node content event type.
*

View File

@ -2063,6 +2063,27 @@ typedef struct {
float perspective;
} ArkUI_RotationOptions;
/**
* @brief Defines a struct for the measurement information of a custom span.
*
* @since 12
*/
typedef struct ArkUI_CustomSpanMeasureInfo ArkUI_CustomSpanMeasureInfo;
/**
* @brief Defines a struct for the measurement metrics of a custom span.
*
* @since 12
*/
typedef struct ArkUI_CustomSpanMetrics ArkUI_CustomSpanMetrics;
/**
* @brief Defines a struct for the drawing information of a custom span.
*
* @since 12
*/
typedef struct ArkUI_CustomSpanDrawInfo ArkUI_CustomSpanDrawInfo;
/**
* @brief Defines the state of the NavDestination component.
*
@ -3410,6 +3431,120 @@ int32_t OH_ArkUI_ListChildrenMainSizeOption_UpdateSize(ArkUI_ListChildrenMainSiz
*/
float OH_ArkUI_ListChildrenMainSizeOption_GetMainSize(ArkUI_ListChildrenMainSize* option, int32_t index);
/**
* @brief Creates measurement information for this custom span.
*
* @return Returns a <b>CustomSpanMeasureInfo</b> instance.
* @since 12
*/
ArkUI_CustomSpanMeasureInfo* OH_ArkUI_CustomSpanMeasureInfo_Create();
/**
* @brief Disposes of measurement information of this custom span.
*
* @since 12
*/
void OH_ArkUI_CustomSpanMeasureInfo_Dispose(ArkUI_CustomSpanMeasureInfo* info);
/**
* @brief Obtains the font size of a custom span.
*
* @param info Indicates the pointer to the measurement information of a custom span.
* @return Returns the font size. If a parameter error occurs, <b>0.0f</b> is returned.
* @since 12
*/
float OH_ArkUI_CustomSpanMeasureInfo_GetFontSize(ArkUI_CustomSpanMeasureInfo* info);
/**
* @brief Creates measurement metrics for this custom span.
*
* @return Returns a <b>CustomSpanMetrics</b> instance.
* @since 12
*/
ArkUI_CustomSpanMetrics* OH_ArkUI_CustomSpanMetrics_Create();
/**
* @brief Disposes of measurement metrics of this custom span.
*
* @since 12
*/
void OH_ArkUI_CustomSpanMetrics_Dispose(ArkUI_CustomSpanMetrics* metrics);
/**
* @brief Sets the width for a custom span.
*
* @param metrics Indicates the pointer to a <b>CustomSpanMetrics</b> instance.
* @param width Indicates the width, in px.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 12
*/
int32_t OH_ArkUI_CustomSpanMetrics_SetWidth(ArkUI_CustomSpanMetrics* metrics, float width);
/**
* @brief Sets the height for a custom span.
*
* @param metrics Indicates the pointer to a <b>CustomSpanMetrics</b> instance.
* @param width Indicates the height, in px.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 12
*/
int32_t OH_ArkUI_CustomSpanMetrics_SetHeight(ArkUI_CustomSpanMetrics* metrics, float height);
/**
* @brief Creates drawing information for this custom span.
*
* @return Returns a <b>CustomSpanDrawInfo</b> instance.
* @since 12
*/
ArkUI_CustomSpanDrawInfo* OH_ArkUI_CustomSpanDrawInfo_Create();
/**
* @brief Disposes of drawing information for this custom span.
*
* @since 12
*/
void OH_ArkUI_CustomSpanDrawInfo_Dispose(ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Obtains the x-axis offset of the custom span relative to the mounted component.
*
* @param info Indicates the pointer to the drawing information of a custom span.
* @return Returns the x-axis offset. If a parameter error occurs, <b>0.0f</b> is returned.
* @since 12
*/
float OH_ArkUI_CustomSpanDrawInfo_GetXOffset(ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Obtains the top margin of the custom span relative to the mounted component.
*
* @param info Indicates the pointer to the drawing information of a custom span.
* @return Returns the top margin. If a parameter error occurs, <b>0.0f</b> is returned.
* @since 12
*/
float OH_ArkUI_CustomSpanDrawInfo_GetLineTop(ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Obtains the bottom margin of the custom span relative to the mounted component.
*
* @param info Indicates the pointer to the drawing information of a custom span.
* @return Returns the bottom margin. If a parameter error occurs, <b>0.0f</b> is returned.
* @since 12
*/
float OH_ArkUI_CustomSpanDrawInfo_GetLineBottom(ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Obtains the baseline offset of the custom span relative to the mounted component.
*
* @param info Indicates the pointer to the drawing information of a custom span.
* @return Returns the baseline offset. If a parameter error occurs, <b>0.0f</b> is returned.
* @since 12
*/
float OH_ArkUI_CustomSpanDrawInfo_GetBaseline(ArkUI_CustomSpanDrawInfo* info);
/**
* @brief Create a image frame from the image path.
* @param src Indicates the image path.