mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 09:12:41 +00:00
!36501 CAPI swiper 支持 IndicatorInteractive
Merge pull request !36501 from honzx/0626_swiper_capi
This commit is contained in:
commit
b54658b99b
@ -853,4 +853,12 @@ RefPtr<SwiperController> SwiperModelNG::GetSwiperController(FrameNode* frameNode
|
|||||||
CHECK_NULL_RETURN(pattern, nullptr);
|
CHECK_NULL_RETURN(pattern, nullptr);
|
||||||
return pattern->GetSwiperController();
|
return pattern->GetSwiperController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SwiperModelNG::GetIndicatorInteractive(FrameNode* frameNode)
|
||||||
|
{
|
||||||
|
CHECK_NULL_RETURN(frameNode, false);
|
||||||
|
auto pattern = frameNode->GetPattern<SwiperPattern>();
|
||||||
|
CHECK_NULL_RETURN(pattern, false);
|
||||||
|
return pattern->IsIndicatorInteractive();
|
||||||
|
}
|
||||||
} // namespace OHOS::Ace::NG
|
} // namespace OHOS::Ace::NG
|
||||||
|
@ -140,6 +140,7 @@ public:
|
|||||||
static void SetOnContentDidScroll(FrameNode* frameNode, ContentDidScrollEvent&& onContentDidScroll);
|
static void SetOnContentDidScroll(FrameNode* frameNode, ContentDidScrollEvent&& onContentDidScroll);
|
||||||
static void SetCustomContentTransition(FrameNode* frameNode, SwiperContentAnimatedTransition& transition);
|
static void SetCustomContentTransition(FrameNode* frameNode, SwiperContentAnimatedTransition& transition);
|
||||||
static RefPtr<SwiperController> GetOrCreateSwiperController(FrameNode* frameNode);
|
static RefPtr<SwiperController> GetOrCreateSwiperController(FrameNode* frameNode);
|
||||||
|
static bool GetIndicatorInteractive(FrameNode* frameNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OHOS::Ace::NG
|
} // namespace OHOS::Ace::NG
|
||||||
|
@ -2253,6 +2253,7 @@ struct ArkUISwiperModifier {
|
|||||||
void (*resetSwiperOnGestureSwipe)(ArkUINodeHandle node);
|
void (*resetSwiperOnGestureSwipe)(ArkUINodeHandle node);
|
||||||
void (*setSwiperOnContentDidScroll)(ArkUINodeHandle node, void* callback);
|
void (*setSwiperOnContentDidScroll)(ArkUINodeHandle node, void* callback);
|
||||||
void (*resetSwiperOnContentDidScroll)(ArkUINodeHandle node);
|
void (*resetSwiperOnContentDidScroll)(ArkUINodeHandle node);
|
||||||
|
ArkUI_Int32 (*getIndicatorInteractive)(ArkUINodeHandle node);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ArkUISwiperControllerModifier {
|
struct ArkUISwiperControllerModifier {
|
||||||
|
@ -405,7 +405,19 @@ void SetIndicatorInteractive(ArkUINodeHandle node, ArkUI_Bool value)
|
|||||||
SwiperModelNG::SetIndicatorInteractive(frameNode, static_cast<bool>(value));
|
SwiperModelNG::SetIndicatorInteractive(frameNode, static_cast<bool>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetIndicatorInteractive(ArkUINodeHandle node) {}
|
void ResetIndicatorInteractive(ArkUINodeHandle node)
|
||||||
|
{
|
||||||
|
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||||
|
CHECK_NULL_VOID(frameNode);
|
||||||
|
SwiperModelNG::SetIndicatorInteractive(frameNode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArkUI_Int32 GetIndicatorInteractive(ArkUINodeHandle node)
|
||||||
|
{
|
||||||
|
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||||
|
CHECK_NULL_RETURN(frameNode, ERROR_INT_CODE);
|
||||||
|
return static_cast<ArkUI_Int32>(SwiperModelNG::GetIndicatorInteractive(frameNode));
|
||||||
|
}
|
||||||
|
|
||||||
void SetSwiperNextMargin(
|
void SetSwiperNextMargin(
|
||||||
ArkUINodeHandle node, ArkUI_Float32 nextMarginValue, ArkUI_Int32 nextMarginUnit, ArkUI_Bool ignoreBlank)
|
ArkUINodeHandle node, ArkUI_Float32 nextMarginValue, ArkUI_Int32 nextMarginUnit, ArkUI_Bool ignoreBlank)
|
||||||
@ -1138,7 +1150,7 @@ const ArkUISwiperModifier* GetSwiperModifier()
|
|||||||
GetSwiperNextMargin, SetSwiperIndicatorStyle, GetSwiperIndicator, GetSwiperController,
|
GetSwiperNextMargin, SetSwiperIndicatorStyle, GetSwiperIndicator, GetSwiperController,
|
||||||
SetSwiperOnChange, ResetSwiperOnChange, SetSwiperOnAnimationStart, ResetSwiperOnAnimationStart,
|
SetSwiperOnChange, ResetSwiperOnChange, SetSwiperOnAnimationStart, ResetSwiperOnAnimationStart,
|
||||||
SetSwiperOnAnimationEnd, ResetSwiperOnAnimationEnd, SetSwiperOnGestureSwipe, ResetSwiperOnGestureSwipe,
|
SetSwiperOnAnimationEnd, ResetSwiperOnAnimationEnd, SetSwiperOnGestureSwipe, ResetSwiperOnGestureSwipe,
|
||||||
SetOnContentDidScroll, ResetOnContentDidScroll };
|
SetOnContentDidScroll, ResetOnContentDidScroll, GetIndicatorInteractive };
|
||||||
return &modifier;
|
return &modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4535,6 +4535,18 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
NODE_SWIPER_SWIPE_TO_INDEX,
|
NODE_SWIPER_SWIPE_TO_INDEX,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set to disable component navigation point interactions.
|
||||||
|
*
|
||||||
|
* Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n
|
||||||
|
* .value[0].i32: Set to disable component navigation point interaction, set to true to indicate the navigation point
|
||||||
|
* is interactive, default value is true.\n
|
||||||
|
* \n
|
||||||
|
* The return value of the attribute acquisition method {@link ArkUI_AttributeItem} format: \n
|
||||||
|
* .value[0].i32: Set to disable component navigation point interactions. \n
|
||||||
|
*/
|
||||||
|
NODE_SWIPER_INDICATOR_INTERACTIVE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief: Set the delineation component of the ListItem, supporting property settings, property resets, and
|
* @brief: Set the delineation component of the ListItem, supporting property settings, property resets, and
|
||||||
* property acquisition interfaces.
|
* property acquisition interfaces.
|
||||||
|
@ -7245,6 +7245,32 @@ const ArkUI_AttributeItem* GetSwiperIndicator(ArkUI_NodeHandle node)
|
|||||||
return &g_attributeItem;
|
return &g_attributeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t SetSwiperIndicatorInteractive(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
||||||
|
{
|
||||||
|
auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
|
||||||
|
if (actualSize < 0) {
|
||||||
|
return ERROR_CODE_PARAM_INVALID;
|
||||||
|
}
|
||||||
|
auto* fullImpl = GetFullImpl();
|
||||||
|
fullImpl->getNodeModifiers()->getSwiperModifier()->setIndicatorInteractive(node->uiNodeHandle,
|
||||||
|
static_cast<bool>(item->value[0].i32));
|
||||||
|
return ERROR_CODE_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
|
||||||
|
{
|
||||||
|
auto* fullImpl = GetFullImpl();
|
||||||
|
fullImpl->getNodeModifiers()->getSwiperModifier()->resetIndicatorInteractive(node->uiNodeHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ArkUI_AttributeItem* GetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
|
||||||
|
{
|
||||||
|
ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getSwiperModifier()->
|
||||||
|
getIndicatorInteractive(node->uiNodeHandle);
|
||||||
|
g_numberValues[0].i32 = value;
|
||||||
|
return &g_attributeItem;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t SetTextFontFamily(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
int32_t SetTextFontFamily(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
||||||
{
|
{
|
||||||
if (item->string == nullptr) {
|
if (item->string == nullptr) {
|
||||||
@ -13514,7 +13540,7 @@ int32_t SetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI
|
|||||||
SetSwiperVertical, SetSwiperDuration, SetSwiperCurve, SetSwiperItemSpace, SetSwiperIndex, SetSwiperDisplayCount,
|
SetSwiperVertical, SetSwiperDuration, SetSwiperCurve, SetSwiperItemSpace, SetSwiperIndex, SetSwiperDisplayCount,
|
||||||
SetSwiperDisableSwipe, SetSwiperShowDisplayArrow, SetSwiperEffectMode, SetSwiperNodeAdapter,
|
SetSwiperDisableSwipe, SetSwiperShowDisplayArrow, SetSwiperEffectMode, SetSwiperNodeAdapter,
|
||||||
SetSwiperCachedCount, SetSwiperPrevMargin, SetSwiperNextMargin, SetSwiperIndicator, SetSwiperNestedScroll,
|
SetSwiperCachedCount, SetSwiperPrevMargin, SetSwiperNextMargin, SetSwiperIndicator, SetSwiperNestedScroll,
|
||||||
SetSwiperToIndex };
|
SetSwiperToIndex, SetSwiperIndicatorInteractive };
|
||||||
if (subTypeId >= sizeof(setters) / sizeof(Setter*)) {
|
if (subTypeId >= sizeof(setters) / sizeof(Setter*)) {
|
||||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||||
return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
|
return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
|
||||||
@ -13528,7 +13554,8 @@ void ResetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
|
|||||||
ResetSwiperInterval, ResetSwiperVertical, ResetSwiperDuration, ResetSwiperCurve, ResetSwiperItemSpace,
|
ResetSwiperInterval, ResetSwiperVertical, ResetSwiperDuration, ResetSwiperCurve, ResetSwiperItemSpace,
|
||||||
ResetSwiperIndex, ResetSwiperDisplayCount, ResetSwiperDisableSwipe, ResetSwiperShowDisplayArrow,
|
ResetSwiperIndex, ResetSwiperDisplayCount, ResetSwiperDisableSwipe, ResetSwiperShowDisplayArrow,
|
||||||
ResetSwiperEffectMode, ResetSwiperNodeAdapter, ResetSwiperCachedCount, ResetSwiperPrevMargin,
|
ResetSwiperEffectMode, ResetSwiperNodeAdapter, ResetSwiperCachedCount, ResetSwiperPrevMargin,
|
||||||
ResetSwiperNextMargin, ResetSwiperIndicator, ResetSwiperNestedScroll, nullptr };
|
ResetSwiperNextMargin, ResetSwiperIndicator, ResetSwiperNestedScroll, nullptr,
|
||||||
|
ResetSwiperIndicatorInteractive };
|
||||||
if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
|
if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
|
||||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||||
return;
|
return;
|
||||||
@ -13542,7 +13569,7 @@ const ArkUI_AttributeItem* GetSwiperAttribute(ArkUI_NodeHandle node, int32_t sub
|
|||||||
GetSwiperVertical, GetSwiperDuration, GetSwiperCurve, GetSwiperItemSpace, GetSwiperIndex, GetSwiperDisplayCount,
|
GetSwiperVertical, GetSwiperDuration, GetSwiperCurve, GetSwiperItemSpace, GetSwiperIndex, GetSwiperDisplayCount,
|
||||||
GetSwiperDisableSwipe, GetSwiperShowDisplayArrow, GetSwiperEffectMode, GetSwiperNodeAdapter,
|
GetSwiperDisableSwipe, GetSwiperShowDisplayArrow, GetSwiperEffectMode, GetSwiperNodeAdapter,
|
||||||
GetSwiperCachedCount, GetSwiperPrevMargin, GetSwiperNextMargin, GetSwiperIndicator, GetSwiperNestedScroll,
|
GetSwiperCachedCount, GetSwiperPrevMargin, GetSwiperNextMargin, GetSwiperIndicator, GetSwiperNestedScroll,
|
||||||
nullptr };
|
nullptr, GetSwiperIndicatorInteractive };
|
||||||
if (subTypeId >= sizeof(getters) / sizeof(Getter*)) {
|
if (subTypeId >= sizeof(getters) / sizeof(Getter*)) {
|
||||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user