ZFUIPoint ZFImpl_sys_Android_ZFUIPointFromZFAndroidPoint(ZF_IN jobject jobjPoint)
{
    JNIEnv *jniEnv = JNIGetJNIEnv();
    jclass jclsPoint = ZFImpl_sys_Android_jclassZFAndroidPoint();
    static jfieldID jfIdX = JNIUtilGetFieldID(jniEnv, jclsPoint, zfTextA("x"), JNIType::S_int.getId());
    static jfieldID jfIdY = JNIUtilGetFieldID(jniEnv, jclsPoint, zfTextA("y"), JNIType::S_int.getId());
    return ZFUIPointMake(
        JNIUtilGetIntField(jniEnv, jobjPoint, jfIdX),
        JNIUtilGetIntField(jniEnv, jobjPoint, jfIdY));
}
Exemple #2
0
ZFUIView *viewChildAt(ZF_IN ZFUIView *view,
                      ZF_IN const ZFUIPoint &pos,
                      ZF_IN_OPT zfbool filterDisabledView /* = zftrue */,
                      ZF_IN_OPT const ZFFilterForZFObject *filter /* = zfnull */)
{
    if(view == zfnull
        || (filterDisabledView && !view->viewUIEnableTree())
        || (filter != zfnull && !filter->filterCheckActive(view)))
    {
        return zfnull;
    }
    if(pos.x < 0 || pos.y < 0 || pos.x > view->layoutedFrame().size.width || pos.y > view->layoutedFrame().size.height)
    {
        return zfnull;
    }

    ZFUIRect layoutedFrameFixed = ZFUIRectZero;

    ZFCoreArrayPOD<ZFUIView *> childList = view->internalForegroundViewArray();
    for(zfindex i = childList.count() - 1; i != zfindexMax; --i)
    {
        ZFUIView *child = childList[i];
        child->layoutedFrameFixed(layoutedFrameFixed);
        ZFUIView *tmp = ZFUIViewUtil::viewChildAt(childList[i], ZFUIPointMake(
                pos.x - layoutedFrameFixed.point.x,
                pos.y - layoutedFrameFixed.point.y
            ),
            filterDisabledView,
            filter);
        if(tmp != zfnull)
        {
            return tmp;
        }
    }

    childList = view->childArray();
    for(zfindex i = childList.count() - 1; i != zfindexMax; --i)
    {
        ZFUIView *child = childList[i];
        child->layoutedFrameFixed(layoutedFrameFixed);
        ZFUIView *tmp = ZFUIViewUtil::viewChildAt(childList[i], ZFUIPointMake(
                pos.x - layoutedFrameFixed.point.x,
                pos.y - layoutedFrameFixed.point.y
            ),
            filter);
        if(tmp != zfnull)
        {
            return tmp;
        }
    }

    childList = view->internalBackgroundViewArray();
    for(zfindex i = childList.count() - 1; i != zfindexMax; --i)
    {
        ZFUIView *child = childList[i];
        child->layoutedFrameFixed(layoutedFrameFixed);
        ZFUIView *tmp = ZFUIViewUtil::viewChildAt(childList[i], ZFUIPointMake(
                pos.x - layoutedFrameFixed.point.x,
                pos.y - layoutedFrameFixed.point.y
            ),
            filter);
        if(tmp != zfnull)
        {
            return tmp;
        }
    }

    if(filterDisabledView && !view->viewUIEnable())
    {
        return zfnull;
    }

    return view;
}